help with cars

Blitz3D Forums/Blitz3D Beginners Area/help with cars

patisawesome(Posted 2003) [#1]
can someone please get me some code for some race cars?
-me


GfK(Posted 2003) [#2]
You may need to be a tad more specific....


patisawesome(Posted 2003) [#3]
i'm trying to create a racing game, and i can't figure out how to do the other cars
-me


patisawesome(Posted 2003) [#4]
is anybody there?
-me


patisawesome(Posted 2003) [#5]
how long does it take for you people to anwser?
-me


patisawesome(Posted 2003) [#6]
i'm waiting


Nebula(Posted 2003) [#7]
You mean the ai?

The simple way to make it quick is to drive a lap yourself and record it. Then play it back and you have a car that drives a lap on its own.

Another way, more complicated is to use some sort of pathfinding sytem.


patisawesome(Posted 2003) [#8]
i don't know how to record my lap
-me
ps can you type faster?


patisawesome(Posted 2003) [#9]
you peoples take a long time to anwser
-me


GfK(Posted 2003) [#10]
You realise this is a forum, not a chatroom, right??


patisawesome(Posted 2003) [#11]
yeah


GfK(Posted 2003) [#12]
So you understand that "on the odd occasion", it may take people longer than 30 seconds to reply to questions on here?


patisawesome(Posted 2003) [#13]
just tell me how to record please
-me


eBusiness(Posted 2003) [#14]
make an array with x and y location and rotation of the car, store the data fx 32 times a sec. Export the values of your array to a file.


eBusiness(Posted 2003) [#15]
If you ask me how to make an AI, define some points on track that the opponent cars should race towards, define where to break down to what speeds, where to give gas. Eventually make some rnd variations.


Nebula(Posted 2003) [#16]
Store the x,y locations in a array every so many milliseconds while you record. Also store the rotation for the car every time.

Be sure to increase the counter of the array every time you record the position. The counter being used to see where to put the recording.

Here is some crude example code

; this array will store 9999 positions. Or 499 seconds
; if you record every 20 milliseconds.
dim cai(9999,3)

;This we use to time the recording
global tm = millisecs()

>Code for in your game loop

;Record every 20 milliseconds
if tm + 20 < millisecs() then
cai(counter,0) = carx
cai(counter,1) = cary
cai(counter,2) = carrot
counter = counter + 1
tm = millisecs()
end if

>back to your start of the loop

You could also use types for storing the position. This is just a simple example.

And stop eating so much sugar :)

ps - Be sure to store the array. Write it to a file. Look up the file functions.


patisawesome(Posted 2003) [#17]
ok, i'll try that


patisawesome(Posted 2003) [#18]
this isn't working.
-me


Nebula(Posted 2003) [#19]
Here is a working example on how to record your mouse pointer. It should get you started.

;
; Recording example
;

Graphics 640,480,16,2
SetBuffer BackBuffer()

Dim cai(999,3)
Global tm = MilliSecs()
Global recordlen = 0 ; This variable will store the total length of the recording
Global playback = False
Const recordrate = 20

While KeyDown(1) = False
	Cls
	Text 0,0,"Move the mouse around and then press the left mouse to play back"
	Text 0,20,"Position " + counter
	
	If playback=False And counter < 1000 Then
		If tm+recordrate < MilliSecs() Then
			cai(counter,0) = MouseX()
			cai(counter,1) = MouseY()
			counter = counter + 1			
			tm = MilliSecs()
		End If
	End If
	;
	If MouseHit(1) = True Then playback = True : recordlen = counter : counter = 0
	;
	If playback = True Then
		If tm+recordrate < MilliSecs() Then
			Rect cai(counter,0),cai(counter,1),10,10,1
			counter = counter + 1
			If counter > recordlen Then counter = 0
		End If
	End If
	Flip
Wend



patisawesome(Posted 2003) [#20]
it isn't working still
bye for today
-me


Ruz(Posted 2003) [#21]
what have you been smoking patisawesome
seems you are a bit of a cheeky so and so.
try and ask people in a friendly manner ,Instead of demanding anwers.
i am actually surprised anybody answered you
"ps can you type faster" ha ha thats just hilarious


Ross C(Posted 2003) [#22]
can someone give me the codes to make a game plz? hello?


bazziman(Posted 2003) [#23]
can someone give me the codes to make a game plz? hello?


;)

You're so spot on with that one. ;) I participate in a lot of dance forums too (samplers, synths etc) and we get geezers like that all the time: Hi I'm a producer of TRANCE; "what chords for trance, what synths for trance, where can I get samples (loops) for trance...."


Ruz(Posted 2003) [#24]
where is you wife , i need a woman , hello ??
Bye for today


Ross C(Posted 2003) [#25]
lol@ bazziman.

it's not even the vague questions. some ppl are just rude, especially when other ppl are here to help out of kindness. Not flaming, or not meaning too, but as ruz said, you could be a bit more polite.


patisawesome(Posted 2003) [#26]
i think there's a problem with the syntax, well thank's anyways. i think i'm going to have to start over.
bye,
-me


poopla(Posted 2003) [#27]
Pat, let me give you a few general tips here.

1. Do not post things like "You guys sure do take a long time to respond", or "Type faster".

2. Respect the veteran coders here since they will most often help you out.

3. Try something simple before you dive into heavy handed coding. It sounds to me like you havn't had any previous coding experience, and havnt tried learning the language yet.


patisawesome(Posted 2003) [#28]
i'm sorry if i was being rude, i get ecxited doing proggraming, this is also the first time i'v joined a forum.
-me


Ross C(Posted 2003) [#29]
It's cool. I don't think anyone is too bothered anyhow. Welcome to the board :D


patisawesome(Posted 2003) [#30]
thanks,
-me