berto
Posts: 20708
Joined: 3/13/2002 From: metro Chicago, Illinois, USA Status: offline
|
More on scripted AI movement. Note the link to the MP4 video showing the scripted AI movement in action. quote:
ORIGINAL: berto quote:
ORIGINAL: berto I have achieved scripted AI movement by way of Lua CSEE commands. Not just unvarying scripted movement hard coded at the point of scenario design, but dynamically scripted movement adapting to changing game conditions as the scenario plays out. Seeing is believing. In the video available here, you will see: Beginning at Turn 1, the left force moves northward. The right force stays put. At Turn 10, the left force takes a sharp right angle turn to the east, and moves in that direction. The right force begins moving northward. At Turn 20, both forces start moving, diagonally in parallel, to the northwest. Up until Turn 30, these are scripted AI movements of a type never before possible in the Campaign Series. Until now, the Campaign Series AI has only been able to move forces, generally in a straight line, directly toward objectives. Now, with scripted AI, forces can be moved here, moved there, moved anywhere, with the here, the there, and the anywhere being completely arbitrary. This is a fundamentally different type of AI movement. At Turn 30, the scripted movement ceases, and normal, legacy, AI attack ensues. Even though control has passed to the attack AI, at any point in the attack we can instruct the AI to redirect the attack, to call off the attack, to retreat even, again as scripted actions. Here is the CSEE Lua code directing the force movements in the video: The top section is the code to script the left force. The bottom section scripts the right force movement. '{160,161,162}' are the trackids of the units in the left force. '{293,294,295}' are the trackids of the right force units. Instead of numbers, we could employ mnemonics, the code could read something like if turn == 1 then set_ai(COMPANY_A, WAYPOINT1, MOVE_HIGH) end if turn == 10 then set_ai(COMPANY_A, WAYPOINT2, MOVE_HIGH) end if turn == 20 then set_ai(COMPANY_A, WAYPOINT3, MOVE_HIGH) end if turn == 30 set_ai(COMPANY_A, NOWHERE, NO_ORDER) -- end scripted movement, the legacy AI attack assumes control end And so on. Again quote:
That's just the barest of beginnings. We can extend the concept far, far beyond that. For example, dynamically compute the turn, the trackid, the hex, the aiorder. In a complex web of interactive Lua functions taking into account, and responding to, all manner of game conditions and events. Imagine the possibilities! So imagine, now we can script the AI to do Flanking movements, and round-about attacks from the rear. Way-point movements. Starts and stops. Retreats. And all manner of fancy maneuvers. Whether in a single, pre-determined battle plan; or a set of such plans, with one of them selected at random; or a complex mix of plans and sub-plans selected on the fly in response to changing battlefield conditions. ... That is just one battle plan. We could script others. To be selected at random, at scenario start. And/or adapting randomly or "intelligently" -- as intelligently as we can script it -- based on how the battle plays out. I'm not saying that scripting like this will be easy. We can build framework code to simplify the scripting (hide away fussy details in high-level Lua functions, etc.). We can employ mnemonics (rather than numbers) to the hilt. But for all the challenges that lie ahead... Imagine the possibilities.
_____________________________
|