home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beyond the 3rd Dimension
/
BEYOND3D.bin
/
ai
/
aiplane3.ait
< prev
next >
Wrap
Text File
|
1997-12-09
|
2KB
|
83 lines
: Walking AI
: STATE Init // initialization STATE
: RUN SAVEPOS 3 0 // save current posiition to reg 3-5
: RUN SAVEPOS 6 0 // save current posiition to reg 3-5
: RUN SETREG 4 TIME // used for timer
: RUN ADDREG 4 3000
: RUN RNDREG 0 1000
: RUN SUBREG 0 500
: RUN ADDREG 4 REG0
: RUN SETSTATE Wait1 0
: STATE Land
: RUN SAVEPOS 6 0 // save current posiition to reg 3-5
: IF GT REG4 TIME THEN RETURN 0 0 ENDIF
: IF OPENSPACE POSX POSZ THEN GOTOLABEL landok 0 ENDIF
: RUN SETSTATE FindPlace 0
: RUN RETURN 0 0
* landok
: RUN SETVAL POSY 0
: RUN MOVE 1500 0
: RUN SETREG 4 TIME
: RUN ADDREG 4 3000
: RUN RNDREG 0 1000
: RUN SUBREG 0 500
: RUN ADDREG 4 REG0
: RUN SETSTATE Wait1 0
: RUN RETURN 0 0
: STATE Wait1
: IF GT REG4 TIME THEN RETURN 0 0 ENDIF
RUN SETREG 1 POSY
RUN ADDREG 1 4.0 // taking off
RUN SETVAL POSY REG1
: RUN RNDREG 0 3
: RUN ADDREG 0 3
: RUN SETVAL POSY REG0
: RUN MOVE 1000 0
: RUN SETREG 4 TIME
: RUN ADDREG 4 2000
: RUN SETSTATE Wait2 0
: RUN RETURN 0 0
: STATE Wait2
: IF GT REG4 TIME THEN RETURN 0 0 ENDIF
: RUN SETSTATE FindPlace 0
: RUN RETURN 0 0
: STATE FindPlace
: RUN SAVEPOS 6 0 // save current posiition to reg 0-2
: RUN RNDREG 0 100
: RUN SUBREG 0 50 // x = -10..10
: RUN ADDREG 0 REG3 // center x
: RUN RNDREG 2 100
: RUN SUBREG 2 50 // x = -10..10
: RUN ADDREG 2 REG5 // center z
: IF OUTRANGE REG0 REG2 THEN RETURN 0 0 ENDIF
: IF OPENSPACE REG0 REG2 THEN GOTOLABEL found 0 ENDIF
: RUN RETURN 0 0
* found
: RUN SETVAL POSX REG0
: RUN SETVAL POSZ REG2 // y is the same
: RUN MOVE 5000 0 // use POSX-Z as goal osistion and duration -1
: RUN SAVEPOS 6 0 // save current posiition to reg 0-2
: RUN SUBREG 0 REG6
: RUN SUBREG 2 REG8
: RUN SETVAL POSX REG0
: RUN SETVAL POSY 0
: RUN SETVAL POSZ REG2 // y is the same
: RUN SETVAL ORNX 0
: RUN SETVAL ORNY 1.0
: RUN SETVAL ORNZ 0
: RUN ORIENT 1000 0 // orient to new driection in 1 sec using ORN+POS
: RUN SETREG 4 TIME
: RUN ADDREG 4 6000
: RUN SETSTATE Land 0
: RUN RETURN 0 0
: END