Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: Frog on June 29, 2012, 03:23:42 pm

Title: Physics engine 3.2
Post by: Frog on June 29, 2012, 03:23:42 pm
Hi everyone,

It's been some time since I last checked Omnimaga (although I've never been an active member), but now that I'm finished with my exams I finally have the time to program a calculator game again. And now I noticed that OS 3.2 has been released! I really want to try the Physics engine, because I'm thinking of making a game utilizing it, but I don't really know how to start.

I saw the video of the physics engine, but couldn't find the source code for it. Also, TI's documentation is pretty sparse. I assumed you didn't need to initialize the engine like you normally should, and I've been able to add a space, a body, and a shape. But how do I draw this? I guess you should somehow loop over all shapes and draw them in the positions the engine tells you to, but how do I do this? Or is there a better way? I can't find it in the reference...

On a side note: is using this physics engine overkill for a simple platforming game?
Title: Re: Physics engine 3.2
Post by: Jim Bauwens on June 29, 2012, 03:38:48 pm
Yes, I know it is complex. Luckily I have managed to master it a bit, and will write a tutorial as soon as I get the time.
I'll see to post here some examples soon :)
Title: Re: Physics engine 3.2
Post by: Lionel Debroux on June 29, 2012, 03:40:00 pm
Quote
On a side note: is using this physics engine overkill for a simple platforming game?
If the game is simple enough, I'd say "yes" :)
Title: Re: Physics engine 3.2
Post by: Frog on June 29, 2012, 03:58:00 pm
@jimbauwens: Indeed, it's way more complex than I expected! Even just some working source code would help me out a lot, I think I can figure out from that how it works. And maybe I could then also help you with a tutorial? :)

@Lionel: Mmm, maybe I should then just use plain-old Lua then... On the other hand, isn't it true that all the calculations made by the physics engine are faster than anything you can do in Lua, since it's backed by native code?
Title: Re: Physics engine 3.2
Post by: Jim Bauwens on June 30, 2012, 03:24:14 pm
Frog, I send you some code in a pm :)
Title: Re: Physics engine 3.2
Post by: ExtendeD on July 01, 2012, 02:34:46 am
Why not pastebin it and share it with all of us?
Title: Re: Physics engine 3.2
Post by: DJ Omnimaga on July 01, 2012, 04:20:41 am
Quote
On a side note: is using this physics engine overkill for a simple platforming game?
If the game is simple enough, I'd say "yes" :)
Would Metroid be feasible?


Title: Re: Physics engine 3.2
Post by: Jim Bauwens on July 01, 2012, 04:24:57 am
Because it needs to be cleaned up, and some parts of code I spend a lot of time on and I don't want to release it publicly yet. But don't worry, I'll post some nice code very soon :)
Title: Re: Physics engine 3.2
Post by: Frog on July 01, 2012, 06:25:58 am
Jim, thanks for the code! Although I haven't had the time to go through it yet, a quick glance gave me a better idea as to how you should draw the items. I expected a function in Chipmunk to loop through everything, but I guess you should just create separate objects for everything, like you've done...

It really helps a lot! :)