realsin source for some cool stuff - 3 projects

Miscellaneous Forums/Blitz Showcase/realsin source for some cool stuff - 3 projects

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 especially like the behavior of "aliens" chasing space marine. Try to activate them all and then choose a spot and stand still, notice how they surround you, this is because they are coded to come as close as possible to you, and if they can't they will try again, so naturally this leads to them surrounding you really fast :)

here is code that handles that

			; wander around code
			; if enemy is standing still and some distance away from the target if trys to find way to target by wanderin around
			If TimeOut (thisEnemy\wander_around_timer )
				If( thisEnemy\oldX = EntityX#(thisEnemy\pivot) And thisEnemy\oldZ = EntityZ #(thisEnemy\pivot) )
						If EntityDistance(thisEnemy\pivot,  thisenemy\main_target) > 3
							random = Rand (1,2)
							If random = 1
								thisEnemy\orient_Pivot_Yaw_Deviate = Rand (45, 90)
							Else
								thisEnemy\orient_Pivot_Yaw_Deviate = - Rand (45, 90)
							End If 
							EntityColor thisEnemy\pivot, 200, 0, 0
						Else
							EntityColor thisEnemy\pivot, 250, 250, 250
						End If 
				Else
					thisEnemy\orient_Pivot_Yaw_Deviate = 0
				End If
				If thisEnemy\orient_Pivot_Yaw_Deviate > 90
					thisEnemy\wander_around_timer = SetTimer(Rand (500, 1000))
				Else
					thisEnemy\wander_around_timer = SetTimer(Rand (1000, 4000))
				End If 
			End If



really simple stuff that I have not seen anyone try here at forums, but really effective because it creates interesting behaviour that feels natural without complicated AI code :)