save system
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
save system
im making an open world game( 2d,singleplayer) and i need a save system can someone help me?
Re: save system
Well, there are a few things you could do You could tell the system to save every few seconds or minutes with love.timer.getTime and write the player's position and, you know items, quests etc... in a file with love.filesystem.write . You could also just have a menu that will pop up when the player presses on ESC and there he could save. Then you will use the same system of writing it in a file. Is that what you were looking for?
- dreadkillz
- Party member
- Posts: 223
- Joined: Sun Mar 04, 2012 2:04 pm
- Location: USA
Re: save system
You can save your stuff in a table, and serialize it into a file. Serialization is a process that turns something into strings so it can be converted back into data. You would need to create a function or use a library that converts the strings into data again.
Some topics: link
Some topics: link
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: save system
Bascially, you want to serialize your data, and then use the love.filesystem functions to save and load the data.jjmafiae wrote:im making an open world game( 2d,singleplayer) and i need a save system can someone help me?
For more structural, smaller, and faster serialization formats, consider using:
- JSON4Lua (My Favorite!)
- Other Lua serialization libraries.
- an INI parser (bartbes has a nice one here.)
- XML (perhaps something like this?)
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Re: save system
If pieces of the world are changing in some meaningful way (like Minecraft/Minicraft/Terraria), then break down your world into logical units (sometimes called chunks) and save them independently. If, for instance, the player walks too far away from a chunk, that would be a good time to save it, and possibly remove it from memory (though, this probably isn't neccessary unless the world is going to be exceedingly large).
Who is online
Users browsing this forum: No registered users and 15 guests