Project PLASMA FPS

Blitz3D Forums/Blitz3D Programming/Project PLASMA FPS

Shambler,
I keep Each entity Type To its own .bb Include file And add the functions...
I agree 100% its the only way To keep the code modular. Check out my object-based coding methodology for TBFPS.

What I propose is that someone puts together a test level (B3D format) with at least one of each game entity: Spawner, Lift, Ladder, Door, Switch, Light, and Sound. Using the label scheme, label each entity like 'spawner01', 'door01', 'switch01', etc. With this a developer can take on writing the code structures for a specific entity based on the its purpose and intended behavior. We can add more entities later.

Here's my list of entities and brief descriptions:

Spawner - A 3D starting point in which bots and powerups are generated. Can be activated by switch or builtin timer.

Door - A 3D structure which restricts access to level areas. Open/Close State is activated by switch. Can require key to activate switch.

Platform - Aka Lift, A rotating/horizontal/vertical moving 3D structure which can transport bots and players standing atop. Can be switch activated or automatic timer.

Climber - Aka Ladder, A virtual 3D Field which bots and players can climb vertically upon collision.

Light - A virtual 3D object that is responsible lighting and light effects (lensflare, dynamic3D) within the scene.

Sound3D - A 3D sound object.

Switch - A virtual 3D field in which actions and events(multiple actions) can be activated upon collision or timer.

Below is the level loader code. The level loader will load a b3d level, parse the entity labels, and create entity types and assign values.

;level loader code
Const ENTITY_MAX=255
Global entities%
Dim entity%(ENTITY_MAX)

loadlevel("test.b3d")

Function LoadLevel%(filename$)
	;load entity properties from database
	level%=LoadAnimMesh(filename$) ;load level geometry
	b3dhierarchy(level%)
	For loop = 1 To entities%

		If Left(EntityName$(entity(loop%)),7)="spawner" 
			;new entity type (ie; spawner.spawner=New spawner)
			;assign property values (; spawner\frequency%=1000) 
			;manipulate entity
		End If

		If Left(EntityName$(entity(loop%)),8)="platform" 
			;new entity type
			;assign property values
			;manipulate entity
		End If

		;other entities etc.

	Next	
	Return level%
End Function

Function b3dhierarchy(parent%)
	children%=CountChildren(parent%)
	For loop = 1 To children%
		entities%=entities%+1
		child%=GetChild (parent%,loop)
		entity(entities%)=child%
		b3dhierarchy(child%)
	Next
End Function