Computer Science Canada

Racing

Author:  CWRules [ Wed Apr 29, 2009 7:26 pm ]
Post subject:  Racing

This is the racing engine I plan to use in my next game. Any and all suggestions are welcome. Controls are in the game, I recommend 100 for all stats at first.

Thanks to drij, this is derived from his 'Car' program.

Author:  Homer_simpson [ Wed Apr 29, 2009 7:36 pm ]
Post subject:  Re: Racing

its nice
some sound would be nice
also there's just a little glitch if u collide with the wall at slow speeds you get stuck.
it looks good tho i'de like to see it finished

Author:  CWRules [ Thu Apr 30, 2009 4:36 pm ]
Post subject:  Re: Racing

I don't have much experience with sound yet, but I will add it later.

I couldn't find a way around the stuck-on-walls glitch, that's what the reset button is for.

Author:  darkangel [ Mon May 04, 2009 9:15 pm ]
Post subject:  Re: Racing

A very good game, I being a network guy would love to see a LAN multiplayer version of this. Laughing Thou I have to admit, I'm not sure what grade your in, but using whatdotcolor isn't the best way to be doing your collision, and that might actually be your problem for getting stuck in the walls. There must be some good tuts for this kind of collison. If not I'll post a copy.

Author:  yodu123 [ Sat May 09, 2009 10:13 pm ]
Post subject:  RE:Racing

hey i`m doing kind of same thing for a school product but i don`t even know where to start can you give me some tips? pls pls pls

Author:  Sniper4Life [ Sat May 09, 2009 10:46 pm ]
Post subject:  RE:Racing

yodu123...
plz...dont be a begger..-_-

like you can ask for some tips but seriously...dont start with the "PLZPLZPLZPLZPLZ"...it annoys people....

Author:  CWRules [ Sun May 10, 2009 7:03 pm ]
Post subject:  Re: Racing

Sorry for the delay, I didn't think I'd get any more posts.

To answer your qestions:

darkangel: I'm in grade 10, and I'll look into other forms of colliosion detection.

yodu123: http://compsci.ca/v3/viewtopic.php?t=19641&highlight=car+automobile
That's what I started from. Hope it helps.
And yeah, don't beg like that. It's creepy.

Author:  CWRules [ Sun May 10, 2009 7:09 pm ]
Post subject:  Re: Racing

Hmm. Not sure a different form of collision detection would help. My method is to mulitply velocity by -0.8 if you hit a wall or barrier. If you can suggest improvements, please do.

P.S. Technically you can't get stuck in a wall, the car just drives backwards and really slowly.

Author:  yodu123 [ Tue May 12, 2009 8:56 pm ]
Post subject:  RE:Racing

sorry guys for the begging i`ve major program due coming up and i`m just so worried

Author:  leafs23 [ Wed May 13, 2009 7:51 am ]
Post subject:  RE:Racing

make something easier!

Author:  yodu123 [ Tue May 19, 2009 1:37 pm ]
Post subject:  RE:Racing

how did u make the time to reset? i used time.elapsed but it is not that good

Author:  McKenzie [ Tue May 19, 2009 4:02 pm ]
Post subject:  Re: Racing

CWRules @ Sun May 10, 2009 7:09 pm wrote:
Hmm. Not sure a different form of collision detection would help. My method is to mulitply velocity by -0.8 if you hit a wall or barrier. If you can suggest improvements, please do.

P.S. Technically you can't get stuck in a wall, the car just drives backwards and really slowly.


OK, I didn't look at your code, or run it so my advice my be off-base, but this is a common problem. Your collision only detects a hit when the car is "in" the wall. If multiply the velocity by -0.8 the car might not have enough velocity to escape the wall. Before you multiply the velocity you need to extract the car from the wall. A simple way is to simply subtract the velocity from the position (to backtrack one frame.)

Author:  CWRules [ Wed May 20, 2009 2:58 pm ]
Post subject:  Re: Racing

Not a bad idea. I probably should have thought of that...

Anyway, to answer yodu's question: Are you using the system clock to judge time? I tried that at first, but when I ran the game on a slow computer the game slowed down but the time didn't. So now I just add to the time every frame. This makes the clock slow down with everything else.

I you insist on using the system clock, just create a variable called start_time or something like that and set it whenever you start a race. Subtract start_time from current time to find time passed.

Author:  saltpro15 [ Wed May 20, 2009 5:10 pm ]
Post subject:  RE:Racing

this is pretty awesome! is there any way I could see the source? I'm really interested in doing something like this

Author:  CWRules [ Thu May 21, 2009 9:13 pm ]
Post subject:  Re: Racing

saltpro: See 7th post in this thread. I'm not doing all the work for you.

Author:  leafs23 [ Fri May 22, 2009 7:20 am ]
Post subject:  RE:Racing

awesome game foo

Author:  saltpro15 [ Fri May 22, 2009 3:53 pm ]
Post subject:  RE:Racing

ah, my mistake. thanks


: