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

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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

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

Post 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).
When I write def I mean function.
User avatar
scissors61
Citizen
Posts: 76
Joined: Fri Jan 08, 2016 10:16 am

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

Post 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.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

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

Post 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.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

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

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

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

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

Post by bobbyjones »

The physics editor I linked does all that math already iirc.
User avatar
bzSteve
Prole
Posts: 34
Joined: Tue May 21, 2013 2:31 am

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

Post by bzSteve »

You might get some good ideas from kbmonkey's awesome pinball project:

viewtopic.php?f=5&t=81018&hilit=pinball
Connorses
Citizen
Posts: 63
Joined: Fri Sep 06, 2013 7:02 am

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

Post 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.
User avatar
scissors61
Citizen
Posts: 76
Joined: Fri Jan 08, 2016 10:16 am

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

Post 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
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

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

Post by bobbyjones »

scissor61 that's weird. I'll try it out again and see if I can remember how to write the exporter.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

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

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 199 guests