http://www.sleipnirstuff.com/forum/viewforum.php?f=36
[b]Basics of Generals AI system.
将军ai系统基础教程:[/b]
Generals AI is based on logic of predicates. The stone age AI in 21st century. I am really impressed. I didn’t expected it. What is the logic of predicates? It is a set of conditions and actions. Here is the example:
将军ai基于谓项逻辑学。21世纪的石器语言。我他妈已经出离愤怒了!什么叫做谓项逻辑语言呢?它是一系列条件和行动的组合。举个例子给你瞧瞧:
1. IF [game begins] THEN [build barracks]
2. IF [I have enough money] THEN [build an upgrade]
3. IF [my forces are attacking] THEN [launch superweapon] ELSE [build more units]
4. IF [enemy infantry is attacking me] THEN [set value=1] ELSE [set value=0]
5. IF [set value=1] THEN [order all overlords to build gattlings] ELSE [order all overlords to build propaganda towers]
1. IF [游戏开始] THEN [造兵营]
2. IF [我有足够的钱] THEN [升1个级!]
3. IF [我的部队被扁] THEN [给你尝尝超武!] ELSE [造更多单位]
4. IF [敌人的步兵虐待我] THEN [set value=1] ELSE [set value=0]
5. IF [set value=1] THEN [命令所有炎黄升加特林] ELSE [炎黄你他妈给我升宣传塔!]
The heap of such expressions is AI. With this architecture AI can not analyze things, can not learn, can not build new units, buildings and upgrades and can not do many other things. It can only follow instructions. This is lame.
使用这种表达方式的语言汇总起来就是ai。使用这种构架的ai不能分析事情,不能学习,不能建造新单位、建筑和相关升级,不能做太多其他的事情。它只能人云亦云,归根到底,它是个废物。
Where to find AI and how to open it.
从哪里找ai这个笨女人,怎么才能上它呢?
Each single player map have its scripts. If you want to edit single player AI then open the map you wish, click “Edit” -> “Scripts”. This will open dialog window where you can find AI and other stuff. Generals Challenge is generic set of single player maps. There is no difference if you edit single player or generals challenge AI. Maps are stored in maps.big and mapsZH.big files.
每张单人地图都有它的脚本。假如你想编辑单人模式的ai,就请打开你所希望打开的地图。然后”Edit” -> “Scripts”.这样可以打开对话窗口,在那里你能找到ai和其他玩艺。将军挑战模式和单人地图的修改类似,编辑将军挑战ai和单人或将军挑战模式ai。地图们都在maps.big and mapsZH.big里睡觉,fuck them!
Skirmish AI is located in Generals/Data/Scripts/SkirmishScripts.scb file. It is not packed. You do not need to extract it. To open follow instructions:
1. Run WorldBuilder.
2. Click “Edit” -> “Edit Player List’. Click “Add Skirmish Players”. Click “OK”.
3. Click “Edit” -> “Scripts’. Click “Import Scripts”. Find SkirmishScripts.scb and click “OK’.
4. Fix the bug.
There is the bug with importing skirmish scripts. Sides will be in wrong folders. You must open each folder in scripts dialog, drag its contents onto right folder and drop it there. Very hard work. There are hundreds of things must be draged and droped. But it must be done only once. When you will edit skirmish AI second time there will be no such bug.
You can fix it with your own hands or download fixed version from here:
http://sdi.origin-network.net/downl…mishScripts.zip
遭遇战ai就是Generals/Data/Scripts/SkirmishScripts.scb这厮,这下子没被打包,所以你不用提取它,根据下列指示直接做爱就行了:
1让地图编辑器跑起来,沿着操场裸奔!
2 单击”Edit” -> “Edit Player List’. 单击 “Add Skirmish Players”. 单击 “OK”.
3单击 “Edit” -> “Scripts’. 单击”Import Scripts”.找到 SkirmishScripts.scb and 单击 “OK’.
4. 修正bug
在遭遇战脚本里有十分严重的bug,每个将军的文件都放错了文件夹,你必须在脚本对话框里打开每个文件夹,把里面的内容拖到正确的文件夹里。真他妈是红军长征二万五千里!我日!要拖n个文件夹啊!fuck ea again and again!不过还好只要做一个就成,下次你和遭遇战ai做爱的时候就不需要戴避孕套了!
你能自己修正或者直接在这里下载:
http://sdi.origin-network.net/downloads/uploads/SkirmishScripts.zip
英雄,你早说会死啊!——jaffe注。
How to edit scripts.
Click “Edit” -> “Scripts” to open scripts window. Editing scripts allows you to manipulate with generals powers, upgrades and structures. Units are not here. They are in teams dialog. Folders are yellow. Scripts are cyan. Double click on script to open edit dialog.
如何编辑脚本
单击”Edit” -> “Scripts”打开脚本窗口。编辑脚本允许你操作将军技能,升级和建筑。单位的修改不在此列,它们在teams对话框。文件夹是黄色的,脚本是蓝绿色的。双击脚本打开编辑框。
Script Flags:
-Script is Subroutine (allows you to call this script from other ones)
-Script is Active (not active scripts never work)
-Deactivate upon success (run this script only once when its condition is succeeded and then make it inactive)
脚本标记。
脚本为子程序——允许你从另外的脚本里激活这个脚本。
脚本已激活——没激活的脚本从来不肯接客。
在成功之后进入睡眠状态——这个脚本只在条件符合的时候接一次客,然后它就从良了。
Active in:
-Easy
-Normal
-Hard
The list of difficultly levels in which the script is active.
这个脚本控制难度。
Evaluate script.
-Every frame
-Every X seconds
How often to run this script or how often to check its condition.
评估脚本
每帧
每隔n秒
间隔多少时间运行这个脚本,或者间隔多少时间检查运行它的条件。
Script Conditions. It is basic logic expression. You can add and remove its parts. If you want to run the script every time set conditions to “True”. Setting it to “False” will disable the script. There are hundreds of different conditions and its parts. Just click “New”, read and explore.
Actions if true. The set of actions computer must do if it gets “True” when calculates the logic expression. There are hundreds of different actions too. I will not explain all here. Look at other scripts, try to understand what they do and remember what actions do they use.
Actions if false. The set of actions computer must do if it gets “False” when calculates the logic expression.
脚本条件:基本的逻辑表达方式。你能部分的增加或删除它。假如你想每次运行脚本就把条件设为true,设为false将关闭脚本。有数百个不同的条件和组件。研究一下吧!
Actions if true. 如果逻辑表达方程运算结果为true,那么电脑必须运行这个行为,这里有数百个不同的行为,我不会在这里一一解释。看它们的脚本,努力理解他们会产生什么行为,并记住他们使用的行为。
Actions if false. 当逻辑表达方程运算结果为false,那么电脑不会运行这个行为。
Purpose of some folders in scripts:
“Sell Off” – Conditions when computer will sell everything and give up
“Paper work” – Initialization
“Build Conditions” – Building units
“Base Building” – Building structures
“Upgrades” – Building upgrades
“Attack Waves” – The wave is the team computer send to attack
“Generals Powers” – Use of purchasable super weapons (paradrop for example)
“Super Weapon Use” – Use of buildable super weapons (nuclear missile for example)
“Garrison Builds” – Build infantry to garrison neutral buildings
“Garrison Orders” – Order infantry to garrison neutral buildings
脚本中不同文件夹的作用:
“Sell Off” – 电脑卖家当投降的前提条件
“Paper work” – 初始化
“Build Conditions” – 造单位
“Base Building” -建造建筑物
“Upgrades” – 建筑升级
“Attack Waves” – 电脑的进攻波次
“Generals Powers” – 将军技(例如伞兵)
“Super Weapon Use” – 超武(例如核弹)
“Garrison Builds” – 造步兵守中立区
“Garrison Orders” – 造步兵守中立建筑
INI code also contain some pieces of AI. Data/INI/Default/AIData.ini contain sciences that computer will purchase. Data/INI/SpecialPower.ini contain super weapons use logic. For example if “Enum = SPECIAL_DAISY_CUTTER” in code then computer will drop this super weapon on enemy base. If “Enum = SPECIAL_CLUSTER_MINES” then computer will drop this super weapon on self base.
ini代码也包含一些ai内容,Data/INI/Default/AIData.ini包含电脑将军技列表,Data/INI/SpecialPower.ini包含超武使用逻辑。例如假如”Enum = SPECIAL_DAISY_CUTTER” 在代码里 电脑就会把超武投在敌人的基地里。假如”Enum = SPECIAL_CLUSTER_MINES” 电脑就会把超武仍在自己家里。
How to edit teams. 如何编辑进攻编队。
Click “Edit” -> “Edit Teams”. Select a side to see all its teams. Double click on a team opens edit dialog. If you want AI to build your unit then edit all teams and add that unit where needed.
单击 “Edit” -> “Edit Teams”. 选择一个将军看看它的出兵列表。双击一个子项打开对话框,假如你想让ai建造你想要的单位,编辑所有子项,增加所需要的单位。
Identify Tab:
“Condition” is script telling AI when to build the team.
“Priority”. If there are some conditions for different teams are succeeded then computer builds teams with higher priority.
There isn’t difficult to understand what other things do.
鉴定区:
条件:脚本告诉ai什么时候组建部队。
优先权:假如能够实现具有不同子项的条件,电脑将以更高的优先权建造部队
Reinforcement Tab:
Different stuff for transporting. (I do not know for what is this)
增强区
输送的不同材质
Behavior Tab:
Here you can tell the team what scripts to run in special cases. When just created, when idle, when enemy sighted and etc. Scripts must be subroutines.
行为区域
这里你将告诉子项在特殊的事件里什么脚本可以运行。什么时候创建,什么时候闲散,什么时候敌人看得见等等。脚本必须成为子程序。
Generic Tab:
Yet another place for scripts. Execute conditions must be inside them. Scripts must be subroutines too.
普通区
另一个放脚本的地方。执行条件必须包含在文件内部之内。脚本必须是子程序。
Purpose of some teams:
Teams with “Alert Invasion” in name is being built when computer base is under attack. For example the team named “USA Alert Invasion Tanks” is being built when enemy tanks are attacking computer base.
Teams with “Wave” in name computer will send to attack its enemy. For example the team named “USA 1st Wave Rush” is first computer attack. AI is lame can not attack at once with large groups like players do.
Teams with “Garrison P_ B_” in name are for garrisoning neutral buildings.
There are “China Bunker Team X” teams for garrisoning Chinese bunkers.
一些子项的作用:
“Alert Invasion”子项 将在电脑基地遭到进攻时建造。例如”USA Alert Invasion Tanks”子项将在敌人坦克进攻电脑基地时建造。
“Wave” 子项指电脑进攻波次。例如”USA 1st Wave Rush”是指电脑的第一次进攻。ai并不能像玩家一样立刻组织大规模的进攻。
How to save. 如何保存。
Click “Edit” -> “Scripts”. Click “Export Script(s)”. UNCHECK ALL. Check ‘Export All Scripts”. Then click ‘Ok”.
这段不翻,谁看不懂就送去上幼儿园……
How to test skirmish AI. 如何测试遭遇战ai
Warning!!! Before to run the game go to “My Documents/Command and Conquer Generals Zero Hour Data/” folder and delete file named “_tmpChunk.dat”. It its necessary.
Start the game. Choose Skirmish. Set one computer to be ally with you and another one to be your enemy. When the game starts sell your command center immediately. You will get defeat message but then you will become observer and can look at 2 computers fighting.
警告!在运行游戏前务必到”My Documents/Command and Conquer Generals Zero Hour Data/” 删除 “_tmpChunk.dat”文件。开始游戏,选一个盟国和一个敌国,进入游戏后卖掉主基地,然后看那两个笨电脑互相扭打。
More tutorials about AI are here: 更多的ai教程在这里:
http://sdi.origin-network.net/page.php?file=/tuts/list
AI editing forum is here: ai论坛在这里:
http://forums.origin-network.net/index.php?showforum=163
