http://lua-users.org/wiki/PlutoLibrary/
http://luaforge.net/projects/pluto/
Basically Pluto is a persistence library for saving program states so that they can be loaded back later. One of Pluto's specific uses is to make game saving/loading very easy. I was thinking that this is a basic enough functionality that it might pay to have some sort of integration into LÖVE.
Integrating Pluto with LÖVE?
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Integrating Pluto with LÖVE?
This was already mentioned somewhere on the forums, but maybe rude'll now think there are more people wanting to save their data in an easy way.
Rude, topic is all yours
Rude, topic is all yours
Re: Integrating Pluto with LÖVE?
Hm, that is pretty neat. You can choose which variables you get to save and which you don't, right? If so, I'm all for implementing it!
Re: Integrating Pluto with LÖVE?
I've been very sceptical about this before, and I still am. You will NOT[1] be able to do this:bartbes wrote:This was already mentioned somewhere on the forums, but maybe rude'll now think there are more people wanting to save their data in an easy way.
Rude, topic is all yours
Code: Select all
-- Saving ...
actor = {
x = 0, y = 0,
image = love.graphics.newImage("awesome.png")
}
pluto.awesome.save(actor, "actor.dat")
-- Later:
actor = pluto.awesome.load("actor.dat")
love.graphics.draw(actor.image, actor.x, actor.y) -- GRAND FAILURE.
[1]: Space-echo goes here.
Re: Integrating Pluto with LÖVE?
Could you be a bit more specific about the issues involved rude? The author of pluto is a moderator and regular poster over at the gamedev.net forums(Sneftel is his username), and I could try asking him about any issues you think it might have.rude wrote: I've been very sceptical about this before, and I still am.
A sample of a previous question someone had for him:
Pluto: Can I use it in a commercial engine? Can it manage circular-references? Is it resistant to versioning? Can it use custom serialization(define what is serialized and what not)? Does it allow non-intrusive serialization like boost?
Yes, yes, kind of, yes, kind of. Pluto is versioning-agnostic... if an object has a particular field when it is saved, that field will be there when the object is reloaded. Handling unexpectedly missing fields due to version differences is left to client code. As for non-intrusive serialization, custom serialization routines for objects are through the metatable instead of the object itself. So you don't need to change the object's interface or its behavior, but you do need to change its metatable. (There's a way around this, but it's probably not worthwhile.)
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Integrating Pluto with LÖVE?
I'll try to explain what rude said:
Most of the things returned by calls like newImage are userdata, userdata is basically a C pointer, so when you load it again, the pointer references to nothing, and everything starts burning, and the LÖVE unicorns start dying
So.. avoid that.
Most of the things returned by calls like newImage are userdata, userdata is basically a C pointer, so when you load it again, the pointer references to nothing, and everything starts burning, and the LÖVE unicorns start dying
So.. avoid that.
Re: Integrating Pluto with LÖVE?
I meant to disrespect to Pluto, I'm sure it's awesome.Simtex wrote:Could you be a bit more specific about the issues involved rude? The author of pluto is a moderator and regular poster over at the gamedev.net forums(Sneftel is his username).
Other than that: what bartbes said. I will add, though, that there are two types of userdata in Lua: "full" userdata, in which the Lua VM does the memory allocation, and light userdata, which is just a C pointer. Even if we converted all userdata objects to full userdata objects, then Pluto could probably handle the reading/writing of memory, but we would still be dependent on consistency with external "states", such as OpenGL and OpenAL.
Example! Image objects returned by love.graphics.newImage contain an integer value representing the texture. This integer value is determined by OpenGL. If a full userdata Image is written to disk and read back by Pluto, then that integer value does not mean anything, because the OpenGL texture is not really created on the GPU. The same thing applies even if no external hardware is present. A File from love.filesystem, for instance, will require a handle allocated by PhysicsFS.
... that may have been poorly explained.
EDIT, forgot to say: we could still add Pluto as long as this issue is made crystal clear. Use the tracker system.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests