Game Development Community

Persistent game level?

by Adam Beer · in Torque Game Engine Advanced · 01/21/2009 (4:27 pm) · 4 replies

I wasnt able to find anywhere on the forums where people talk about making a game world persistent. I would like to be able to go in-game and pickup items and move them around and exit the game. Once I load it back up, those objects are still in the same spot I moved them. This is mainly for items, vehicles and some other classes of shapes. Anyone have any resources or ideas on how to do this?

Thanks.

#1
01/21/2009 (4:39 pm)
The first GTGP book gives a great example of how to do this. You would have to load those items from a text file (or script) and save their location when they get moved. Then, when the player restarts the game, the mission file pulls it's location from the text/script file. You could write a function that:
onDrop() save the location to file with a writeFile() command overwriting the original location. The problem with this tho, is each item would have to have it's own name and location.

#2
01/21/2009 (6:07 pm)
http://www.garagegames.com/community/blogs/view/14794

The basis of it is saving the mission state before you exit the game / level. Then next time you goto load up the game it just loads the last mission state.
#3
01/23/2009 (8:32 pm)
Thanks guys, got it working.
#4
01/23/2009 (10:42 pm)
@Adam, if you end up needing something more flexible, there are various database resources. If you're not familiar with database design/querying it may not be worth it unless you can afford to spend the time to dive into it (it's not terribly complex for simple databases, but it can get quite hairy*).

* - See this example.