Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Collaborators for Allegro Demo Game Competition?

This thread is locked; no one can reply to it. rss feed Print
Collaborators for Allegro Demo Game Competition?
Thomas Harte
Member #33
April 2000
avatar

A quite selfish move, but attached is the current source code. It features a memory leak in the way I've hastily thrown the code into miran's framework but one that I'm about 10 seconds away from fixing.

It is a selfish move because there isn't really much to see here of any interest for people who have been following the thread. I'm just spending tomorrow on the train with laptop so felt a 'free' backup might be nice. Just because I'm paranoid about hard discs and journeys.

Kitty Cat
Member #2,815
October 2002
avatar

Quote:

If memory serves, the # symbol, while still valid, can be replaced by a /; I don't have time to track the messages or code for that right now, but Kitty cat will be able to confirm or rectify that statement.

Sorry, haven't been paying attention to this thread. >_>;

AFAIK, we only discussed doing this as a possibility. The issue came up about telling directories from datafiles/sub-datafiles, but since you can't have a file named the same as a directory, all you'd have to do is check. Start with making sure the "whole" filename doesn't exist (if it does, then it's not a datafile.. or at least shouldn't be treated as a non-normal file by the PACKFILE routines), then going back and cutting everything past the last /, until you find a real file, and that's your datafile (with everything after the / being the object name, with or without sub-datafiles.. which can already be / delimited).

No patch was ever made though, AFAIK.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Goodbytes
Member #448
June 2000
avatar

Quote:

The midis contain a copyright notice by "Benjamin Robert Tubb"..

They do? :/ All of them? I seem to recall getting the MIDIs for the BlitzHack off of a techno MIDI web site, and I think that they were all by different authors. In any event, the MIDIs from the BlitzHack media probably don't suit this game too well... I'm quite busy at the moment with course selections for university, but I've been working a bit at some music for the game. Anyway, the deadline for this project has been extended to July 14, so that gives us three weeks and a bit to get some sounds and songs together.

As you can tell, I haven't gotten home from work since I said that I'd check the sources of the media when I got home ;) I'll try to remember tonight.

I have re-tracked that end-of-level jingle in MIDI format. This has the advantage over WAV of being much smaller in file size and having a more consistent sound with any MIDI music that will be used. It could end up sounding poor if the user has a lousy FM synth, but it sounds just as good on my computer (a little better, since the vibraslap lasts a little longer now). I'll put the MIDI up here later.

[EDIT]

Quote:

If memory serves, the # symbol, while still valid, can be replaced by a /; I don't have time to track the messages or code for that right now, but Kitty cat will be able to confirm or rectify that statement. If I'm right, then the docs need to be updated in this anyway.

I was experimenting with this a few weeks ago, and if my memory serves, the # cannot be replaced by a / in the allegro_loading_function("datafile.dat#some/datafile/directory") context. The '#' - '/' synonymity only works with find_datafile_object.

[EDIT2]
I should mention that I have an algorithm that, given an object name à la "folder/object", will first look in a user-specified directory for a file that matches user_directory/folder/object.*, load it in if it exists, and if it doesn't, look in a user-specified datafile for userdata.dat#folder/object, and try to load that up. It is written in C++, though, and I don't quite remember how much I relied on the STL for it. Furthermore, I wasn't paying attention when we discussed the need for this, so it might not even be useful, but if anyone wants, I can try to rewrite it in C. 8-)


--
~Goodbytes

Elias
Member #358
May 2000

Quote:

They do? :/ All of them?

No, only saw it in one.

Quote:

In any event, the MIDIs from the BlitzHack media probably don't suit this game too well

True, I guess we can worry about documenting where resources not specifically created for this are from once it actually is done.

Oh, and I looked shortly at the Blender scripting interface, it should be possible to import/export vertices and triangles. Not sure how useful it would be, or if texture and other information could also be added to blender.

--
"Either help out or stop whining" - Evert

Goodbytes
Member #448
June 2000
avatar

Aha! I have it! All the S_CARTOON_* sounds came from a CD I own called "WAV Sound Effects," which I bought for 10 bucks from the local Bi-Way... which is now out of business... coincidence? :o

And... the CD says nothing about whether the sound effects are public domain or not :| And the company's website is now one of those search portals... which also means that the page is not archived on the Wayback Machine. I guess I don't know if the sounds can be used or not; a Google search on the title of the CD yields little.


--
~Goodbytes

Elias
Member #358
May 2000

Um, edited away the rest of the message when replacing the code:

1#!BPY
2 
3"""
4Name: 'Allegro Demo Game Level (.txt)...'
5Blender: 237
6Group: 'Export'
7Tooltip: 'Export Allegro Demo Game Level (.txt)'
8"""
9 
10import Blender, meshtools, sys
11 
12def write(filename):
13 file = open(filename, "wb")
14 stdout = sys.stdout
15 sys.stdout=file
16 
17 objects = Blender.Object.GetSelected()
18 meshname = objects[0].data.name
19 mesh = Blender.NMesh.GetRaw(meshname)
20 
21 print "# Raw Mesh data exported from Blender"
22 
23 print "{"
24 for m in mesh.materials:
25 t = []
26 for tex in m.getTextures()[:2]:
27 
28 if tex and tex.tex.getImage():
29 t += [tex.tex.getImage().name.split(".")[0]]
30 else:
31 t += [""]
32 print """\t{"%s", "%s", %d} # %s""" % (t[0], t[1], 0.2, m.getName())
33 print "}"
34 
35 print "{"
36 for v in mesh.verts:
37 print "\t{%f, %f}" % (v.co.x, v.co.y)
38 print "}"
39 print
40 print "{"
41 
42 for f in mesh.faces:
43 print "\t{"
44 for v in f.v:
45 print "\t\t{%d, %d}," % (v.index, 0)
46 print "\t\t%d" % f.mat
47 print "\t}"
48 print "}"
49 
50 print "{"
51 print "}"
52 
53 sys.stdout = stdout
54 
55def fs_callback(filename):
56 write(filename)
57 
58Blender.Window.FileSelector(fs_callback, "Export TDRH Allegro Demo Level")

--
"Either help out or stop whining" - Evert

Thomas Harte
Member #33
April 2000
avatar

Thanks 1,000,000 Elias! That at least cuts level design hassles down significantly. Is there any hack we can use for marking edge flags at least? E.g. is there anyway to colour edges in Blender or mark them as visible/invisible?

This should at least mean that the geometry for a level can be produced professionally and competently. I've downloaded Blender but haven't really figured it out yet.

Anyway, I have slightly patchy internet access at the minute and haven't had any spare coding time during the last two days. One of them was taken up by a train journey and the other by the first stage in moving out of my current house & getting results for my vocational law course (I passed).

Today I've added a basic textured plane as a background, meant to represent the sea and am about to throw some clouds in on top. I'm not really sure how to deal with the anti-aliasing of those. Initially I decided just not to have them overlap but with the level of perspective implied by the sea that is going to be hard to maintain.

Anyway, I'll endeavour to do a new source post tomorrow and in the meantime will also try to figure out blender.

EDIT: Ahem, fallen at the first hurdle. How do I even use an export script in Blender?

Richard Phipps
Member #1,632
November 2001
avatar

Thomas Harte
Member #33
April 2000
avatar

Oh, yeah. Here:

http://www.imagehosting.us/imagehosting/showimg.jpg/?id=559936&.jpg

I need to work on it a little more but right now I'm simplifying the quad tree stuff.

EDIT: the black lines are a debugging feature - I'm also working on the ability to somethings fall through platforms.

Richard Phipps
Member #1,632
November 2001
avatar

Can't see anything besides 'picture' Thomas. :(

Thomas Harte
Member #33
April 2000
avatar

Weird. Appears fine from here. Probably because the link doesn't make the file extension obvious. I'll have a go at editing it, otherwise try this:

http://www.imagehosting.us/?id=559936&type=viewpic

Be forewarned: it still looks a little odd.

Richard Phipps
Member #1,632
November 2001
avatar

Elias
Member #358
May 2000

Quote:

EDIT: Ahem, fallen at the first hurdle. How do I even use an export script in Blender?

Well, I did run it from within Blender's text editor.. but, I edited it now, so it is a real export script. Also added it as attachement here, as well as an experimental import plugin. Here in linux, I simply put both files into ~/.blender/scripts, then there appear two new menu items the next time Blender is run, Export->Allegro Level, and Import->Allegro Level.

You should bear in mind, this is my first playing around with python scripting in Blender, so it's very fragile. To import, load the "level.txt" (not tested with anything else), and make sure the two bitmaps are in the same folder as level.txt. Then select the mesh (else blender crashes :|), go into face select mode (F key in object mode), and set the viewing to "textured". And then zoom out for like a second, since I didn't scale the coordinates.

Looks like this in blender right now:

{"name":"blender_ademo.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/f\/4f9bba85a03a48b2185a66a4c216c5c8.png","w":551,"h":678,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/f\/4f9bba85a03a48b2185a66a4c216c5c8"}blender_ademo.png

To export, again make sure to have the mesh selected, or it will crash.

About the edge flags, one idea would be, to have all edges with the same flags in the same layer. Didn't try it though yet, and not sure you can stuff inside one mesh be in different layers.

--
"Either help out or stop whining" - Evert

NyanKoneko
Member #5,617
March 2005
avatar

I love blender's import / export system. You should include the blender scripts with the game so people can play with it and design their own levels. ;D

Elias
Member #358
May 2000

Blender just isn't really suited to this level format. It's more object oriented. I found out, with the pink pacman button, I can add arbitrary properties to an object. So this definitely can be used for all sorts of object.

But a mesh simply is one object, and per-face or per-edge flags are a problem. The current way only works with up to 16 textures, and requires messing with the UV editor. But there would be a way to abuse the z-value of each vertex somehow maybe..

--
"Either help out or stop whining" - Evert

Thomas Harte
Member #33
April 2000
avatar

Okay, first of all apologies. As I may or may not have mentioned, I've moved rooms in my (student) house. This has caused a break in my internet, in the first instance because I simply moved out of wifi range and possibly in the second because the new tenants which I have still not really met have put their own router in. And I need to figure out which of them knows the network name and password and am not getting very far at present.

Things changed since last I posted:

  • water undulates and generally looks much nicer

  • clouds float by, although some issues remain when close to the surface of the water because set_clip_rect appears simply not to work

  • surface collisions should be fixed now so that you can never fall through (involves some runtime edge stripping but is otherwise quite trivial

  • QuadTree.c is fully commented. Line for line its actually about 50% comment so I hope it is easy to follow!

I'll post new source as and when I can.

Would it help for Blender if I implemented a system that accepts multiple vertex/triangle sets? Maybe with an offset too, so that everything is fully 'object orientated' (albeit that objects need to be repeated where the same shape is simply placed multiple times in a level).

I've also written the game blurb, but can't remember it offhand! Next target is implementing objects. I'm having a bit of a dither as to whether to place them into their own quadtree or the same one as the triangles. Probably I'll chuck them in with the triangles.

I'm starting to think I may abandon 8bpp due to effort vs time.

Elias
Member #358
May 2000

Quote:

Would it help for Blender if I implemented a system that accepts multiple vertex/triangle sets? Maybe with an offset too, so that everything is fully 'object orientated' (albeit that objects need to be repeated where the same shape is simply placed multiple times in a level).

Well, so far, the use of the Blender export would be that you draw a mesh for the level, then export it. I will soon add support for multiple mesh export (not just the selected as right now), so then you could draw any number of meshes, assign textures to them, and then each texture would be exported as a material, and all the meshes as triangles.

After that, you would need to manually add in all the other parameters, like the edge textures, edge heights, edge flags.

The question is now, do we want more, so everything can be edited in Blender, specifically the things I just listed? Then most probably the per-edge stuff should be changed to per-mesh stuff.. at least that would make the export script easier..

--
"Either help out or stop whining" - Evert

NyanKoneko
Member #5,617
March 2005
avatar

Evert
Member #794
November 2000
avatar

Quote:

some issues remain when close to the surface of the water because set_clip_rect appears simply not to work

Can you elaborate? What are you doing exactly that doesn't work?
I don't use the clipping rectangle functions much (I usually create subbitmaps at the start of the programme if I want to do something similar for larger bitmaps), but as far as I know they used to work and haven't changed very recently.

Thomas Harte
Member #33
April 2000
avatar

Quote:

The question is now, do we want more, so everything can be edited in Blender, specifically the things I just listed?

Ideally yes, but of course we must remain mindful of the severe time constraints!

Quote:

How can I help?

How are you at Blender? :)

The things I need right now are some sort of tune that fits in with the 'its about to rain' theme (try the latest version, attached, you'll see what I mean - check out the 'Info' from the main menu) and a graphic of a shut door and an animated opening with a frame that can be left on screen for open. Also a font, which will display in one corner of the screen a count of objects remaining to be collected (so probably numbers only will do).

Quote:

Can you elaborate? What are you doing exactly that doesn't work?

Unsirprisingly it was my error.

Anyway, a version is attached which 'should' be a good working represenation of the latest code!

The distribution size shouldn't end up being much bigger than it is now. I've done no real work since I last posted so the very next thing to do remains add collectable objects.

NB: you'll note the black debugging lines remain around the landscape. Check them out compared to the ones in the screenshot above and you should notice some subtle fixes (esp. see the left hand top edge of the curve)

EDIT2: a screenshot for those who don't feel any interest in building:

http://www.imagehosting.us/imagehosting/showimg.jpg/?id=568356&.jpg

Elias
Member #358
May 2000

I downloaded the version AlDemo280605.tgz, but it looks like this for me (especially note the gap through which the guy falls out into space :P):

{"name":"ademo_bug.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/1\/411d918820c8831f4fe59c5d7b17e3ff.png","w":652,"h":511,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/1\/411d918820c8831f4fe59c5d7b17e3ff"}ademo_bug.png

--
"Either help out or stop whining" - Evert

Thomas Harte
Member #33
April 2000
avatar

Quote:

I downloaded the version AlDemo280605.tgz, but it looks like this for me

Interesting! Obviously my line clipping isn't working as well as I would like to believe! I'll bump a thorough reread of that to the top of my list when I get back to my development machine. Assuming I can't find anything glaring (although taking a look at the graphic, I can guess more or less where I need to be looking), would you be willing to run a version that dumps a bunch of debug information for me?

The only change I've attempted since uploading was a switch to datafiles for resources, but it simply didn't work. At the minute I have a function that says something like this:

BITMAP *GetBitmap(char *name)
{
   char LocName[256];
   sprintf(LocName, "%s.bmp", name);
   return load_bitmap(LocName, NULL);
}

Which I've changed to this:

BITMAP *GetBitmap(char *name)
{
   char LocName[256];
   sprintf(LocName, "game.dat#%s", name);
   return load_bitmap(LocName, NULL);
}

But that doesn't work even though I know game.dat exists and has that object (i.e. a BMP named 'soil' where previously there was 'soil.bmp'). I'm sure I'm making some stupid error.

Anyway, those problems aside, what is your opinion of the commenting in QuadTrees.h and the water/clouds?

Evert
Member #794
November 2000
avatar

Quote:

I'm sure I'm making some stupid error.

Keep the .bmp extension; load_datafile() needs to know what format the data is in (note: you'll need to import teh bitmap as binary data, you can't use load_bitmap() to read an Allegro BITMAP from a datafile).

Elias
Member #358
May 2000

Sure, you can send me a debug version any time. I'll look at the QuadTrees.h tomorrow..

Oh, just something I noticed above - something like uszprintf(sizeof LocName, "%s.bmp", name) instead of sprintf might be better, sprintf is known to cause lots of buffer overflows in C code after all..

--
"Either help out or stop whining" - Evert

Thomas Fjellstrom
Member #476
June 2000
avatar

That and load_bitmap doesn't know how to read DAT_BMP objects, you have to include the bitmap as a binary object.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730



Go to: