Nestix: Level Data

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Nestix: Level Data

Post by JS Lemming »

I've been tring to decide on how to do this, lets dicuss it here.

The file would be written in binary mode. Ok, now we have to come up with all the things that need to be in the file so levels will work.

So far i have:

Tileset file (ie: "Mario.png")
Music file( "happy.mid")
BG Image file ("sky.png" the bg image will be tiled in game)
Event list file (ie: "Mario.evn")
The event list would be an ascii file containing keywords next to numbers so events can be identified. Here is an example:
1:solid
2:player
3:goomba
4:secretdoor
5: ect. ect....

When the level is loaded, the event numbers in the level data will be compared to the numbers in the eventlist file, and act accordingly.

Audio list file ("Mario.aud")
This would also be an ascii file containing a list of all the required sound effects for this level. Example:
turtlejump.wav
goombadie.wav
coin.wav
....and so on...

When the level is loaded, the program loads all the sounds in the list UNLESS they are already loaded (from previous file). Then all the sound files not in the list are unloaded. This does not count for sounds like player jumping and such, since they are always used.

This is all i can think of right now. Please post what you think should be added/deleted/changed.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

yeaaaaah..... It's been, what, 3 days since i posted this? Come ON! What happened to the break is over after last monday deal!!!!!
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Yeah, I just didn't want to give my $0.02 until somebody like MarauderIIC brought up the obvious good points that I'd of missed. I see that everything looks good. But what if I want another background PNG? I'm in the level, then I go in a cave. That'd need a new BG and actually perhaps a new music file.

Also, with the ASCII stuff, would people not be able to just edit it and really screw with some stuff?
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Nestix: Level Data

Post by MarauderIIC »

So tote custom levels.

Event list is... what, exactly? You mean like a master entity list?

Perhaps write out an example level file so we have more of an idea...

As for organization, my text adventure is organized for ease-of-editing and is laid out like so:

World file contains a list of zone files. (Can have multiple worlds.)
Zone files contain data for multiple rooms.
Each room in the zone contains:
- Data identifying the link to another room, and what zone it's in. Does a check to see if number is current zone so search is unneeded.
- What NPCs are in the room
- What items are in the room

When the world is loaded, the engine "decyphers" the links into pointers by looking them up by number and zone. This way the links don't have to be searched for every time someone wants to change rooms.

Code: Select all

class RoomInfo {
    RoomInfo* nExit;
    RoomInfo* eExit;
 /* ... */
};
To adapt this kind of thing, you would have some sort of special portal object, doorway, pipe, something. When this is activated -- player goes through, down, etc -- that is considered as a link to the next "room," if I were to relate these two like that.

You would have to store the x,y coods of the object and do activation tests when they press appropriate key. Search through portals (stored in a vector probably) and see if player is in appropriate position to activate one. I always find myself thinking to see if there's a way to look around the player easily.... IE, say "what's at (14, 24), which is right below the player?" w/o searching through all objects to see what's there. Search time in this case is shrunk by only checking objects of type.

Have each room have data for restart music, what music to play, what sky, what background, etc. Zones are levels, and contain rooms. (Over)World contains all zones.

There is a master item list which contains filenames for each item to load. Each item file contains index number and properties.

Same for NPCs.

If you want to see a few of my zone/room/item/NPC files, lemme know.
Last edited by MarauderIIC on Thu Nov 25, 2004 7:16 pm, edited 2 times in total.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

In my level editor, you can lay events down (just a number from 0-255), and instead of defining what each event does in each level in the code itself, you just make a list and let what ever levels use which ever lists.

GyroVorbis, when you say "I'm in the level, then I go in a cave." You mean go in a door or something right? Because if that where the case, you just load up the cave level (i guess I should really be saying "Map" instead of level since 1 level could consist of more then one map).

Mar, i forget, what does NPC stand for? Non Playable Characters? Also I think you data system is great but a little to much for Nestix. Besides, I almost have my system working.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

JS Lemming wrote:GyroVorbis, when you say "I'm in the level, then I go in a cave." You mean go in a door or something right? Because if that where the case, you just load up the cave level (i guess I should really be saying "Map" instead of level since 1 level could consist of more then one map).
Yeah, that's exactly right. Never mind then. :!!!!:

Also, when you say that you "almost have it working", I really don't know what you're talking about. I've never made a level with "event lists". This is in the BlitzPlus level editor? I think I'm seeing what you're talking about. Is there an example perhaps you could supply me with?
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

Hrmm let me think. Well consider this event list.

Code: Select all

solid
start
goomba
mushroom
crushblock
See, we would make an event list for a level first (or use an existing one) in notepad or something. In reality, each line represents a number, solid being 1 and start being 2 and so on. Now in the level editor, instead of guessing what each event number (0-255) actually will be in the game, you can see the english version. For example, you put your mouse over event #4, and the word "mushroom" appears above it.

Now, in the actuall game programming, when the level is being created/loaded, we can execute a function based on the word in the event list. So, when the computer is analyzing the events, all events with a value of say 3, will execute a create goomba function at those coordinates.

Does that make any sense?
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Coolness.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

Dang it! I've ran into a problem. I'm working on the blitz side currently. Ok, I can save strings to a text file one byte at a time by takeing one char from the blitz string and useing a function that converts the char to its ascii value, so that all works. BUT, I can't figure out a way to load in the string because Blitz doesn't really allow direct access to memory, so I can't just build the strings out of the ascii values in the text file. Need help fools!
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Post by MarauderIIC »

Whatever happened to getline() ? :(
All I can do for you is name C++ equivalents... I suppose you can't store the whole string at once into the file either?

We might hold off on a level editor since we can always put stuff in by hand... and if we sit down and plan we might change how levels are laid out or what we want in them or something.
Last edited by MarauderIIC on Sun Nov 28, 2004 11:36 am, edited 1 time in total.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Blitz is just pathetic. I can't imagine how gay that must be.

Okay, if we have to, we can write a .DLL to load up in blitz, right? I can't think of anything better.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

GyroVorbis wrote:Blitz is just pathetic. I can't imagine how gay that must be.

Okay, if we have to, we can write a .DLL to load up in blitz, right? I can't think of anything better.
I swear I was thinking the same thing about the .dll thing but there is still a problem. If I'm not mistaken, blitz strings are formated differently then c++.

Sure, I'll hold off on the level editor, but we better get on this designing thing!
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Yeah, okay.

And BTW, Perl stores strings differently than C++ and you have to go through this process of conversion. Surely there must be some possible way to do that.

But yes, onward with design.
Post Reply