The Legend of Edgar

The Legend of Edgar is a platform game featuring a persistent world, various weapons, puzzle solving and over 50 different enemies.

It is available for Linux and Windows and the source code is also available. It is written in SDL and supports (reconfigurable) keyboard and joystick.

A YouTube video is here

and you can download the game from here

It should be pretty stable by now, but if you do encounter any problems then let me know.

Richard

A great game :smiley: I’ve been playing it for several days.

Thanks for give us the source code. It will be very helpful.

I have a question about your resources(images, sound), i’m using windows and i’ve seen your resources are compressed in a .pak file. How did you do that? I want to learn how to do that, for use it in my game
:smiley:

Cheers.

(This is quite complicated by the way)

Have a look at pak_creator.c

http://legendofedgar.svn.sourceforge.net/viewvc/legendofedgar/trunk/src/pak_creator.c?revision=947&view=markup

This program recurses through one or more directories and appends file that it finds to a resource file. So you might have

gfx/player_stand.png (64k)
gfx/player_fire.png (90k)
sound/pistol.ogg (6k)

First, I get the size of the file and the size of the resource file, which will be 0 initially. Next, I add this information to a structure. So, I’ll have the following:

fileData[0].name = “gfx/player_stand.png”; /* The name of the file we’re about to add /
fileData[0].size = 64000; /
Its size in bytes /
fileData[0].offset = 0; /
The current size of the resource file */

Now I use fwrite to append this file to the resource file, then I get the next file:

fileData[1].name = “gfx/player_fire.png”; /* The name of the file we’re about to add /
fileData[1].size = 90000; /
Its size in bytes /
fileData[1].offset = 64000; /
The current size of the resource file */

As you’ll see, the size of the resource file is 64,000. That’s because we previously added that image. Now we add the next file and move to the next one:

fileData[2].name = “sound/pistol.ogg”; /* The name of the file we’re about to add /
fileData[2].size = 6000; /
Its size in bytes /
fileData[2].offset = 154000; /
The current size of the resource file */

Once we have added all of the files, we’ll have a resource file and a structure array that tells us where each file is and how big it is. So, if we wanted to find gfx/player_fire.png, we would loop through our structure and a string compare on the fileData[i].name until we find it. Once we find it, we can find out how big it is and where it lives in the resource file.

Does this make sense so far?

I’m diabled and so without mouse support I was unable to play. It looks like a nice clean beta.>edit> disabled even :slight_smile:

I’m diabled and so without mouse support I was unable to play. It looks like a nice clean beta.

Ah, I’m sorry to hear that. The game only supports keyboard or joystick I’m afraid.