Jump to content
  • Advertisement
Sign in to follow this  

Map file structure

This topic is 2953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys.

I am writing a game editor for my current game in development.

My intention with this software is not only to be able to create maps, but content. I want it to allow us to create maps, add npcs to this map and define their behaviour, as well as add enemies to this map, define the "unwalkable" parts of the mat, etc.

What Im currently thinking about is how to store different information.

I am not sure if I should save npcs and enemies in different files, and relate these creatures (probably with a reference file, listing my creatures and the files that define them).
I will probably do so for generic enemies that can be seen in several places, so I wont have to repeat the definitions for these generic enemies in several places. But what about npcs. Should I save an npc in a separated file and link the file to my map file? seems like a bit of work for a behaviour that will only be used once in a defined map.

Sorry if this is a weird question, sorry for my iffy english and any lack of information.

Share this post

Link to post
Share on other sites
Depends on what these game objects look like, and how they are used (and re-used) between maps/levels/games etc.

One way is to keep a separate database of "blueprints" which contain the default monsters, NPC, items, etc data objects. As these are placed into a map or level, this default data can then be modified. Blueprints may be simpler versions than the map objects.

Or the map may reference the blueprint from the database directly, and extend the object with map only data. This would allow changes in the blueprint database to affect any map or level that references it, so that when it came time to do game balancing, tweaks could be done on a more global level.

For simpler objects that are rarely going to be re-used, per map objects are probably simpler. What kinds of data do NPC's have associated with them? Dialogue, stats, sprite/animation keys, skills/spells, inventories? Are other game objects (e.g. items) going to be referenced from NPCs or enemies?

Share this post

Link to post
Share on other sites
All depends on the type of level you have there. For the tile based game, I save only what I really need so the file is as small as it can get.
For example, when I save enemies I only save X,Y and Type of the enemy. Laters, when I load map I load type of the enemy that ID defines.
If Type = 1, then I load orc, if Type = 2, then I load deadly albatros etc.

Ok, there are more complicated things like doors and buttons which triggers those doors to open.
First of all I save all doors with X,Y and Type and ID, then I save buttons with X,Y, type, and target ID (which is the ID of the doors)
That makes any sense?

Let's say you have numerous NPCs, then you only save ID and position of the NPC, other stuff you should hold in other data files.

Think in this direction -> Don't save things directly into the map that will repeat over and over.

Share this post

Link to post
Share on other sites
Keep in mind that if you allow re-editing maps in the later phases (adding NPCs/ behavior/placeable objects) that you
will want to VALIDATE if the change is going to effect the dependant objects (I if you change terrain so that its inaccessible or
no movement that the other phase objects have to be flagged as in error and in need of correction.

Ive seen editor for comercial games that did not always do this correctly (was map building tools for players) and the saved
game image would get messed up and would kill the game program if run (and not only the game engine but even zap the tools that
tried to reload the map for more editing).

That goes double for 'behaviors' where scripted behavior reference other objects which later editing might remove and the logic was stuck with
a bad/invalid pointer.

How you flag the user to the 'invalid' state also can get complicated. Every editting change needs to check what it will effect and the user
may need to be alerted BEFORE the change is made permanent. Enumerating all the things now 'out of whack' as part of the tool and
allow easy access to them for corrections/adjustments (AND NOW check the effect of modifying them have on the data set ...).

With lots of interdependancies there can be the 'chicken before the egg' problem with incomplete editing having things in an invalid state
until the user finishes making the set of changes (which hopefully will resolve the issues). Thus in that situation you have to supress the validation
checks (or the demands for corrections) until the user indicates.

For editing you will want to support LOTS of saved (incremental) images which on a large world may be prohibitive.
You may have to break up areas to be worked on independantly (with few interdependancies of data between them)
You would want undo traces in the in-memory editing to allow the player to undo destructive editing mistakes (and you can get
sophisticated/complicated with a redo that allows selectively reapplying changes after one part of the trace was corrected)

Ive seen it many times - the tools often turn out to be as big a project as the game engine itself (doubly so if they have to be idiot-proofed for
player use)

Share this post

Link to post
Share on other sites
Thank you guys for the support, your replies have given me lots to think about. I hadnt considered the validation of changes made in the middle of the creation of a map that could invalidate several already created objects, or the deleted behavior inside a script, but I believe that loading the premade actions and creatures to memory when starting the program will allow me to check when I load a map if that map contains any object in an invalid state.

Also, the undo redo issue I wasnt really sure of how to manage code-wise, but your mention of "[color=#1C2837]support LOTS of saved (incremental) images" already gave me a place to start that I indeed did not think about.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!