• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] A little physique engine

Status
Not open for further replies.
Level 6
Joined
Jun 4, 2009
Messages
91
Here is a little physique engine for WC3 wrote in vjass.

It include a little escape demo wich you play with arrow keys

It does a computation of dynamics with some parameters you can specify like
-gravity
-air density (used in air friction, but I didn't really tested it)
-refresh period


this works by a structure that you can extends as shown in the "How To Use" trigger and the escape demo

While updating it does call two stub functions.
-in the first, you may return the sum of your forces
(weight and ground reflection will be computed by the engine then, so don't compute them yourself)
you can also add misc stuff

-the second is called once the destination is computed, but the units isn't yet moved, so you can perform collision detection (not yet provided in, sorry)
move the camera, and so on



Hope it'll help you making good maps. Please report me bugs and/or code correction if you do. Also report me if I did a mistake in the code.
 
Last edited:
Level 6
Joined
Oct 4, 2008
Messages
263
firstly post stuff like this in the JASS resources submission forum.

secondly, some feedback:
i like the system. however, there is a bug. if you stand between two small 'tops', you will be caught there and unable to move.
 
Level 6
Joined
Jun 4, 2009
Messages
91
yes, because of gravity. And there aren't as small as they looks if you change your camera, you'll see how hudge they're. To solve, you can change the bound factor to 1.0

or you can unpause the unit when his speeds get slow (but you shall check it isn't jumping)
but then the question is when to pause it again ?

But maybe smoothing curves will be an efficient solution
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
  1. Do not overuse color commands, maybe use a subtle color for the title, but don't use color codes for the rest, it hurts my eyes.
  2. This doesn't belong in this section, post in in the spells-section as a system.
  3. Create a function that if the unit is stuck, you can use the jump-spell again, otherwise it's pretty useless since I got stuck all the time.
 
Status
Not open for further replies.
Top