Top Down City

Share with us how are you using the powerrrr of the force

Moderator: Alain

Top Down City

Postby JernejL » Fri Nov 11, 2005 7:41 pm

Top Down City is a grand theft auto "classics" clone, featuring some original arcade aspects of gameplay, but using newer technology.

The game is created using borland delphi 4 and opengl for graphics, it compiles under freepascal and code doesn't make use of much assembly so it is quite portable to other platforms.

The game ofcourse uses newton physics engine for dynamics, also this demo is not complete and lacks many things (such as a more proper car behavour).

A demo version can be downloaded here:
http://www.gtatools.com/temp/TDC%20DEMO.rar

controls for demo:
right shift - switch weapons
right ctrl - fire weapon
arrows - move
enter - find and enter a nearby car
/ * - camera zoom
- + - drop some cars from the air (if they freeze in air add some more so they touch and fall)
F1 - debug physics geometry
F2 - debug display
F3 - processing speed histogram

have fun with it and try not to break it ;)

known issuses:
- if you get no picture or crash be sure to post here a screenshoot of the error, some known errors were fixed in this demo
- it will not work properly without hardware acceleration using windows GDI, this is windows bug, a workaround can be made but i won't attempt to fix this since it doesn't run at acceptable speed without at least Riva TNT2 gfx card

notes:
- TDC runs fine under linux using WINE - tested (but not by me)

Enjoy the demo, and please let me know if you would like to help me with the project.

here are some images:

Image
Image
Image
Image
Image

map editor:
Image

let me repeat: i desperately need help on this project (especially car behavour)
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Postby JernejL » Tue Nov 15, 2005 10:13 am

hmm, i'm kinda worried about getting no replies on my newton project :/
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Postby walaber » Tue Nov 15, 2005 6:40 pm

well you mentioned the vehicle physics, and that's definately the biggest problem. you need way more friction when the car is sliding sideways, right now it's like driving a bumper-car on ice.

otherwise I think the game is coming along nicely, the controls (for pedestrians) are fine, and the graphics look nice.
Independent game developer of (mostly) physics-based games. Creator of "JellyCar" and lead designer of "Where's My Water?"
User avatar
walaber
Moderator
Moderator
 
Posts: 393
Joined: Wed Mar 17, 2004 3:40 am
Location: California, USA

Postby JernejL » Wed Nov 16, 2005 8:47 am

walaber wrote:well you mentioned the vehicle physics, and that's definately the biggest problem. you need way more friction when the car is sliding sideways, right now it's like driving a bumper-car on ice.


this is the biggest problem, my cars are just cubes, they aren't even raycast cars or car joints, and simulating boxes with a car handling behavour is very hard :(.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Postby SnadderLars » Wed Nov 16, 2005 4:12 pm

If you want much tighter vehicle control for your box you can try something like this:

Get the body velocity at the four corners of the box where the wheels should be attached, this gives you four velocity vectors in world space. (wheel_fl_velocity_ws, wheel_fr_velocity_ws, wheel_rl_velocity_ws, wheel_rr_velocity_ws)

Transform the velocity vectors into local space (transform by the inverse body matrix) so you have four velocity vectors in local space (wheel_fl_velocity_ls, wheel_fr_velocity_ls, wheel_rl_velocity_ls, wheel_rr_velocity_ls)

Use the velocities to calculate forces and push the box with these forces at the point where the wheel should be attached.

Tweak some 'magic' constants when calculating the forces to get a good feel.

There are more details but I'm sure you can figure that out if you move forward with something like this.
SnadderLars
 
Posts: 5
Joined: Tue Nov 01, 2005 2:53 pm
Location: Huntington Beach, CA

Postby JernejL » Wed Nov 16, 2005 5:17 pm

SnadderLars wrote:If you want much tighter vehicle control for your box you can try something like this:

Get the body velocity at the four corners of the box where the wheels should be attached, this gives you four velocity vectors in world space. (wheel_fl_velocity_ws, wheel_fr_velocity_ws, wheel_rl_velocity_ws, wheel_rr_velocity_ws)

Transform the velocity vectors into local space (transform by the inverse body matrix) so you have four velocity vectors in local space (wheel_fl_velocity_ls, wheel_fr_velocity_ls, wheel_rl_velocity_ls, wheel_rr_velocity_ls)

Use the velocities to calculate forces and push the box with these forces at the point where the wheel should be attached.

Tweak some 'magic' constants when calculating the forces to get a good feel.

There are more details but I'm sure you can figure that out if you move forward with something like this.


This makes sense, the only thing i don't know is how to calculate body velocity at wheel attachment points?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Postby SnadderLars » Wed Nov 16, 2005 5:37 pm

Search for "velocity of point on rigid body" or something similar and you'll find some information on this. One link is:

http://em-ntserver.unl.edu/NEGAHBAN/EM3 ... 5/note.htm

In a nutshell the velocity of a point (particle) on a rigid body is the linear velocity plus angular velocity crossed with the vector from the rigid body center of gravity to the point on the body.

All in world-space:
Code: Select all
V = V.linear + V.angular cross (P.particle - P.origin)



Someone please correct me if I'm wrong... I may have a bug of my own then :D
SnadderLars
 
Posts: 5
Joined: Tue Nov 01, 2005 2:53 pm
Location: Huntington Beach, CA

Postby JernejL » Thu Nov 17, 2005 12:26 pm

SnadderLars wrote:In a nutshell the velocity of a point (particle) on a rigid body is the linear velocity plus angular velocity crossed with the vector from the rigid body center of gravity to the point on the body.

All in world-space:
Code: Select all
V = V.linear + V.angular cross (P.particle - P.origin)




so:
V is velocity that we want
V.linear is velocity from NewtonBodyGetForce
v.angular is omega from NewtonBodyGetOmega (isn't this ok or i need to do something else with the rotation?)
what i don't understand now is P.particle and P. origin, p.origin should be the location of the point from which i want to get velocity (but is this in local or body space?) so what is p.particle then?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Postby walaber » Thu Nov 17, 2005 1:00 pm

p.particle - should be the global position of the point on the body for which you want the velocity.
p.origin - should be the global position of the body on which the particle lies.

in other words, p.particle - p.origin is the vector from the origin of the body to the point on the body, in global space.

let me know if I'm wrong about this.
Independent game developer of (mostly) physics-based games. Creator of "JellyCar" and lead designer of "Where's My Water?"
User avatar
walaber
Moderator
Moderator
 
Posts: 393
Joined: Wed Mar 17, 2004 3:40 am
Location: California, USA

Postby SnadderLars » Thu Nov 17, 2005 1:10 pm

That is correct.

Code: Select all
V = V.linear + V.angular cross (P.particle - P.origin)


V - world-space velocity of particle in world-space
V.linear - world-space velocity of body center-of-gravity from NewtonBodyGetVelocity()
V.angular - world-space angular velocity of body center-of-gravity from NewtonBodyGetOmega()
P.particle - world-space position of particle on body you want velocity for
P.origin - world-space position of body center-of-gravity from NewtonBodyGetMatrix()

If you have a local-space particle position just transform it into world-space first. (transform by the body matrix from NewtonBodyGetMatrix).
SnadderLars
 
Posts: 5
Joined: Tue Nov 01, 2005 2:53 pm
Location: Huntington Beach, CA

Postby JernejL » Thu Nov 17, 2005 5:16 pm

SnadderLars wrote:That is correct.

Code: Select all
V = V.linear + V.angular cross (P.particle - P.origin)


V - world-space velocity of particle in world-space
V.linear - world-space velocity of body center-of-gravity from NewtonBodyGetVelocity()
V.angular - world-space angular velocity of body center-of-gravity from NewtonBodyGetOmega()
P.particle - world-space position of particle on body you want velocity for
P.origin - world-space position of body center-of-gravity from NewtonBodyGetMatrix()

If you have a local-space particle position just transform it into world-space first. (transform by the body matrix from NewtonBodyGetMatrix).


i'm not sure i understood this right, but don't those newtonbodyget.. functions return velocity and omega in object space and not world space?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Postby SnadderLars » Thu Nov 17, 2005 10:05 pm

As far as I know both NewtonBodyGetVelocity() and NewtonBodyGetOmega() return world-space values.
SnadderLars
 
Posts: 5
Joined: Tue Nov 01, 2005 2:53 pm
Location: Huntington Beach, CA

Postby CyKo74 » Mon Nov 21, 2005 2:47 pm

Why dont you make it with joints, constraints and other ts? Full car-sim would be nice and cheap (on cpu).
User avatar
CyKo74
 
Posts: 7
Joined: Fri Nov 18, 2005 7:21 pm
Location: Russia

Postby JernejL » Tue Nov 22, 2005 8:20 am

CyKo74 wrote:Why dont you make it with joints, constraints and other ts? Full car-sim would be nice and cheap (on cpu).


because i don't have any idea how car physics and newton joints and constraints work and all papers on the internet are english that i don't really understand, you seem to know more about this than me, do you want to work on car physics for the game?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Postby CyKo74 » Tue Nov 22, 2005 10:14 pm

Well, i've just began learning newton. You can see "mein kamf" diary at genereal discussion->yer another tree collision question. But i had some theoretical mechanics and material resistance courses at the university (seems ages ago). I'd love to try and learn newton on that. If thats ok with you :) .
User avatar
CyKo74
 
Posts: 7
Joined: Fri Nov 18, 2005 7:21 pm
Location: Russia

Next

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 7 guests

cron