save system

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

save system

Post by jjmafiae » Wed Jul 25, 2012 5:14 pm

im making an open world game( 2d,singleplayer) and i need a save system can someone help me?

raen79
Citizen
Posts: 55
Joined: Sat Jul 21, 2012 11:58 pm

Re: save system

Post by raen79 » Wed Jul 25, 2012 5:32 pm

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?

jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: save system

Post by jjmafiae » Wed Jul 25, 2012 5:36 pm

yes, thanks :D

User avatar
dreadkillz
Party member
Posts: 223
Joined: Sun Mar 04, 2012 2:04 pm
Location: USA

Re: save system

Post by dreadkillz » Wed Jul 25, 2012 5:47 pm

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

User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: save system

Post by josefnpat » Wed Jul 25, 2012 9:11 pm

jjmafiae wrote:im making an open world game( 2d,singleplayer) and i need a save system can someone help me?
Bascially, you want to serialize your data, and then use the love.filesystem functions to save and load the data.

For more structural, smaller, and faster serialization formats, consider using:
  1. JSON4Lua (My Favorite!)
  2. Other Lua serialization libraries.
For more legible serialization formats, consider using:
  1. an INI parser (bartbes has a nice one here.)
  2. 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

User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: save system

Post by Inny » Thu Jul 26, 2012 3:54 am

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).

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests