Unknown

From DarkAI

DIRECT INTEGRATION DEMO


This demo shows a very simple AI program to show how DarkAI can take direct control of DarkBasic objects, and therefore serves as a good starting place to learn the main structure of an AI controlled program.

sync on : sync rate 0
AI Start

The AI Start command creates the AI system and must always be called before other AI commands.

make object cube 1,10
AI Add Enemy 1
AI Entity Go To Position 1,0,30

This creates our single entity as a DarkBasic cube and adds it to the AI system as an enemy. In this case it does not matter which team we add it to since there will be no other entities added. We then give the entity something to do by telling it to move 30 units forward, away from the camera.

do

AI Update
sync

loop

This is the main loop and simply updates the AI system and draws everything to the screen. The AI Update command moves our entity to his destination, then it will wait a while and move back to its idle position (the position it was at when added to the system). The cube is automatically move for us because by default an entity is linked to the object with the same number, in this case the cube, and will move it in the X and Z directions as well as rotate on the Y axis. No other change will be made to the object.