Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Racing Games with more than one car?

Author
Message
game Spacer
20
Years of Service
User Offline
Joined: 24th Jul 2004
Location:
Posted: 10th Dec 2004 00:18
Racing Games with more than one car ,computer controlled opponents.

Can someone please give me an idea how this can be done?

The examples I have seen around seem only to have a one player
controlable car so it is not a racing game just a driving game.

It would seem this is a difficult thing to do because none of the game software producers give sample code for it.

Sorry if this is a stupid question but I'm not a very good coder.
IanG
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: Cyberspace
Posted: 10th Dec 2004 00:25
well you could always use waypoints placed along the track (or whatever) then have them going towards the waypoint, you could make it so they go with in 10% of the way point so that they won't form a perfect line

Used to be Phoenix_insane registered in september 2003 despite what the date says to the left <--
PC - amd athlon 2.0ghz, 512mb, GeForce FX 5200 128mb, 200gb, xp pro sp2
DarkBasic Pro Guy
20
Years of Service
User Offline
Joined: 4th Jun 2004
Location: Broomfield, Colorado
Posted: 10th Dec 2004 00:28
you could use multiplayer commands except I have no knowledge of them so don't ask me about em

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Dec 2004 00:29
Waypoints are the way to go

But, if you can also add in a check to see if there's a car in front, then it'd be much more natural. Like if there's a car in front, brake depending on the distance between cars, otherwise accelerate. A system like that would mean the lead car pulls away and the cars behind form a queue behind it - adding some randomness to the waypoint system is a good way to make it look less mechanical - for example adding a little error to the waypoint destination thing, so each car goes to a random point around each waypoint instead of heading straight for it.


Van-B


It's c**p being the only coder in the village.
game Spacer
20
Years of Service
User Offline
Joined: 24th Jul 2004
Location:
Posted: 10th Dec 2004 00:42
I like the idea of waypoints but this seems a little advanced, no wonder I never see any examples around
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 10th Dec 2004 01:17
lazy git :p

basically waypoints are either dummy object placed around a map or 3d co-ordinates you that plot prior to running a game, you may have these positions stored in an array for easy access, to strt off you would place the ai at waypoint 1, and point him towards waypoint 2, then you do a distance check from waypoint 2 to the ai car, if its less than a specified value then you will make the ai poaint at waypoint 3,

i dont personally think its very hard to do just can be time consuming plotting all the points


Tifu
20
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Scotland
Posted: 10th Dec 2004 01:20 Edited at: 10th Dec 2004 01:21
*edit*

Guy above, better explanation than I had

game Spacer
20
Years of Service
User Offline
Joined: 24th Jul 2004
Location:
Posted: 10th Dec 2004 01:25
Quote: "lazy git :p
"

Not really I'm more of a modeler than coder.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Dec 2004 01:29 Edited at: 10th Dec 2004 01:31
Waypoints can be quite simple, like a string of pearls aroung your track, and each car has a destination waypoint - so you'd aim towards it. Then when you reach that waypoint, the car would aim towards the next one until it found the end of the loop and it could go back to wapoint 0. Something like that to start with is a good idea, then you can build on the car AI and expand on the waypoints, maybe to hold the desired car speed too, like on a straight you might have a waypoint at the start, then one before the first corner that would tell the car to slow down. If a car looses track of it's waypoint, you can just aim towards the closest one - also the distance to the next waypoint can be used to ascertain which position the car is in (like going by the waypoint, number of laps completed, then the distance to the next waypoint).

I might be able to knock up an example, not sure when though - working on an advanced terrain road example right now, so it could be bolted onto that afterwards (I already have a waypoint system that's quite straightforward and would be ok for racing games).


Van-B


It's c**p being the only coder in the village.
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Dec 2004 01:33
My Nuclear Glory example (which works with the free version too) uses waypoints. It's basically a ball bouncing between 4 waypoints, and uses exactly the same theory as you would for vehicle waypoints...

http://www.thegamecreators.com/?m=codebase_view&i=6d99af4a5acc16df108236b718052d76

BatVink
game Spacer
20
Years of Service
User Offline
Joined: 24th Jul 2004
Location:
Posted: 10th Dec 2004 01:46
Thanks I'm taking a look at it now .

Login to post a reply

Server time is: 2025-05-28 06:05:44
Your offset time is: 2025-05-28 06:05:44