Page 2 of 3

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Wed Feb 03, 2016 10:16 pm
by kikito
scissors61 wrote:I have to create complex figures with box2d where some move, rotate or act together, like the paddles in pinball
Ok, but:
scissors61 wrote:math was never on my side, lol
You will need math if you want to do what you said on the first quote - either using box2d or a custom-made thing. Physics and math go hand to hand. I recommend you to take a second to reconsider the kind of game you want to make (maybe one with less math would be more suitable).

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Thu Feb 04, 2016 5:37 pm
by scissors61
I understand, sadly that might be the case, I'm kind of attached to the ideas so I'll try to see what can I do with my limitations, I could draw the objects with a visual tools, and then draw the polygons in google physics editor. The hard part would be finding the exact center of the different shapes to make them act with coordination between each other.

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Thu Feb 04, 2016 8:43 pm
by Davidobot
scissors61 wrote:The hard part would be finding the exact center of the different shapes to make them act with coordination between each other.
To find the centre one can just average out the coordinates of the shape's points.

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Fri Feb 05, 2016 2:39 am
by s-ol
scissors61 wrote: Btw, I couldn't play your game due to compatibility issues, I'm on linux with love 0.10.
ah, never crossed my mind to update the source. I'll do that soon... should be a few minor things.
Davidobot wrote:
scissors61 wrote:The hard part would be finding the exact center of the different shapes to make them act with coordination between each other.
To find the centre one can just average out the coordinates of the shape's points.
if he did the shapes with code yes, but hes talking about that physics editor thing.

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Fri Feb 05, 2016 5:43 am
by bobbyjones
The physics editor I linked does all that math already iirc.

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Fri Feb 05, 2016 7:04 pm
by bzSteve
You might get some good ideas from kbmonkey's awesome pinball project:

viewtopic.php?f=5&t=81018&hilit=pinball

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Sat Feb 06, 2016 12:03 am
by Connorses
I'm currently working on a physics object editor, because I had a hard time finding what I needed and I want something tailor-made for my own project. I know it's a serious time-sink but it's the only option that appeals to me at the moment. I'm actually looking into ways I can export and import the data, but it will probably be either JSON or a custom line-by-line format.

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Sat Feb 06, 2016 3:08 am
by scissors61
S0lll0s wrote: ah, never crossed my mind to update the source. I'll do that soon... should be a few minor things.
Looking forward!
bzSteve wrote:You might get some good ideas from kbmonkey's awesome pinball project:
thanks, I'll look the code, hope I can understand it.
Connorses wrote:I'm currently working on a physics object editor, because I had a hard time finding what I needed and I want something tailor-made for my own project. I know it's a serious time-sink but it's the only option that appeals to me at the moment. I'm actually looking into ways I can export and import the data, but it will probably be either JSON or a custom line-by-line format.
hey, really like to see it! I understand about the options, I got the same conclusion as you only that I don't have the skills for attempting to do it by myself. Right now the code exported by the physics editor that bobbyjones recommended creates really small shapes, like this: polygons":[[{"x":0.6572732925415039,"y":0.8567421436309814},{"x":0.5287498831748962,"y":0.8550001382827759},{"x":0.5837500095367432,"y":0.8174999356269836}
is giving me some trouble, but this is a problem of the editor, not of love2d.
two other free alternatives I just found but haven't use them yet
http://ts4.us/tools/box2deditor.html
and an alpha version of R.U.B.E.
http://www.iforce2d.net/rube-free/
in this version it seems that the author obfuscate the code

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Sat Feb 06, 2016 3:42 am
by bobbyjones
scissor61 that's weird. I'll try it out again and see if I can remember how to write the exporter.

Re: For making complex physics in löve, is creating a personalized engine the only option?

Posted: Sat Feb 06, 2016 7:28 am
by airstruck
JSON is so close to Lua syntax that writing a converter is really pretty trivial. I found this one I wrote a while back laying around, it should handle most JSON, although it doesn't handle \u unicode escape sequences.

Code: Select all

local function json2lua (json)
    return 'return ' .. (('"' .. json:gsub('\\"', '\fQ\f') .. '"')
        :gsub('%b""', function (m)
            return m:gsub('%[', '{'):gsub('%]', '}'):gsub('null', 'nil')
        end)
        :sub(2, -2):gsub('(%b"")%s*:%s*', '[%1] = '):gsub('\fQ\f', '\\"'))
end
You can use loadstring on the result and then do whatever you need to do with it. Of course there are also loads of JSON modules if you need something more powerful.