Lovely Physics Sandbox

Show off your games, demos and other (playable) creations.
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

Re: Lovely Physics Sandbox

Post by Alexar »

hey~~ glad to see that~~ I just tested you .love, it seems that the fps is a little low ? or the movement is not very smooth.
and here is something new
Last edited by Alexar on Mon Sep 12, 2016 12:38 am, edited 2 times in total.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Lovely Physics Sandbox

Post by airstruck »

Alexar wrote:it seems that the fps is a little low ? or the movement is not very smooth.
Try adjusting the "updates per second" slider, I left the default value very low but it should look smooth between 30 and 60. If that doesn't fix it please let me know. :)
and here is something new
I couldn't get it to run: Error: editor/interface.lua:0: bad argument #1 to 'unpack' (table expected, got nil)

Looking forward to seeing what you're working on, though. I hope the progress that's been made lately with serializable physics worlds will be useful to you in your latest project. I think worlds will be fully serializable when #1194 is resolved (I hope that will be soon; there's a patch there that should be good to go whenever someone finds time to review it).
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

Re: Lovely Physics Sandbox

Post by Alexar »

Did you notice that, sometimes the objects go missing if GC is on. not completely deleted, but remains the base class, but the class inherited. for example, a revolute joint, witch has a motor, after gc, the type of the joint remains revolute, but the function setMotorSpeed is gone. that's why?
in my opinion, the serialization of the world should not only readable to the engine, but also to human.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Lovely Physics Sandbox

Post by airstruck »

Alexar wrote:Did you notice that, sometimes the objects go missing if GC is on. not completely deleted, but remains the base class, but the class inherited. for example, a revolute joint, witch has a motor, after gc, the type of the joint remains revolute, but the function setMotorSpeed is gone. that's why?
Yes, it's really weird and really rare. I'm not sure why it happens. It always seems to be methods of joints that disappear. I suspect this is happening on Love's end, but I haven't been able to recreate it reliably, so I haven't filed a bug report yet. If you (or anyone else) has any idea why this happens or how to recreate it, please let me know.
Alexar wrote:in my opinion, the serialization of the world should not only readable to the engine, but also to human.
This is up to the serialization library, I just dropped in knife.serialize but it could use a serialization library that does some kind of pretty-printing that's more geared toward debugging. Is there a pretty-printing serialization library that you like?

I intend to make the scenes scriptable by letting users give IDs and maybe "tags" to objects in the editor that would be saved along with the world. Then you would write code in a separate file named scene.lua stored in the save folder alongside world.lua. When you first create a world, the tool would save a skeleton of scene.lua. So world.lua would be generated by the tool, and you wouldn't touch that, but you'd edit scene.lua, which would require world.lua, and you could write collision callbacks, an update function, and so on in scene.lua, referencing any unique objects by their IDs and referencing groups of similar objects by their tags. I haven't totally worked out how I want to do everything, but I think it will go something like that. In the end I'm thinking you'd treat world.lua as a sort of black box (similar to UI code generated by UI design tools). It wouldn't hurt to make it human readable anyway, though.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Lovely Physics Sandbox

Post by bartbes »

airstruck wrote:Yes, it's really weird and really rare. I'm not sure why it happens. It always seems to be methods of joints that disappear. I suspect this is happening on Love's end, but I haven't been able to recreate it reliably, so I haven't filed a bug report yet.
Is it possible the only reference to the class is a Fixture's userdata? In that case it may be issue #1177.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Lovely Physics Sandbox

Post by airstruck »

bartbes wrote:Is it possible the only reference to the class is a Fixture's userdata?
I don't think it has anything to do with userdata, it also seems to happen when none of the physics objects have any userdata. This tool only uses userdata for a custom color plugin, and I'm sure I noticed it before that was added. I've had this happen maybe 5 times over the whole time I've been working on this thing.

I had a more descriptive explanation here but I'm removing it because It's been a while since I've seen the bug and I'm not sure I'm remembering it properly. I'll be working on this more over the next few weeks, and I'll put together a bug report if it happens again. I can't actually prove it's a bug in Love and not my own code at the moment, but the relevant part of my code is pretty straightforward and every time I looked into this I couldn't find any place for a bug like that to hide. My original plan was to eventually try to force the bug through some kind of stress test and then report it.
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

Re: Lovely Physics Sandbox

Post by Alexar »

I am testing if I use a global reference to every joint could fix the problem.

Code: Select all

local ref
local _newWorld = love.physics.newWorld
function love.physics.newWorld(...)
	ref = {}
	return _newWorld(...)
end
local function add(j)
	table.insert(ref, j)
	return j
end

local _gearjoint =  love.physics.newGearJoint
love.physics.newGearJoint=function(...)
	return add(_gearjoint(...))
end
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Lovely Physics Sandbox

Post by airstruck »

Alexar wrote:I am testing if I use a global reference to every joint could fix the problem.
Are you seeing the same problem in Box2D Helper?

I'd like to make a small test case to isolate the problem. I guess it might go something like this:

- create a joint, and let any references to it go out of scope
- manually call collectgarbage to ensure the reference is collected
- get a new reference to the joint through World:getJointList
- ensure that the new reference is really not the same as the old reference (using tostring maybe)
- call some method of the joint, like setFrequency, and call world:update
- repeat everything in a loop and hope the problem occurs

Do you think that might work, or do you have any other ideas?

I think I've only seen the problem during undo/redo with this tool, which means a new world is being created from a saved state. That makes me think it might not have as much to do with the GC, and might have more to do with the joint somehow not being fully initialized when its methods are called. I've looked at that part of Love's code quite a bit and have no idea how it would happen, though. Maybe something weird with memoizer?

If anyone has any ideas about how to isolate this problem, please let me know. Again, the problem is that joints seem to "lose" the methods of their most specialized type, resulting in errors like "attempt to call method 'setFrequency' (a nil value)." This happens very rarely and, as far as I can tell, very unpredictably.
Blizzard47
Prole
Posts: 1
Joined: Sun Sep 11, 2016 10:33 am

Re: Lovely Physics Sandbox

Post by Blizzard47 »

Its just not working.......

The first screen with panels and stuff that's it.

I can't give any command.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Lovely Physics Sandbox

Post by airstruck »

Blizzard47 wrote:Its just not working.......

The first screen with panels and stuff that's it.

I can't give any command.
What version of Love are you using?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest