Open Source FPS

Community Forums/Showcase/Open Source FPS

wizzlefish(Posted 2004) [#1]
Any who are willing to help me with my first 3D game, thank you for viewing this post. I'm a newbie to texturing, so I'll need some help with that.

First Cylinder Shooter (what I'm calling it) is a game where you walk around a couple of mazes, shooting down cylindrical robots. I've tried developing this on my own, but I'd figure it would be so much easier if I used the Blitz Forums. And I'd learn a lot from the professionals. So please help me with this. You guys are known for that type of stuff.

Currently all we need to do is the AI, some of the models, the animation, and the texturing. I'll be putting up the source soon. I don't have it with me right now...


ckob(Posted 2004) [#2]
I would suggest maybe posting a little more information on the game such as screenshots, and some kind of design plan that others can read to help understand what it is your trying to accomplish.


wizzlefish(Posted 2004) [#3]
I know...I'm getting that already. I don't have Internet hooked up on the faster computer where I am coding, so it takes a while to get everything down to the Internet-enabled computer.

I'm trying to accomplish a simple FPS, with three guns, defined accuracy in each of them, a couple of levels, some quick animation, and the AI. I'm basically just trying to learn how to make a FPS. I've developed most of the game, I'm just seeing how much I can learn from the professionals. I really can't figure out texturing, and a lot of other aspects of detailed programming. I'll be getting some screenshots ASAP.

Thanks for the suggestion, though.
You can't say No Enemies never did nothing for the people. :)


gpete(Posted 2004) [#4]
i just downloaded a WolRon fps the other day- he even has cylinder enemies in it as placeholders...now where was it I saw that??


wizzlefish(Posted 2004) [#5]
Hey - my cylinders aren't just any cylinders! They're cylindrical robots with two little arms that shoot out lasers! Ha! They aren't placeholders, either! Well, OK, maybe they are. But they are ROBOTS! Not just boring old white cylinders. :)


wizzlefish(Posted 2004) [#6]
OK people, here is a screenshot:



Here is one of the guns:



And here is a car(I'm not really sure how we are going to use it, though):



And last but not least, here is the code:
;PLANS FOR THE GAME - RIGHT HERE:
;The three guns can be found around the level:
  ;-The Six-Shooters. Double the ammo, less accuracy. TWO GUNS
  ;-The Sniper. Supreme accuracy, little ammo
  ;-The Machine Gun. Lots of ammo, fairly good accuracy
  ;You start out with the Six-Shooters, and work your way around the level.
  ;You find other guns by picking them up on the floor.
  ;Sometimes there will be storage cabinets, where lots o stuff can be found.
;The controls are:
	;W,A,D,S - Walk
	;LMB - Shoot
	;RMB - Shoot (only six-shooters)
	;Spacebar - Pick up stuff
	;H - Help
	;ESC - Quit the game
	;O - Options
	;P - Pause


;STARTUP
Graphics3D 1280,1024,16,2
SetBuffer BackBuffer()
AppTitle "First Cylinder Shooter"
SeedRnd MilliSecs()
AutoMidHandle True 

;GLOBALS
; Camera position, angle values
Global cam_x#,cam_z#,cam_pitch#,cam_yaw#						; Current
Global dest_cam_x#,dest_cam_z#,dest_cam_pitch#,dest_cam_yaw#	; Destination

Global numberofenemies = 10

Const PLAYER_COL= 1
Const LEVEL_COL = 2
Const ENEMY_COL = 3
Const BULLET_COL= 4

;TYPES
;The bullet type
Type bullettype
	Field entityhandle
End Type
;The enemy type
Type badguytype
	Field entityhandle
	Field state
End Type

;SET-UP
;Lights, camera, and player...
Global light = CreateLight()
Global player = CreatePivot()
Global camera = CreateCamera(player)
;CameraRange camera, .01, 250
;Meshes


;use your own meshes....


Global level1 = LoadMesh("level1.x")
Global weapon1 = LoadMesh("six.3ds", camera)
Global weapon2 = LoadMesh("six.3ds", camera)
;bulletmesh = LoadMesh("bullet.x")
badguymesh = LoadMesh("enemy.3ds") : ScaleEntity badguymesh, .0001,0,.0001
Global bulletmesh = CreateSphere() : RotateMesh bulletmesh, 90, 0, 0 : ScaleEntity bulletmesh, .1, .1, .1
ScaleEntity badguymesh, 1, 4, 1
ScaleEntity level1, .05, .05, .05
ScaleEntity weapon1, .3, .3, .3
PositionEntity weapon1, .1, 0, .1
PositionEntity weapon2, .1, 0, .1
ScaleEntity weapon2, .3, .3, .3
TranslateEntity weapon2, .999, -1.4, .9999
TranslateEntity weapon1, -1.99999, -1.64, 1.22
;EntityAlpha bulletmesh, 0.0
;RotateEntity weapon2, 0,180,0
HideEntity bulletmesh
HideEntity badguymesh
EntityType camera, PLAYER_COL
EntityType level1, LEVEL_COL
EntityType badguymesh, ENEMY_COL
EntityType bulletmesh, BULLET_COL

;Sounds & 2D Graphics
;replace with own..."hairs" is the crosshairs
music = PlayMusic("Metal Keys.wav")
Global shoot = LoadSound("shoot.wav")
Global hairs = LoadImage("hairs.bmp")


timer = MilliSecs()
time = 60
;Create Enemies
For iter = 1 To numberofenemies
	badguy.badguytype = New badguytype
	badguy\entityhandle = CopyEntity(badguymesh)
	PositionEntity badguy\entityhandle, Rnd(50,100), 1, Rnd(50,100) 
	badguy\state = Rnd(1,2)
	EntityType badguy\entityhandle, 3
	EntityRadius badguy\entityhandle, .7
Next

badguy.badguytype = New badguytype
badguy\entityhandle = CopyEntity(badguymesh)
PositionEntity badguy\entityhandle, 0,1,0
badguy2.badguytype = New badguytype
badguy2\entityhandle = CopyEntity(badguymesh)
PositionEntity badguy\entityhandle, 10,1,10

;Place player, weapon, and enemies
MoveEntity camera, 0, 8, 0
MoveEntity weapon1, .1, 0, .1
;RotateEntity weapon1, 0, 0, 0
MoveEntity player, 20, 1, -20
For bgiter.badguytype = Each badguytype
	PositionEntity bgiter\entityhandle, Rnd(100)-50, 1, Rnd(100)=50
Next

;Collisions! Everybody likes collisions!
Collisions PLAYER_COL, LEVEL_COL, 2, 2 ;player to level
Collisions ENEMY_COL, LEVEL_COL, 2, 2 ;badguy to level
Collisions BULLET_COL, LEVEL_COL, 2, 2 ;bullet to level
Collisions BULLET_COL, ENEMY_COL, 2, 1 ;bullet to badguy
ammo = 6
reloads = 6
ammo2 = 6
reloads2 = 6
;MAIN LOOP
While Not KeyHit(1) Or Collisions 
	
	
	
	; Mouse look
	;-----------
	; Mouse x and y speed
	mxs=MouseXSpeed()
	mys=MouseYSpeed()
	
	; Mouse shake (total mouse movement)
	mouse_shake=Abs(((mxs+mys)/2)/1000.0)

	; Destination camera angle x and y values
	dest_cam_yaw#=dest_cam_yaw#-mxs
	dest_cam_pitch#=dest_cam_pitch#+mys

	; Current camera angle x and y values
	cam_yaw=cam_yaw+((dest_cam_yaw-cam_yaw)/5)
	cam_pitch=cam_pitch+((dest_cam_pitch-cam_pitch)/5)
	
	RotateEntity camera,cam_pitch#,cam_yaw#,0
	
	; Rest mouse position to centre of screen
	MoveMouse 640,512
	
	;Draw Crosshairs
	
	DrawImage hairs, 640, 472

	; Camera move
	; -----------
	
	; Forward/backwards - destination camera move z values
	If KeyDown(17)=True Then dest_cam_z=.4
	If KeyDown(31)=True Then dest_cam_z#=-.4

	; Strafe - destination camera move x values
	If KeyDown(30)=True Then dest_cam_x=-.4
	If KeyDown(32)=True Then dest_cam_x=.4
	If ammo <= 1
	If KeyHit(19)= True Then 
		ammo = ammo + 6
		Text 640,512, "RELOADED!"
		Delay 300
		reloads = reloads - 1
	EndIf
	EndIf
	If ammo2 <= 1
	If KeyHit(20)= True Then
		ammo2 = ammo2 + 6
		Text 640,512, "RELOADED!"
		Delay 300
		reloads2 = reloads2 - 1
	EndIf
	EndIf
		
	
	; Current camera move x and z values
	cam_z=cam_z+((dest_cam_z-cam_z)/5)
	cam_x=cam_x+((dest_cam_x-cam_x)/5)

	; Move camera
	MoveEntity camera,cam_x,0,cam_z
	dest_cam_x=0 : dest_cam_z=0
	
	; Gravity
	TranslateEntity camera,0,-1,0


	
	;Update Bullets
	For biter.bullettype = Each bullettype
		MoveEntity biter\entityhandle, 0, 0, .5
		If Abs(EntityX(biter\entityhandle, 1)) > 10000
			FreeEntity biter\entityhandle
			Delete biter
		ElseIf Abs(EntityY(biter\entityhandle)) > 10000
			FreeEntity biter\entityhandle
			Delete biter
		ElseIf Abs(EntityZ(biter\entityhandle)) > 10000
			FreeEntity biter\entityhandle
			Delete biter
		EndIf
	Next
	
	;Shoot
	;-----
	If ammo >= 1
	If MouseHit(1)
		;PlaySound shoot
		bullet.bullettype = New bullettype
		bullet\entityhandle = CopyEntity(bulletmesh)
		PositionEntity bullet\entityhandle, EntityX(weapon1, 1), EntityY(weapon1, 1), EntityZ(weapon1, 1)
		RotateEntity bullet\entityhandle, EntityPitch(weapon1, 1), EntityYaw(weapon1, 1), EntityRoll(weapon1, 1)
		EntityType bullet\entityhandle, 4
		EntityRadius bullet\entityhandle, .01
		ammo = ammo - 1
	EndIf
	EndIf
	
		;Shoot
	;-----
	If ammo2 >= 1
	If MouseHit(2)
		;PlaySound shoot
		bullet.bullettype = New bullettype
		bullet\entityhandle = CopyEntity(bulletmesh)
		PositionEntity bullet\entityhandle, EntityX(weapon2, 1), EntityY(weapon2, 1), EntityZ(weapon2, 1)
		RotateEntity bullet\entityhandle, EntityPitch(weapon2, 1), EntityYaw(weapon2, 1), EntityRoll(weapon2, 1)
		EntityType bullet\entityhandle, 4
		EntityRadius bullet\entityhandle, .01
		ammo2 = ammo2 - 1
	EndIf
	EndIf

	

	
	;We all know what this does
	UpdateWorld
		
		;Kill the badguy if shot
	For biter.bullettype = Each bullettype
		If CountCollisions(biter\entityhandle) > 0
			badguyhit = EntityCollided(biter\entityhandle, 3)
			For badguysearch.badguytype = Each badguytype
				If badguyhit = badguysearch\entityhandle
					If badguysearch\state <> 5
						badguysearch\state = 5
						RotateEntity badguysearch\entityhandle, 0, 0, 90
						kills = kills + 1
						TranslateEntity badguysearch\entityhandle, 0, -1, 0
						Exit
					EndIf
				EndIf
			Next
			FreeEntity biter\entityhandle
			Delete biter
		EndIf
	Next
	
	If kills >= numberofenemies
		Cls 
		Text 640,512, "YOU WIN!!!!"
		WaitMouse
		End
	EndIf 
	
	;Let's hope we all know what this does
	RenderWorld
	;Quit If ammo is out
	If ammo <= -1 And reloads <= -1
		Cls
		Text 640, 512, "YOU LOSE!!!!"
		WaitMouse 
		End
	EndIf
	

	
	;Update timer
	If timer = timer + 1000
		time = time - 1
		timer = MilliSecs()
	EndIf
	
	;Quit if timer is out
	If timer <= 0
		Cls
		Text 640, 512, "YOU LOSE!!!!"
		WaitMouse
		End
	EndIf
	
	
	
	
	;Write ammo count and time remaining
	Color 0, 255, 0
	Text 10, 10, "Ammo of Left-Hand Gun: " + ammo + " / " + reloads
	Text 300, 10, "Ammo of Right-Hand Gun: " + ammo2 + " / " + reloads2 
	Text 900, 20, "Time Remaining: " + time 
	
	DrawImage hairs, MouseX(), MouseY()
	
	;Flip the screen into view
	Flip
	

;end of main loop
Wend

;End the game
End



WolRon(Posted 2004) [#7]
First of all, it's nice to see that my FPS code is getting some use :)
Your idea sounds a bit like the old game Berzerk.


Anyways, you forgot the "WWW"'s in your picture links.


Also, this code:
	;Update timer
	If timer = timer + 1000
		time = time - 1
		timer = MilliSecs()
	EndIf
will never be executed because timer cannot equal timer + 1000. That's like saying 1 = 1+1000. Never will be true.
What you want is::
	;Update timer
	If Millisecs() > timer + 1000
		time = time - 1
		timer = MilliSecs()
	EndIf



Also, this code:
	If KeyHit(19)= True Then 
		ammo = ammo + 6
		Text 640,512, "RELOADED!"
		Delay 300
		reloads = reloads - 1
	EndIf
which is supposed to draw RELOADED in the middle of the screen won't work either because you are executing the Text command BEFORE Renderworld. I would suggest moving these lines after the Renderworld command.
Also, the Delay 300 command is useless if it's intent was to display RELOADED on the screen for 300 milliseconds. All it will end up doing is pausing your entire game for 300 milliseconds (and you still won't see the RELOADED message because of the reason I mentioned above).
Change it to something like this:
	If KeyHit(19)= True Then 
		ammo = ammo + 6
		displayreloadmessage = True
		displayreloadtime = Millisecs()
		reloads = reloads - 1
	EndIf

	If displayreloadmessage = True
		Text 640,512, "RELOADED!"
		If displayreloadtime + 300 < Millisecs() Then displayreloadmessage = False
	Endif


By the way, unless your 6-shooters can hold 7 bullets, you may want to take a look at this line:
If ammo <= 1
It will allow a reload (6 more bullets) with 1 bullet still in the gun.


And this line:
If ammo <= -1 And reloads <= -1
will allow the player to reload even with zero reloads left (not to mention that you should be looking for "ammo = 0"; how can ammo = -1?).


Jeremy Alessi(Posted 2004) [#8]
Check out my FPSNet example for a networked FPS example.

3 weapons, unlimited players (until the game gets too slow), chat, etc...

http://www.blitzbasic.com/codearcs/codearcs.php?code=1149


wizzlefish(Posted 2004) [#9]
I know....I've been trying to figure out that timer thing.

What should I change those lines to?

And thanks for the code, WolRon :)


wizzlefish(Posted 2004) [#10]
more screenshots on the way....anybody have any gunshot sounds I could use?


Erroneouss(Posted 2004) [#11]
ill upload some later 4 u *gunshots... ;D
i am the first to post in ur forum "no enemies"!!!!!!!!!


wizzlefish(Posted 2004) [#12]
Thanks! And thanks for posting in the forum....have you checked out www.NoEnemies.com yet? It's awaiting yet another update. Nothing really good on it now.


Erroneouss(Posted 2004) [#13]
http://www.freewebs.com/duckgames/ - gunshot sound 4 u...
gunshot.wav is at the bottom as a downlosd...
sorry, i didnt notice i deleted my high quality gunshots while i deleted my MP5.... :(
...and yes i did go to ur website!! YAY!!!
im not the only young person here!!!!!!
whooooohoooooo!!!!!!
im only 14.... :D


wizzlefish(Posted 2004) [#14]
I'm only 11

BEAT THAT!!!

And I'll check your website out....


wizzlefish(Posted 2004) [#15]
could someone help me with texturing?


Erroneouss(Posted 2004) [#16]
hm.....texturing...cant do that....no.....no......
srry...... i use paint for my textures lol...but im
getting PaintShopPro8 for christmas!!:D!!!!


wizzlefish(Posted 2004) [#17]
I can make the textures - how do I apply them?


jfk EO-11110(Posted 2004) [#18]
apply where? in Blitz or in your modelling tool?
In blitz it is

mesh=loadmesh("thing.3ds")
tex=loadtexture("whatever.bmp")
entitytexture mesh,tex

but you should learn how to find out such things by your own, unless you want to wait for an answer to every little question. In the editor there is the help tab, follow "command reference" and go to 3D, Textures and EntityControl Sections.


wizzlefish(Posted 2004) [#19]
OK - I must not have worded that right. I can't, for instance, create an exact texture map for anything. I can only do simple stuff, like walls, floors, cielings...the like.

And I know about the help file. I'm not a stupid 11-year old, as much take me for. Obviously there is a "LoadTexture" command. Obviously there is an "EntityTexture" command. Obviously there is a "KillYoungProgrammer" command, and it is often used. I'm new to this. IS THERE ANY TUTORIAL FOR TEXTURE MAPS?!?!?!?!?!?!?!!!?!?!?!


Matty(Posted 2004) [#20]
I assume you are referring to texturing models that are not just flat, like a character model or a weapon. Use some kind of unwrapping tool like Lithunwrap or Ultimate Unwrap, even Milkshape has some basic uvmapping stuff.


WolRon(Posted 2004) [#21]
Sounds like you want to do UV mapping.

Check out these explanations of the AddTriangle and AddVertex commands. They describe a bit how UV mapping works.


AddVertex ( surface,x#,y#,z#[,u#][,v#][,w#] )
Parameters
surface - surface handle
x# - x coordinate of vertex
y# - y coordinate of vertex
z# - z coordinate of vertex
u# (optional) - u texture coordinate of vertex
v# (optional) - v texture coordinate of vertex
w# (optional) - w texture coordinate of vertex - not used, included for future expansion

Description
Adds a vertex to the specified surface and returns the vertices' index number, starting from 0.

x,y,z are the geometric coordinates of the vertex, and u,v,w are texture mapping coordinates.

A vertex is a point in 3D space which is used to connect edges of a triangle together. Without any vertices, you can't have any triangles. At least three vertices are needed to create one triangle; one for each corner.

The optional u, v and w parameters allow you to specify texture coordinates for a vertex, which will determine how any triangle created using those vertices will be texture mapped. The u, v and w parameters specified will take effect on both texture coordinate sets (0 and 1). This works on the following basis:

The top left of an image has the uv coordinates 0,0.
The top right has coordinates 1,0
The bottom right is 1,1.
The bottom left 0,1.

Thus, uv coordinates for a vertex correspond to a point in the image. For example, coordinates 0.9,0.1 would be near the upper right corner of the image.

So now imagine you have a normal equilateral triangle. By assigning the bottom left vertex a uv coordinate of 0,0, the bottom right a coordinate of 1,0 and the top centre 0.5,1, this will texture map the triangle with an image that fits it.

When adding a vertex its default color is 255,255,255,255.

Example
Graphics3D 640,480 
SetBuffer BackBuffer() 

mesh = CreateMesh() 
surf = CreateSurface(mesh) 

v0 = AddVertex (surf, -5,-5,0, 0 ,0) 
v1 = AddVertex (surf, 5,-5,0, 1 ,0) 
v2 = AddVertex (surf, 0, 5,0, 0.5,1) 

tri = AddTriangle (surf,v0,v2,v1) 

cam = CreateCamera() 
MoveEntity cam, 0,0,-7 

RenderWorld 
Flip 

WaitKey 
End  

AddTriangle ( surface,v0,v1,v2 )
Parameters
surface - surface handle
v0 - index number of first vertex of triangle
v1 - index number of second vertex of triangle
v2 - index number of third vertex of triangle

Description
Adds a triangle to a surface and returns the triangle's index number, starting from 0.

The v0, v1 and v2 parameters are the index numbers of the vertices created using AddVertex.

Depending on how the vertices are arranged, then the triangle will only be visible from a certain side. Imagine that a triangle's vertex points are like dot-to-dot pattern, each numbered v0, v1, v2. If these dots, starting from v0, through to V2, form a clockwise pattern relative to the viewer, then the triangle will be visible. If these dots form an anti-clockwise pattern relative to the viewer, then the triangle will not be visible.

The reason for having one-sided triangles is that it reduces the amount of triangles that need to be rendered when one side faces the side of an object which won't be seen (such as the inside of a snooker ball). However, if you wish for a triangle to be two-sided, then you can either create two triangles, using the same set of vertex numbers for both but assigning them in opposite orders, or you can use CopyEntity and FlipMesh together.


Using the commands above you can manually texture your meshes. Try it on a few simpler meshes (plane, cube, 2D circle, cylinder) to get an idea for how it works.

I would suggest using a 3rd party program to do the uvmapping for you though. An excellent program I use is Blender. Although there is a steep learning curve. Click on the "About Blender" button on the web page to download it.


BTW, did you make the changes to your code that I suggested above?


Paul Murray(Posted 2004) [#22]
Go to Psionc's site and read the tutorial on Lithunwrap UV unwrapping ( www.psionic3d.co.uk ).

If you go to the free stuff section, you'll find some free gunshots too.


wizzlefish(Posted 2004) [#23]
thanks....


jfk EO-11110(Posted 2004) [#24]
Of course, your question wasn't clear. And it wouldn't be the forst time somebody don't know the EntityTexture Command. LithUnwrap is one Freeware Tool for UV Mapping. Anyway, you shouldn't underestimate the uv mapping work, it's pretty tricky esp. for things like characters. Psionics tutorials are surely a good entry point. Good luck.


wizzlefish(Posted 2004) [#25]
I've looked at Psionic's stuff - he is amazing. And I figured out how to texture. AND I KNOW THE ENTITYTEXTURE COMMAND!!!!!!!! This isn't the "forst" time! Most kids don't have a clue what the word "entity" means.


wizzlefish(Posted 2004) [#26]
I'm thinking of creating an AI function...is this a good start?

Function EnemyAI()

  If badguy\state = 1 ;regular
    RotateEntity badguy\entityhandle, 1,0,0
    If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
    EndIf
  ElseIf badguy\state = 2 ;guard
    If EntityX(badguy\entityhandle) <= badguyX ;position of badguy at the start of the game
      TranslateEntity badguy\entityhandle, 1,0,0
      If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
      EndIf
    ElseIf EntityX(badguy\entityhandle) >= badguyX + 200
      TranslateEntity badguy\entityhandle, -1,0,0
      If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
      EndIf
    EndIf
  ElseIf badguy\state = 3 ;sniper
    PointEntity badguy\entityhandle, camera
    If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
      EndIf
  EndIf

End Function


Is this a good function, or should I reconsider everything....


wizzlefish(Posted 2004) [#27]
I know you people are here....


WolRon(Posted 2004) [#28]
Well, it's a start. Keep what you have and work on it. It will grow into what you want eventually.

Some things I've noticed...


If Millisecs() = shoottimer1 + 5000
Well, the odds that Millisecs() is going to EQUAL shoottimer1+5000 is very, very slim. You should change that to greater than ">".

###########################################################

PointEntity badguy\entityhandle, camera
Unless you want your badguys to have the ability to instantly turn around, you should change this to something else. Maybe look into using the AlignToVector command. It has a rate# value that you can use to make your badmen turn at a more realistic rate.

###########################################################

    If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
    EndIf
This routine that you are using will make your badguys shoot non-stop (once every 5 seconds, even if they aren't facing the player, or if they can even see the player). Unless you are trying to create a Robotron type of game, this will require some work. Maybe look into trying to detect if the badguys can see the player first (Linepick or Entitypick commands). Maybe throw a little randomness into there too
If Millisecs() > shoottimer1 + rnd(5000, 100000)
so that they don't shoot at a constant rate.

###########################################################

This shoottimer1 variable looks like you are using it in a way that will cause all of the badguys to shoot at the same time. Unless this is what you want, you could add a field to the badguytype that stores the time (Millisecs()) of the last time each badguy shot.
Type badguytype
	Field entityhandle
	Field state
	Field lastshottime
End Type
and then check against that
If Millisecs() > badguy\lastshottime + rnd(5000, 100000)


###########################################################

This is redundant code:
    If EntityX(badguy\entityhandle) <= badguyX ;position of badguy at the start of the game
      TranslateEntity badguy\entityhandle, 1,0,0
      If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
      EndIf
    ElseIf EntityX(badguy\entityhandle) >= badguyX + 200
      TranslateEntity badguy\entityhandle, -1,0,0
      If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
      EndIf
    EndIf
There's no need to have the same 'shooting' code twice. Since the 'shooting code' is seperate from the 'walking code' it could be optimized like so:
  ElseIf badguy\state = 2 ;guard
    If EntityX(badguy\entityhandle) <= badguyX ;position of badguy at the start of the game
      TranslateEntity badguy\entityhandle, 1,0,0
    ElseIf EntityX(badguy\entityhandle) >= badguyX + 200
      TranslateEntity badguy\entityhandle, -1,0,0
    EndIf
    If Millisecs() > badguy\lastshottime + rnd(5000, 100000)
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
    EndIf
The above code does cause the badguy to 'turn around' and walk the opposite way if he goes too far left or right, BUT it fails to actually move the badguy when he's in between those two limits. One solution could be to create a substate to your guarding state that keeps track of which direction the badguy was last traveling.
badguytype
	Field entityhandle
	Field state
	Field substate
	Field lastshottime
End Type
and then rewrite it like this:
  ElseIf badguy\state = 2 ;guard
    If EntityX(badguy\entityhandle) <= badguyX ;position of badguy at the start of the game
      badguy\substate = 1  ;walk right
    ElseIf EntityX(badguy\entityhandle) >= badguyX + 200
      badguy\substate = -1  ;walk left
    EndIf
    TranslateEntity badguy\entityhandle, badguy\substate,0,0


###########################################################

By the way, this statement you made:
AND I KNOW THE ENTITYTEXTURE COMMAND!!!!!!!! This isn't the "forst" time! Most kids don't have a clue what the word "entity" means.
sounds very cocky. If you want help in the future, I suggest you try to act more polite. No one here knows what you do or do not know, so don't shout at them for it. I have attempted to help you a lot in the past few weeks (even today), but I may change my mind about helping you if you choose to act like a snotty nose kid.


wizzlefish(Posted 2004) [#29]
Thanks


Ross C(Posted 2004) [#30]
patisawesome is back :o)


wizzlefish(Posted 2004) [#31]
?


Erroneouss(Posted 2004) [#32]
patisawesome's back!?!?!?!?!?!?!?!
FOR REAL???????????????????
...cool!! :D


wizzlefish(Posted 2004) [#33]
What's patisawesome? Why is he so legendary?


wizzlefish(Posted 2004) [#34]
OK - I'm almost done. I've finished the following:

- The backbone of the game
- Gun, level, and enemy models done
- Texturing of the gun and level (but not the enemy)
- All controls

To do:

- Enemy AI (I'm working on it)
- Multiple levels
- keys, doors, levers, etc.
- Enemy placement (I think I'll hardcode it)
- Weapon accuracy (I can't figure out how to modify it)
- Multiple weapons
- Menu system


If anyone could help me with these issues, I'd be thankful. The production of this game has taught me a lot about 3D programming. Once we get this finished, I'll be happy. I hope to be working on a community project soon. That would be fun.

So I'll be in touch, and please try to help me with these problems. I've got the multiple weapons, menu system, and keys, doors, levers, etc. under control, but I need help with the enemy placement, enemy AI, and weapon placement.

Good night. :)


Erroneouss(Posted 2004) [#35]
i made a cruddy entity (only b3d files) placer that my team uses... but it saves to a custom file type... (.LEVEL)... u want it? ill upload it for ya... or u could just use droplet (but his site is down now... cuz of bandwidth costs...)... my .level format just writes the names of the entities (primitive name, or its file path (for a mesh)...)and its xyz position... doubt ud want it but.... and it has camera waypointing cutscene editor thingie in it... ill upload the cutscene .bb thing 4 u too if u want it...


wizzlefish(Posted 2004) [#36]
OK - I've figured out the multiple weapons system, but how do I tell the game which level to load?

Is this practical or is their an easier way?


wizzlefish(Posted 2004) [#37]

tell the user he's a


lol


xmlspy(Posted 2004) [#38]
Dude, 11 years old, that's awesome! I can't get my 13 year old brother to do any programming. PC = Only Games, in his mind. Wish you luck with this project.

Note: I think this post should be moved to Programming - Blitz3D section, as it's not a Showcase.


wizzlefish(Posted 2004) [#39]
Yeah...I suppose so - but I'm not a moderator....


wizzlefish(Posted 2004) [#40]
OK - I tried doing that "weapon switch thing," but it didn't work. How do I make it so you go over to a gun laying on the ground, place your crosshairs on it, and right-click, and it transports to your hand. How do I do that? And then, if the weapon exists in your hand, you can press 1, 2, or 3 to switch weapons. I am just clueless. :(


jfk EO-11110(Posted 2004) [#41]
Camerapick, Keydown/KEyhit, etc.

please note the gun on the floor doesn't have to be the same mesh as the one you'll hold in your hand. I suggest to use a high poly model for the hand and a low poly version on the floor. THen Freeentity the one that was picked up and simply unhide the one in the hand (loaded initially and hidden,then parented to camera). Probably you should even use an individual hand for each weapon that is hidden/shown together with the gun. Use an animated Mesh for the Hand/gun for the recoil fx etx.

Well, anyway, that's the way I do it, maybe not the best.