HELP!!!!

Blitz3D Forums/Blitz3D Beginners Area/HELP!!!!

I'm trying to make some sort of racing game (don't expect to see it any time soon, it will problaly fail), and i'm trying to make the track. I'm using waypoints, i'm going to set them up for sensors to tell if i'm on the track. Any ideas how i can texture the path? I tryed multi-texturing, but i can't position the textures right. I tryed sprites, way to slow. ?

Lofted splines are the easiest way.

don't expect to see it any time soon, it will problaly fail
With that attitude, failure is guaranteed I'm afraid.

Lofted splines? Remembner this is the begineers forum mate ;-P

http://freeworld3d.org/ has a track editor

Lofted splines? Remembner this is the begineers forum mate ;-P
Lofted spline - feature of many modelling packages where you take one two-dimensional shape (a cross-section of road, for instance) and extrude it along a path.

I'm aware its the beginner's forum, but I had two choices - either answer the question, or say "its too difficult for you".

Gfk -
"With that attitude, failure is guaranteed I'm afraid. "


- Yeah well, when you've tryed
6000000000000000000000000000 programs and only 2 of them work, you kinda start thinking that way. But i still try, and eventually something will work. Any ideas on something really simple to make?

And thanks for the link to the track editor, boomboom. i'll definatly check that out.

$30. :(

6000000000000000000000000000 programs and only 2 of them work, you kinda start thinking that way
But that's how it works. That's how you learn.

I must've written thousands upon thousands of programs over the years (I've been programming since 1986). Most of the stuff I did early on didn't work very well/at all, either. The idea is that you learn from it and get better at it.

Something simple to code... haven't seen anything you've done but for an absolute beginner I'd opt for:

1. Write a basic, two-player Pong game.

For this you'll need to use only basic graphics, simple functions, a little collision, and that's about it.

2. Add basic artificial intelligence/1 player mode.

Easier than it sounds. Think about what goes through your mind when you're playing. Is the ball higher up than the bat? I need to move the bat up!

3. Add difficulty levels (make the AI easy/hard to beat).

You could do this by something as simple as adding a delay before the AI player reacts to where the ball is, and moves the bat accordingly. Easier difficulty = longer delay.

Yeah I know, nobody wants to make Pong games because they're boring, but I can guarantee that you'll learn a hell of a lot more doing that, than getting out of your depth trying to write 6000000000000000000000000000 programs - 5999999999999999999999999998 of which, don't work.

Track Editor and a
and possible

my pong game sucks. But then the AI changes how quickly the AI bat moves, rather than a delayed reaction. So the computer eitehr always hits it or always misses it.

Gfk - thanks a ton, i'm 14 and i've been programing for about 2 years now, at least i know somebody else had as much trouble as i'm having. I'll try to make a 3d pong game, and i'll post it if it works out.

tonyg - thanks for that link, i love free stuff.

Hello.

at least i know somebody else had as much trouble as i'm having

Everyone on this, and every other programming, was in the same position once, and experienced the same problems. Generally, one day something just clicks and it all (ok, maybe not all) begins to make sense. I think I'll call it popping your newbie cherry.

Basically, be polite, willing to learn and ask pertinent, relevant questions. Be prepared to start small and let your understanding grow at it's own rate. Also, don't take shite from people who are too high and mighty to help - we've a few of them on this site, but thankfully they get banned often enough not to make them too much of a pain in the backside.

Oh, and check out the first thread on this forum, it's got a lot of good, simple ideas in it.

Goodbye.

Thanks, SoggyP.

The spline idea isn't THAT hard to implement really :o) But i agree with the above. Code something easy. Get it to work, add some features and generally get a feel for techniques for coding. Most other advanced techniques, come from expanding upon the basic ones.

I wrote some bezier track code a loooooong time ago - it may help ... see this thread ...

http://www.blitzbasic.com/Community/posts.php?topic=39690#444143

Ross C - Yeah, my problem is i start something simple, then i get excited and start trying to incorperate stuff that is way above my head...and it fails.


Stevie G - that's really cool. I really haven't even touched the mesh commands yet, but that will be a lot of help when i do.

How's this?

you need blitz_bass_studio
, and Blitz3D\Games\TunnelRun\Media\tex0.bmp.


Graphics3D 1024,768,32
SetBuffer BackBuffer()
AutoMidHandle True
AmbientLight 255,255,255
Include "bass.bb"

BASS_Init(-1,44100,0,0,0)
BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD,50)

;Breath_Of_Heaven.mod
;Metalsynth.mod
;Over_Heat.mod
music = BASS_MusicLoad(0,"Over_Heat.mod",0,0,0,0) 



;pong
Type paddle
	Field image,x,y,score
End Type
Type ball
	Field image,x,y,dx,dy
End Type
Type tunnel
	Field tunnel,texture,texpos#,scrollspeed#,divfactor#,red,green,blue
End Type
Global p1.paddle = CreatePaddle(0,GraphicsHeight()-20,1)
Global p2.paddle = CreatePaddle(0,20,2)
Global ball.ball = CreateBall(GraphicsWidth()/2,GraphicsHeight()/2)
Global loopcount = 0
Global multiplayer = WB3D_Notify("Pong","Play 2 player?",4)
If multiplayer = 6 Then multiplayer = 1
If multiplayer = 7 Then multiplayer = 0
;pong

BASS_ChannelPlay(music,0)


cam = CreateCamera()
CameraFogMode = 1
;te = LoadTexture("tex0.bmp")


Global te = Vis("hollow oval")





Global t.tunnel = CreateTunnel(0,0,0,te,50,1200,50)



FPS = CreateTimer(40)
Repeat
	
	BASS_Update()
	Local vumono = BASS_ChannelGetLevel (music) ; vumeters
	Local vuleft = BASS_MakeLoWord (vumono)
	Local vuright = BASS_MakeHiWord (vumono)
	
	PositionEntity cam,0,0,vuright/52*2
	
	t\scrollspeed = vuleft*.000005
	
	If (vuleft+vuright/2)/52 > 500
		t\red = Rand(150,255)
		t\blue = Rand(150,255)
		t\green = Rand(150,255)
	EndIf
	
	
	If vuleft/52 > 5
		;AmbientLight Rand(100,255),Rand(100,255),Rand(100,255)
		UpdateTunnel(t)
	EndIf
	
	If (vuleft+vuright/2)/52 > 800
		num = Rand(1,7)
		Select num
			Case 1
				te = Vis("hollow oval")
			Case 2
				te = Vis("filled oval")
			Case 3
				te = Vis("hollow rect")
			Case 4
				te = Vis("filled rect")
			Case 5
				te = Vis("tex")
			Case 6
				te = Vis("tex alpha")
			Case 7
				te = Vis("tex add")
		End Select
		t\texture = te
		EntityTexture t\tunnel,t\texture
	EndIf
	
	
	RenderWorld()
	UpdatePong()
	;vumeter
	Color 255,0,0
	Rect 10,GraphicsHeight()/2-100,10,vuright/52,0
	Color 0,255,0
	Rect 0,GraphicsHeight()/2-100,10,vuleft/52,0
	Color 255,255,255
	Text 0,200,(vuleft+vuright/2)/52
	Flip
	Cls
	WaitTimer(FPS)
	If KeyHit(1) Then Exit
	loopcount = loopcount +1
Forever
BASS_Stop()
End

;pong
Function GetPaddle(b.ball)
	If b\y < GraphicsHeight()/2
		Return 2
	ElseIf b\y > GraphicsHeight()/2
		Return 1
	EndIf
End Function
Function CreatePaddle.paddle(x#,y#,num)
	p.paddle = New paddle
	If num = 1
		p\image = CreateImage(80,20)
		SetBuffer ImageBuffer(p\image)
		Color 50,50,255
		Rect 0,0,80,20,0
		SetBuffer BackBuffer()
		Color 255,255,255
	ElseIf num = 2
		p\image = CreateImage(80,20)
		SetBuffer ImageBuffer(p\image)
		Color 255,150,0
		Rect 0,0,80,20,0
		SetBuffer BackBuffer()
		Color 255,255,255
	EndIf
	p\x = x
	p\y = y
	Return p
End Function
Function CreateBall.ball(x#,y#)
	b.ball = New ball
	b\image = CreateImage(10,10)
	SetBuffer ImageBuffer(b\image)
	Color 255,0,0
	Oval 0,0,10,10,0
	SetBuffer BackBuffer()
	Color 255,255,255
	b\x = x
	b\y = y
	b\dx = 1
	b\dy = 1
	Bounce(b,"both")
	Return b
End Function
Function Bounce(b.ball,kind$="sideways")
	If kind = "sideways"
		b\dx = -Sgn(b\dx)*(Rand(3,5))
		b\x = b\x + (3*Sgn(b\dx))
	ElseIf kind = "both"
		
		b\dx = Sgn(b\dx)*Rand(-5,5)
		.test
		If b\dx = 0 Then b\dx = Rand(-5,5):Goto test
		
		paddle = GetPaddle(b)
		If paddle = 1
			b\y = b\y -10
		ElseIf paddle = 2
			b\y = b\y +10
		EndIf
		
		b\dy = -Sgn(b\dy)*(Rand(3,5))
		
	EndIf
End Function
Function UpdatePong()
		SeedRnd MilliSecs()
	For b.ball = Each ball
		DrawImage b\image,b\x,b\y
		b\x = b\x +b\dx
		b\y = b\y +b\dy
		If b\x > GraphicsWidth()
			Bounce(b)
		ElseIf b\x < 0
			Bounce(b)	
		EndIf
		
		If b\y > GraphicsHeight()
			p1\score = p1\score+1
			Delete ball
			ball.ball = CreateBall(GraphicsWidth()/2,GraphicsHeight()/2)
			Exit
		ElseIf b\y < 0
			p2\score = p2\score+1
			Delete ball
			ball.ball = CreateBall(GraphicsWidth()/2,GraphicsHeight()/2)
			Exit
		EndIf
		
		;Text 0,0,
		
		For p.paddle = Each paddle
			DrawImage p\image,p\x,p\y
			If p\x <= 0+40
				p\x = 0+40
			ElseIf p\x >= GraphicsWidth()-40
				p\x = GraphicsWidth()-40
			EndIf
			
				If ImagesCollide(b\image,b\x,b\y,0,p\image,p\x,p\y,0)
					Bounce(b,"both")
				EndIf
		Next
		
		Text 0,0,"p1: " + p1\score
		Text 0,12,"p2: " + p2\score
	Next
	
	If KeyDown(32)
		p1\x = p1\x +6
	ElseIf KeyDown(30)
		p1\x = p1\x -6
	EndIf

	If multiplayer = 1
		If KeyDown(205)
			p2\x = p2\x +6
		ElseIf KeyDown(203)
			p2\x = p2\x -6
		EndIf
	Else
		If ball\x-40 > p2\x
			p2\x = p2\x +6
		ElseIf ball\x+40 < p2\x
			p2\x = p2\x -6
		EndIf
	EndIf
End Function
;end pong



Function Vis(mode$)
	FreeTexture(te)
	Select mode
		Case "hollow oval"
			te = CreateTexture(20,20)
			SetBuffer TextureBuffer(te)
			Oval 0,0,20,20,0
			SetBuffer BackBuffer()
		Case "filled oval"
			te = CreateTexture(20,20)
			SetBuffer TextureBuffer(te)
			Oval 0,0,20,20,1
			SetBuffer BackBuffer()
		Case "hollow rect"
			te = CreateTexture(20,20)
			SetBuffer TextureBuffer(te)
			Rect 0,0,20,20,0
			SetBuffer BackBuffer()
		Case "filled rect"
			te = CreateTexture(20,20)
			SetBuffer TextureBuffer(te)
			Rect 0,0,20,20,1
			SetBuffer BackBuffer()
		Case "tex"
			te = LoadTexture("tex0.bmp")
		Case "tex alpha"
			te = LoadTexture("tex0.bmp",2)
			TextureBlend te,1
		Case "tex add"
			te = LoadTexture("tex0.bmp")
			TextureBlend te,3
		Default RuntimeError("")
	End Select
	Return te
End Function
Function CreateTunnel.tunnel(x#,y#,z#,texture,sx#,sy#,sz#,scrollspeed#=.01,divisionfactor#=1,red=255,green=255,blue=255)
	t.tunnel = New tunnel
	t\texture = texture
	t\tunnel = CreateCylinder(100,0)
	EntityTexture t\tunnel,t\texture
	FlipMesh t\tunnel
	ScaleEntity t\tunnel,sx,sy,sz
	PositionEntity t\tunnel,x,y,z
	RotateEntity t\tunnel,90,0,0
	t\scrollspeed = scrollspeed
	t\texpos = 0
	t\divfactor = divisionfactor
	t\red = red
	t\green = green
	t\blue = blue
	EntityColor t\tunnel,t\red,t\green,t\blue
	EntityType t\tunnel,tunnel_CT
	Return t
End Function
Function UpdateTunnel(t.tunnel,mode=True)
	t\red=t\red+Rand(-20,20)
	t\green=t\green+Rand(-20,20)
	t\blue=t\blue+Rand(-20,20)
	If t\red > 255 Then t\red = 255
	If t\green > 255 Then t\green = 255
	If t\blue > 255 Then t\blue = 255
	If t\red < 0 Then t\red = 0
	If t\green < 0 Then t\green = 0
	If t\blue < 0 Then t\blue = 0
	EntityColor t\tunnel,t\red,t\green,t\blue
	
	t\texpos=t\texpos+t\scrollspeed
	If t\texpos>1 Then t\texpos=t\texpos-1
	
	If mode = True
		PositionTexture t\texture,t\texpos/t\divfactor,t\texpos
	ElseIf mode = False	
		PositionTexture t\texture,0,t\texpos
	EndIf
End Function