Page 1 of 2 1 2 >
Topic Options
#124629 - 01/16/09 10:26 PM Custom marble movement debugging
JimJam


Registered: 06/30/06
Posts: 49
I'm trying to build a simple ball physics engine for use in my next game. I like what I've got so far, but something just doesn't feel right about it. I don't know if its my approach that's wrong or my application.

What I'm working to achieve is a simple table-top physics system. Right now I'm trying to replicate marbles or billiards physics. Something dealing with applying forces, pushes, or pulls to an object and having react accordingly.

The first 3 frames are just my math test frames. They were a learning experience, and I've left them so you can see my logic.

The next frame is a maze with wind fields and blockers. The wind doesn't seem to work right, as it will keep reapplying force. I could use some help here.

The last frame is the same as above, but where the ball just loops around the frame with no obstacles. Also a "marble shoot" test.

I can see whats wrong with the programming, but I don't know what to do to fix it. The problem is, that if you push an object with a force of 2 west, and then another force of 2 west, it doesn't equal a force of 4 west because the object is already moving at 2 west. Therefore another push at a force of 2 west wouldn't even push it at all, because both objects would be moving the same speed. I'm not sure if I need to subtract the difference or what here.

I could use some pointers.
I've used the function egg-timer extension.
Feel free to use my app for your own learning purposes.


Attachments
Vector Force 3.mfa (46 downloads)


Top
#124643 - 01/17/09 01:33 AM Re: Custom marble movement debugging [Re: JimJam]
Johnny


Registered: 06/21/07
Posts: 87
Nice !

Top
#124661 - 01/17/09 03:59 AM Re: Custom marble movement debugging [Re: Johnny]
JimJam


Registered: 06/30/06
Posts: 49
Thank you. My goal was to emulate clickteam's vector movement. Clickteam's vector movement is really nice, but I felt like I didn't have full control over all the features I needed, and I didn't fully understand its mechanics and values.

While mine isn't as powerful or simple to implement, it gives me the sense of control I want in knowing exactly what is going on.

Top
#124745 - 01/17/09 12:21 PM Re: Custom marble movement debugging [Re: JimJam]
_LB


Registered: 06/07/07
Posts: 887
Loc: Richardson, Texas, America.
I think the forces should add on, look up some physics about how NET force works and such, when an object collides with another it has to be moving faster than the one it collides with, so basic way of doing it is to swap the forces, the fast one gets the slow one's speed, and slow one get's the fast one's speed.
_________________________
Check the awsome games at http://ragdollsoft.com/
~Multimedia Fusion 2 Standard User~
My Site - LB-Stuff
-LB

Top
#124814 - 01/17/09 04:34 PM Re: Custom marble movement debugging [Re: _LB]
JimJam


Registered: 06/30/06
Posts: 49
From what I have learned, the net force IS the total vector sum of all acting forces...

A quick google search agrees (assuming these pages are correct):
http://id.mind.net/~zona/mstm/physics/mechanics/forces/netForce/netForce.htm
http://www.glenbrook.k12.il.us/GBSSCI/PHYS/CLASS/newtlaws/u2l2d.html
http://en.wikipedia.org/wiki/Resultant_force

See, they tell me I'm doing the addition just fine. But I think there is a problem with how my wind force works. See, the vector addition works fine when applied once in a forceful shove. That is, 8 + 2 = net force 10.

In reality, when you apply a constant force of 5 to an object (as an example, pushing a car), it would move at 5 (assuming mass is irrelevant).

But in my MMF2 game logic, the inputting force acts once per game frame. That is, each frame the force of 5 would be adding on each frame... making frame 2 10, frame 3 15. And at 60 FPS, after one second the object would be accelerating at 300. Which is not correct.

I think my game logic is fine for single input forces, such as collision, but constant forces like wind will cause a massive acceleration by adding each frame...

There must be some way I can limit them... maybe by using the eggtimer.

Top
#124822 - 01/17/09 05:14 PM Re: Custom marble movement debugging [Re: JimJam]
Looki


Registered: 08/27/06
Posts: 975
Loc: Duisburg, Germany
Frames 2, 4 and 5 crash for me :S

Top
#124825 - 01/17/09 05:46 PM Re: Custom marble movement debugging [Re: Looki]
JimJam


Registered: 06/30/06
Posts: 49
Do they crash on start up, or just in the middle of play? I can't imagine what would cause the crash...

Top
#124827 - 01/17/09 05:50 PM Re: Custom marble movement debugging [Re: JimJam]
Looki


Registered: 08/27/06
Posts: 975
Loc: Duisburg, Germany
On start-up. Me neither. Frame 2 is pretty simple...

Top
#124828 - 01/17/09 05:56 PM Re: Custom marble movement debugging [Re: Looki]
JimJam


Registered: 06/30/06
Posts: 49
Huh, I'll keep that in mind... Though I don't really know what to do about it.

Top
#124879 - 01/17/09 08:28 PM Re: Custom marble movement debugging [Re: JimJam]
_LB


Registered: 06/07/07
Posts: 887
Loc: Richardson, Texas, America.
Originally Posted By: JimJam
There must be some way I can limit them... maybe by using the eggtimer.


Uhh, no. Eggtimer is for making timer events, just test if it is already at the speed, or use Nifflas' object and uset the min/max expression.
_________________________
Check the awsome games at http://ragdollsoft.com/
~Multimedia Fusion 2 Standard User~
My Site - LB-Stuff
-LB

Top
Page 1 of 2 1 2 >


Site Links
Forum Index

Home Page
Online Store
Tutorials
Download Center
French Forum
Quick File Links
Multimedia Fusion 2
Updates - build 248
Standard Version
Developer Version

Extension Packs
Bonus Pack 1
Bonus Pack 2
z33z Extension Pack
LIJI Extension Pack

The Games Factory 2
Latest Update - build 248
Community Links
Madword Arcade

GameBuilder
Fusion2Developers
The Daily Click

Extensions
Neatwares Extension List
Extension Updater (FusionUpdater)
Zoom Gamer
Click Chat
6 People are chatting