ИИ в игре. В играх Без ии не как
Есть варианты.
;==========================================
Пример простой
AppTitle "Simulator AI by CAESAR GAMES"
;--------------------------------------------------
; --------"Simulator AI by CAESAR GAMES"----------
;---------www.caesargames.com-------------------
;
[email protected]
;---------Programming: CAESAR--------------------
;---------- 29.11.2006-----------------------------
;
Const Distance_Next_Waypoint=1
Const Distance_Visible_Player=10
Const WAYPOINTS_MAX=10
Const STEP_RADIAN=360/WAYPOINTS_MAX
Const RADIUS_WAYPOUNTS=30
Type waypoint
Field waypoint_entity
Field waypoint_number=0
End Type
Type bot
Field bot_entity
Field target_
Field result_=0
Field result_random=1
End Type
Global player
Graphics3D 800,600,16,2
SetBuffer BackBuffer()
camera=CreateCamera()
CameraClsColor camera,255,255,255
light=CreateLight()
RotateEntity light,90,0,0
create_player()
create_bot(0,0,50)
create_bot(20,0,50)
create_bot(-20,0,50)
For i= 1 To 360 Step STEP_RADIAN
x# = RADIUS_WAYPOUNTS * Cos( i )
y# = RADIUS_WAYPOUNTS * Sin( i )
kol=kol+1
Create_Waypoint(x,y,50,kol)
Next
While Not KeyDown( 1 )
Update_Bot()
Update_Player()
UpdateWorld
RenderWorld
Flip
Wend
Function Create_Waypoint(x1,y1,z1,kol)
w.waypoint = New waypoint
w\waypoint_entity=CreateSphere()
EntityColor w\waypoint_entity,0,0,255
PositionEntity w\waypoint_entity,x1,y1,z1
w\waypoint_number=kol
End Function
Function Create_Bot(x,y,z)
p.bot = New bot
p\bot_entity=CreateCylinder(3)
ScaleEntity p\bot_entity,1,1,3
EntityColor p\bot_entity,255,0,0
PositionEntity p\bot_entity,x,y,z
p\result_random=1
End Function
Function Create_Player()
player=CreateCube()
EntityColor player,0,255,0
PositionEntity player,-10,-10,50
End Function
Function Update_Bot()
For p.bot = Each bot
For w.waypoint = Each waypoint
If EntityDistance (p\bot_entity, player)<10 Then p\target_=player
If (EntityDistance(p\bot_entity,w\waypoint_entity)<Di stance_Next_Waypoint) p\result_random=Rnd(1,WAYPOINTS_MAX)
If w\waypoint_number=p\result_random Then
p\target_=w\waypoint_entity
EndIf
speed#=.015
bex#=EntityX#(p\target_)
bey#=EntityY#(p\target_)
bez#=EntityZ#(p\target_)
bbx#=EntityX#(p\bot_entity)
bby#=EntityY#(p\bot_entity)
bbz#=EntityZ#(p\bot_entity)
bcx#=bex#-bbx#
bcy#=bey#-bby#
bcz#=bez#-bbz#
bcn#=Sqr(bcx*bcx+bcy*bcy+bcz*bcz)
bcx=bcx/bcn
bcy=bcy/bcn
bcz=bcz/bcn
AlignToVector p\bot_entity,bcx,bcy,bcz,0,.01
MoveEntity p\bot_entity,0,0,speed#
Next
Next
End Function
Function Update_Player()
If KeyDown(200) Then MoveEntity player,0,.31,0
If KeyDown(20
Then MoveEntity player,0,-.31,0
If KeyDown(203) Then MoveEntity player,-.31,0,0
If KeyDown(205) Then MoveEntity player,.31,0,0
End Function
ClearWorld()
End
Прикольный исходник
Вопрос можно ли поставить в 3d max Dummy Заместо стандартных
поинтов вокруг. Получится так