FAQ for project # 6 ===================================================================== Question: does rules called need to be legal? Answer: Please make sure that the rules called in the script are legal! For instance, ordering the AI to build a shipyard without having built a lumbermill will stop the script from running. Refer to strategy guides on the Internet to find out which actions are legal at a given time. Example: The AiNeed orders the AI to build a lumbermill. Before building a Shipyard (Harbor) we need to make sure that we own a lumbermill. The AiWait makes sure the lumbermill is completed. Without the AiWait, the script will continue executing actions. function() return AiNeed(AiLumberMill()) end, function() return AiWait(AiLumberMill()) end, function() return AiNeed(AiHarbor ()) end, ===================================================================== Question: Why Stratagus doesn't run? Answer: Stratagus doesn’t run: please refer to the stderr.txt and stdout.txt files in the Wargus directory. If an error is encountered, it is reported there. ===================================================================== Question: Why Stratagus crashed? Answer: Stratagus crashes sometimes: this is quite possible. Stratagus is an open-source RTS engine, so there are undoubtedly many bugs still in the code. If you run into any problems and you don’t know where to look for the bug, please contact me. ===================================================================== Question: Do you know of any way to check on the status of an assembled force? Answer: Before sending them into battle, you can check whether the force is complete by adding the AiWaitForce() command. When you order to attack, then I guess you can use the CheckForce() command and see if the force is still complete. I never used that command before though. However, i dont think you can directly check if it has been completly destroyed. The stratagus engineers, unfortunately, removed a lot of the scripting commands.BTW, when a unit dies, it is removed from the game. When a unit has achieved its goal (it destroyed the target that was set by the AI engine) it is freed. You can then again assign this unit to another force. ===================================================================== Question: Are the gold and resource amounts used in the maps (~650,000 gold per mine, etc.) going to be used as well in the tests? In other words, resources really aren't an issue, are they? Answer: True, we will only test your AI on the two maps listed in the assignment. ===================================================================== Question: You showed me a file that had a list of all the "Ai..." functions that we could use, but I can't find that. Can you point me to where that is? Answer: See the 'AI API' links in assignment 6 webpage on prof. munoz website, for instance in the 'What is Stratagus' section. ===================================================================== Question: Where can we find a complete list of the commands used? Because there are several commands not documented in the online docs, like AiAttackWithForce, AiBestCityCenter and most of Ai* commands that refer to units like AiShooter. Answer: AiAttackForce should be documented in the Stratagus API doc, I guess the Stratagus engineers accidentally removed it. Thank you for pointing this out. Here is a description of the command. AiAttackWithForce: Attack the opponent with a force. The attack place is determined by the AI engine. force Number of the force to which the units should belong. 0 - 9 is currently supported. The force isn't moved as unit, faster units attacks first, than later the slower units will attack. Example ;; Force 1 is built with 5 footman. The script continues processing, if the ;; footmen are ready trained. Now attack the opponent with force 1. AiForce(1, {AiSoldier(), 5}) (AiWaitForce 1) AiAttackWithForce 1) The other ‘Ai’ commands can be found in ai.lua file in the ‘data.wargus\scripts’ directory. The only thing they do is, make sure that the AI can be properly executed for either race. ===================================================================== Question: What does AiPlayer return? You use it to reference an array and I am assuming this is to account for different player numbers 0-15, but it does not seem to effect anything. Answer: Yes, AiPlayer returns the player number (max 16 players in a single game). It does effect the script. As we know, all commands in a script are executed sequentially. Each AI player therefore will have to keep track of what commands it already has executed in a script. For example, take the custom_script.lua file. In the function AiCustomScript(), we see that the player number is used to increase the ai_custom_script_func variable. This variable keeps track of the current position in the script for a specific player. Note: this variable is an array of length 16 (equal to the max number of players in a game). Since there can be more AiPlayers using this specific script, each AiPlayer is updating its own counter. ===================================================================== Question: The structure for the current AI runs a list of commands in the main body and then runs the end body in a loop, repeating only the end body. This is only for convenience, correct? This structure is not needed for the game, it is just a way of running a "setup" and then a strategy. Answer: The end body in this setup is necessary. The AI would crash if it runs out of commands in the main body and has nothing to fall back on. The AI must fall back on some endless loop to continue playing the game. For instance take a look at the soldiers_rush.lua file. The continuos attacks are implemented in the end body. Since the end body is repeated, you don’t want to include commands such as 'building a lumber mill'. That would cause you to keep building lumber mills (which is stupid). Therefore, if you choose to use this setup, you have to make sure that your 'strategy' (building order, researches etc.) is taken care off in the main body. ===================================================================== Question: can we select any race? Answer: the races should not make a difference, but apparentely some of your classmates proved otherwise. That's why I am allowing you to choose your race. Please include in your script your desired race, however you can only choose one and this race will be tested against the 3 opponents. Hope this answers your question. =====================================================================