HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Board game WC3 version

09-01-2006, 12:28 AM#1
martix
Maybe some of you know that board game - a wooden box and a maze with holes. The goal is to guide a ball from one end to the other, avoiding any holes. This is done by tiltilng the maze along the 2 axes and letting gravity do the rest.
I wanna remake this in Wc3. I just can't figure it out exactly.
I want to make it be able to bounce once it hits a wall(this is a big headache). Also would tilting the camera create a plausible illusion of tilting whole maze and how should the default position of the camera and is there another way of doing it anyway?

And yeah, this is the right section, its mostly about scripting the whole thing. Give me ideas how to do it and avoid JASS! (As far as I know this is not an all-JASS zone).
09-01-2006, 12:41 AM#2
Naakaloh
Have some method of modifying the angular offset from 0 for both directions; I would suggest using just storing some values in a few global variables. Calculate the ball's acceleration depending on the incline which you can calculate with the angular offset. Modify the ball's velocity and move it periodically. (Not sure how much you know about linear motion, but this can actually be done rather simply algebraic/trigonometrically.)

Tilting the camera should be fine. Imagine if you had the board on a table and were tilting your body; you'd get the same effect as tilting the board.

Bouncing would depend on the kinetic energy of the ball and the efficiency of the energy transfer between the ball and the wall as well as the angle of the wall.

None of this technically would require JASS since the primary benefit of doing it in JASS would be the local variables. You can easily just use global variables in this case assuming you only need one ball.

Edit: Of course, if you are going to do this, I would make a suggestion that you DO use JASS since this is a perfect opportunity to practice if you're not very skilled with it.
09-01-2006, 12:50 AM#3
martix
Leave the physics system to me, that part I have figured out so far. Yeah, this map is mainly about trigonometry, I got the idea when I wrote my maths tutorial over at thehelper.net(should I post it here as well?) and then unburied this game from somewhere in my house.

What I want to know is how to detect collisions and what the default camera positions should be. And actually I do NOT know JASS. :)
09-01-2006, 01:15 AM#4
iNfraNe
To detect collisions would be easiest to do with GetLocationZ. But you do need JASS for that, so if you're unwilling that might be hard.

You could also do it with cliff level, but I dunno when on the cliff it actually sees it as an uppercliff. Or you could do pathing checks.

Either way you check 4 places around the collision where it hit from (or 2 if you also calculate in the speed in a direction) and then change either x or y speed accordingly.

This is all very very much easier with jass tho.
09-01-2006, 01:38 AM#5
TheEpigoni
The camera movement will require soadswme slightly complex trig. But all you really need to do is image the camera as a vector that is in a location and points at a direction. Now simply keep the camera pointing at the same direction but moving it on a spherical surface to represent it "rotating around the game world" thereby making it look as if the world itself is rotating.

You can probably fudge it though and instead of a sphere just move it only on a plane which will give you a similar effect it just won't be perfect.

Just a note, I think the camera already has a way to set a "target" at which it looks like, so if you keep the camera target the same and only change it's source location you will get the desired effect, I could be wrong though. Havn't worked with cameras in a bit.
09-01-2006, 01:45 AM#6
PipeDream
There are two methods for simulating rigid bodies: Collisions and constraints. Anitarf and Infrane have successfully demonstrated the collision method in Dwarven Downhill and it is necessary for the wall collisions anyway. So that's a proven way to go. However, constraints may be particularly easy here for the rolling because
- your terrain is probably flat
- you probably do not need to consider slipping at all
- your walls are probably flat
This means your ball has only two degrees of freedom for momentum and two for position along with the two for table tilting. That's very manageable. It's sufficiently simple that you can solve it exactly and let drawing smoothness instead of numerical stability control your time steps. That would be impossible with (floor) collisions. It also lets you deal with your wall collisions much more easily because you know exactly when the next collision will occur.

Checking for where the walls are will probably be the hardest part. I believe the most practical method is to split your map up into regions of small fixed size, then use the ball coordinates, scaled appropriately, to directly look up into an array for the wall parameters. This is better than cliffs because it does not require sampling.
09-01-2006, 09:33 PM#7
martix
What do you mean by sampling?
I assume "GetLocationZ" does what its name says, so actually what you did was raise a cliff above normal level and detect when your destination is a wall, right?
Now I see how limited GUI is in reference to JASS and JASS in reference to a real proggraming language. Can you give me some maps that have some sort of physics system in them?

Btw, now I know I'm gonna learn JASS as soon as I can, GUI is becoming very limited in a lot of terms.