Author Topic: Physics engine 3.2  (Read 4264 times)

0 Members and 1 Guest are viewing this topic.

Offline Frog

  • LV2 Member (Next: 40)
  • **
  • Posts: 35
  • Rating: +0/-0
    • View Profile
Physics engine 3.2
« 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?

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Physics engine 3.2
« Reply #1 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 :)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Physics engine 3.2
« Reply #2 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" :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Frog

  • LV2 Member (Next: 40)
  • **
  • Posts: 35
  • Rating: +0/-0
    • View Profile
Re: Physics engine 3.2
« Reply #3 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?
« Last Edit: June 29, 2012, 05:52:55 pm by Frog »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Physics engine 3.2
« Reply #4 on: June 30, 2012, 03:24:14 pm »
Frog, I send you some code in a pm :)

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Physics engine 3.2
« Reply #5 on: July 01, 2012, 02:34:46 am »
Why not pastebin it and share it with all of us?
Ndless.me with the finest TI-Nspire programs

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Physics engine 3.2
« Reply #6 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?



Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Physics engine 3.2
« Reply #7 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 :)

Offline Frog

  • LV2 Member (Next: 40)
  • **
  • Posts: 35
  • Rating: +0/-0
    • View Profile
Re: Physics engine 3.2
« Reply #8 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! :)