Organization

Blitz3D Forums/Blitz3D Programming/Organization

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I've completely restarted my current project, because of lack of organization. Although I have put together a new "template," I guess you could call it. Here'sa my coda:

;------------------------------;
;  O P E R A T I O N   6 0 0   ;
;    A No Enemies Production   ;
;    A sci-fi FPS-genre game   ;
;One of the first of its series;
;------------------------------;

;START-UP
.startup
Graphics3D 800,600
AppTitle "Operation 600"
SetBuffer BackBuffer()
AutoMidHandle True

;TYPES
.types

;player type
Type player
	Field pivot                             ;pivot entity
	Field camera                            ;camera entity
	Field x,y,z                             ;player's position
	Field health                            ;player health
	Field w_entity                          ;weapon entity
	Field w_ammo                            ;ammo in weapon
	Field w_type$                           ;type/name of weapon
	Field w_damage                          ;damage the weapon does
	Field w_offsetx, w_offsety, w_offsetz   ;weapon offset values
	Field running                           ;if the player is running or not (true/false)
End Typ

;object type
Type obj
	Field obj_type$                         ;enemy, car, box, etc.
	Field x,y,z                             ;object position
	Field e_weapon                          ;enemy's weapon - leave at "0" if not an enemy
	Field entity                            ;the actual mesh
	Field alpha#                            ;alpha of object
	Field shininess#                        ;shininess of object
	Field c_speed#                          ;car speed - leave at "0" if not a car
	Field c_wheels[4]                       ;car wheels - don't use if not a car
	Field x_vel#, y_vel#, z_vel#            ;velocity of the object
End Type 




;GLOBALS AND CONSTANTS
.globals

;CAMERA
Global cam_x#,cam_z#,cam_pitch#,cam_yaw#						;camera position
Global dest_cam_x#,dest_cam_z#,dest_cam_pitch#,dest_cam_yaw#	;camera destination




;MENU
Global mouse = LoadImage("media\menu\mouse.png")
Global glow = LoadImage("media\menu\glow.png")
Global title = LoadImage("media\menu\title1.png")
Global 




;MAINLOOP
While Not KeyDown(1)

	;do main loop stuff here

Wend



;INITIALIZING FUNCTIONS

;initilizes level
Function InitLevel(level) ;"level" is the level ID number. the level ID number is the number following the level mesh. "lvl0.op" - "0" would be level ID

	LoadLevel("lvl"+level+".op") ;if level=0, this would load "lvl0.op"
	
		
	
End Function

;UPDATING FUNCTIONS

;updates game/menu
Function UpdateLogic(logic$)

	Select logic$
		;game
		Case "game"
		
			;do game stuff
			
		Case "menu"
		
			UpdateMenu()
			
			RenderWorld
			UpdateWorld
			
			Flip 
			
	End Select 

End Function

;updates camera
Function UpdateCamera()
	
	;mouse look
	
	
	;camera move

End Function

;updates gun
Function UpdateGun(current_gun) ;"current_gun" is equal to the player's current gun set in "UpdateCamera()"

	;gun switch
	
	;gun shoot
	

End Function

;updates misc. actions
Function UpdateMiscActions()

	;do misc. stuff here

End Function

;updates all objects
Function UpdateObject()
	
	For o.obj = Each obj
	
		;do object stuff here
	
	Next 
		
End Function

;updates menu
Function UpdateMenu()
	
	;do menu stuff here

End Function 

;EXTERNAL FUNCTIONS 

;loads level
Function LoadLevel(filepath$)

	;load level here

End Function