Jump to content


Photo
- - - - -

Top-down Car Physics. Drifting, Collisions & Ai.


  • Please log in to reply
130 replies to this topic

#21 Exylex

Exylex

    GMC Member

  • New Member
  • 216 posts

Posted 12 February 2010 - 12:49 PM

Okay, i've worked with a racing car game (side-project) and i wasn't sure, how you increase the max speed, but the acceleration is smaller.
Sometimes it just screwed up, the brakes didn't work while changing acceleration, and sometimes it accelerate so fast, that the skid's made a broken line, and it was strange when i burned, then the skid's made a tractor's wheel shape. Well, so that's not bad actually...

I suggest you add these to it
-Gears
-Available to buy some new mechanism, like motor or brakes, it would be very cool cause i am not sure how to modify those scripts.
(Actually i tried but i screwed, like i said earlier. :P)

Otherwise, still i think this is the one coolest example here :)


Seems like you are using the old scripts, try downloading the most recent ones. :)

About those suggestions. I think these features goes outside the borders of this example as this is not a racing game example.
  • 0

#22 Newly Discovered

Newly Discovered

    Harmonious Genius

  • New Member
  • 2467 posts
  • Version:GM8

Posted 13 February 2010 - 11:36 PM

I don't think gears would be out of the borders...maybe out of the box by a bit because it's hardly ever been done on the GMC.

This engine is alright. Not too realistic feeling but it does provide decent drifts. Now all it needs is better collision physics (slide into a wall and smash you back end, the car should spin around, not stay stiff and bounce off).
Adding gears would be pretty simple, basically max_speeds per gear...or get technical about it and throw in some RPMs and restrict the acceleration.
I think adding the simple version would suffice though.

I turned up the speed to 7 and enlarged the room for more drifting space. I continue to hold up and a direction and it drifts forever...a non-stop star shape. the car drifts, spins around, holds its speed, and keeps looping back with a slight offset. I've made some neat patterns out of it but it's obviously a bug.

Edited by Newly Discovered, 14 February 2010 - 12:00 AM.

  • 0

#23 Exylex

Exylex

    GMC Member

  • New Member
  • 216 posts

Posted 14 February 2010 - 12:56 AM

I don't think gears would be out of the borders...maybe out of the box by a bit because it's hardly ever been done on the GMC.
... ...
Adding gears would be pretty simple, basically max_speeds per gear...or get technical about it and throw in some RPMs and restrict the acceleration.
I think adding the simple version would suffice though.


Fine :P Next update i'll add a boolean that turns gears on/off in the init script.

This engine is alright. Not too realistic feeling but it does provide decent drifts. Now all it needs is better collision physics (slide into a wall and smash you back end, the car should spin around, not stay stiff and bounce off).

The car does rotate slightly upon collision in this example, or do i somehow misunderstand you?

I turned up the speed to 7 and enlarged the room for more drifting space. I continue to hold up and a direction and it drifts forever...a non-stop star shape. the car drifts, spins around, holds its speed, and keeps looping back with a slight offset. I've made some neat patterns out of it but it's obviously a bug.

Busted :lol: I clearly don't test my releases enough B-) By adjusting the speed variable negatively depending the difference between move and face angle while drifting should solve this problem.


Thanks alot by spending the time that i don't on testing this example. :)
Update incoming in near future, got other things to take care of atm though.
  • 0

#24 youknowwho

youknowwho

    GMC Member

  • New Member
  • 54 posts

Posted 08 March 2010 - 01:01 AM

I have a problem... I imported the files and everything into my game and got a trying to drive non-existant surface error. I imported everything.
-edit-
okay so I took out the effects and made a secound car for a 2 player game... the car won't work with these as the arguments for the script in the step event keyboard_check('W'), ect. It spins irradically. Please help this is a cool engine.

Edited by youknowwho, 08 March 2010 - 02:14 AM.

  • 0

#25 PhYs1aTr1sT

PhYs1aTr1sT

    GMC Member

  • New Member
  • 112 posts

Posted 09 March 2010 - 12:39 PM

downloading it..... hope its goin to be useful :)
  • 0

#26 Exylex

Exylex

    GMC Member

  • New Member
  • 216 posts

Posted 11 March 2010 - 09:28 PM

I have a problem... I imported the files and everything into my game and got a trying to drive non-existant surface error. I imported everything.
-edit-
okay so I took out the effects and made a secound car for a 2 player game... the car won't work with these as the arguments for the script in the step event keyboard_check('W'), ect. It spins irradically. Please help this is a cool engine.


I think your problem is that you call keyboard_check wrong.

ord(str) Returns the asci code of the first character in str.

keyboard_check(ord('W'))
keyboard_check(ord('A'))
keyboard_check(ord('S'))
keyboard_check(ord('D'))

Should do it.
  • 0

#27 Urbanturkin

Urbanturkin

    GMC Member

  • GMC Member
  • 203 posts

Posted 19 March 2010 - 07:58 PM

Wow...this is a very good engine! Might use it in my game. However when you drift and creates some skid marks they donīt dissapear. So how would you do to make them dissapear? The object_effect is quite too complicated for me so I donīt find a solution to this.

But anyways good example man! :)

Edited by Urbanturkin, 19 March 2010 - 07:59 PM.

  • 0

#28 DoctorKane

DoctorKane

    GMC Member

  • New Member
  • 1 posts

Posted 20 March 2010 - 06:01 AM


Hello and thank you for this amazing little game. I am having so much fun with it. Who doesnt like drifting. Awesome examples
and once again thanks!!!!!!!!!!!
  • 0

#29 babob

babob

    GMC Member

  • New Member
  • 1 posts

Posted 22 March 2010 - 05:17 PM

hohoho.. i like this engine!
make my dreem come true.. whaha hoho!

ewmm i'm new here. Just wanna ask, what do you mean give u credit? many people say like that if use stuff from them. can u give me an explanation please?? hehe :)
  • 0

#30 ntomic

ntomic

    GMC Member

  • New Member
  • 6 posts

Posted 23 March 2010 - 09:51 AM

Hi ,

Just found this engine and I really like it's simplicity.

I was wondering if anyone could help me with curved tracks? I've tried several curved images (for track boarders) using the same collision script but the car always gets stuck or eventually passes through them.

Thanks in advance

NTOMIC
  • 0

#31 Exylex

Exylex

    GMC Member

  • New Member
  • 216 posts

Posted 23 March 2010 - 11:58 AM

Wow...this is a very good engine! Might use it in my game. However when you drift and creates some skid marks they donīt dissapear. So how would you do to make them dissapear? The object_effect is quite too complicated for me so I donīt find a solution to this.

But anyways good example man! :)

Thanks

The marks is currently added on a surface and can't be smootly removed after a certain amount of time.
To achieve the effect you describe, you may replace the part where the skids are drawn with an instance creation code where you create skid mark objects with the attributes of the drawn skidmarks. These objects can fade out after a set amount of time.



Hello and thank you for this amazing little game. I am having so much fun with it. Who doesnt like drifting. Awesome examples
and once again thanks!!!!!!!!!!!

Fasten seatbelts :chikin

hohoho.. i like this engine!
make my dreem come true.. whaha hoho!

ewmm i'm new here. Just wanna ask, what do you mean give u credit? many people say like that if use stuff from them. can u give me an explanation please?? hehe :P



Hi ,

Just found this engine and I really like it's simplicity.

I was wondering if anyone could help me with curved tracks? I've tried several curved images (for track boarders) using the same collision script but the car always gets stuck or eventually passes through them.

Thanks in advance

NTOMIC

The collision script i wrote is intended for cubes only, you should check RamboFox's "2d(topdown) One Way Walls (polygonal Collisions)"

hope it helps :o

Edited by Exylex, 23 March 2010 - 11:59 AM.

  • 0

#32 ntomic

ntomic

    GMC Member

  • New Member
  • 6 posts

Posted 24 March 2010 - 10:12 AM

Thanks for the link to RamboFox's "2d(topdown) One Way Walls (polygonal Collisions)". It certainly does the rounded collisions I was looking for.
However the car and effects (smoke, drifting etc) are better here.

Has anyone already tried to merge the two before I spend the time on it?

Nathan ^_^
  • 0

#33 12warr12

12warr12

    GMC Member

  • GMC Member
  • 678 posts
  • Version:Unknown

Posted 29 April 2010 - 02:29 PM

very good, I like the drifting effects :)
  • 0

#34 Exylex

Exylex

    GMC Member

  • New Member
  • 216 posts

Posted 29 April 2010 - 04:59 PM

very good, I like the drifting effects :D


Thanks, nice to see that people still find this topic. :)

Got 1000 downloads overall on the versions yet i can't find any project using this, which is a pity. Was planning to update it.
  • 0

#35 12warr12

12warr12

    GMC Member

  • GMC Member
  • 678 posts
  • Version:Unknown

Posted 29 April 2010 - 05:35 PM

Update it, you don't see projects, maybe because ppl changed it alot.
  • 0

#36 Venomous

Venomous

    GMC Member

  • GMC Member
  • 1479 posts
  • Version:GM:Studio

Posted 29 April 2010 - 11:45 PM

very good, I like the drifting effects :P


Thanks, nice to see that people still find this topic. :P

Got 1000 downloads overall on the versions yet i can't find any project using this, which is a pity. Was planning to update it.

I used it. :P I just didn't release the game yet.

Edited by XtraButter, 29 April 2010 - 11:45 PM.

  • 0

#37 dhtikna

dhtikna

    GMC Member

  • GMC Member
  • 497 posts

Posted 29 April 2010 - 11:51 PM

WOW amazing job! Extremly simple :P thanks
  • 0

#38 Exylex

Exylex

    GMC Member

  • New Member
  • 216 posts

Posted 30 April 2010 - 09:48 AM

I will work on a update then, got a lot to do but i'm sure i'll find some time for it. Will do some proper testing to find out incorrect handling. Will add some other stuff but i will try to keep it as simple as possible.

Expected updates:
Better handling - I will test the current script with all kind of variables(handling vars), note down the bugs and then rewrite it without them.
Cleaned up script - variable names and script layout so it will be easier to understand the functionality of the script for easier customization.
Gears - I prefer only a boolean to turn it on. Then the car will shift automaticly between the 5 gears (+R). If the public want's a manual gearbox with a set amount of gears, then i would need to create an init script for the gears.
Collision - I will see if im able to add custom collision shapes without changing the 1 script concept for collisions.
Sounds - A proper sound efffect (pitch) will be added for the car in obj_effects.
AI cars - Add an AI car object as example.
If you use this in a project, please add my name in the topic, that way i can track it(search) and get better feedback for future updates.

Edited by Exylex, 01 May 2010 - 10:18 AM.

  • 0

#39 12warr12

12warr12

    GMC Member

  • GMC Member
  • 678 posts
  • Version:Unknown

Posted 30 April 2010 - 11:10 AM

You should add Multiplayer, add 2 cars, 1 with WASD controls and another with arrows :P should be fun :P
  • 0

#40 Exylex

Exylex

    GMC Member

  • New Member
  • 216 posts

Posted 30 April 2010 - 12:59 PM

You should add Multiplayer, add 2 cars, 1 with WASD controls and another with arrows :P should be fun :P


Already very easy to do, just duplicate the current player object but change the controls from keyboard_check(vk_left) to keyboard_check(ord('w')) and so on.
But it reminds me that i should program A.I cars since thats seems mmore demanded. :P
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users