glyphstrip FAQ button
Halo.bungie.org
glyphstrip
Frequently Asked Forum Questions
 Search the HBO News Archives

Any All Exact 
Search the Halo Updates DBs

Halo Halo2 
Search Older Posts on This Forum:
Posts on Current Forum | Archived Posts


AI Script
Posted By: scarabDate: 8/5/11 4:50 a.m.


I don't know if anyone has done this before but I transcribed the (Halo3?) AI/level-designer script code from the ViDoc.

Its not a language that I recognize. It looks like its hand rolled. Does anyone recognize the language? OMG its Lisp! Its been so long that I forgot. scarab, you're a dumbass! I'm so embarrassed that I'm tempted to not post this but if there are any lisp programmers reading then maybe you could dissect the script.

Can anyone quess the level? Is it firefight or campaign? There is a mention of docks. Is it the factory section where we fight the scarab?

The editor uses syntax highlighting - various parts are color coded by the editor.

I see:

  • purple for constants (or perhaps globals)

  • blue for reserved words and function names

  • green for function parameters


Constants are pieces of information that are given a value once and then never change.

Reserved words are words that are part of the programming language and you can't use them for the names of your own variables or functions. Examples in this script are:

  • if

  • begin

  • cond


Of course, since this is Lisp, I suspect that you can redefine them. (But you'd probably be mad to do so.)

There are 3 functions in this script:

  • wake (commented out)

  • ai_place

  • get_game_difficulty


A function is a self contained bit of code that you write once and then you can call it as many times as you want in the rest of your program. A good function does one simple (or easy to understand) task. An example from this script is ai_place which looks as if it spawns squads.

You can often pass extra pieces of information to the function so that it can operate on different things in different calls. For example in this script, ai_place takes a parameter that tells it which squad to place. We see various examples of this, just look at the calls to ai_place in the script below.

Note that ai_place isn't being told where to put the squads; that information must be stored in the squads themselves. The call could have taken two parameters for example: (ai_place sq_ss_squadname whereto_put_the_squad) but instead it just has (ai_place sq_ss_squadname) so these squads are quite complicated objects with lots of information in them (doh they are lists you fool).

I thought this language was kind of neat and I was going to have fun dissecting it and how it works. But now that I have recognized it as Lisp I realize that I just need to look it up online and read a gazillion tutorials.

I have one final comment/question about Lisp - why did they use parentheses? On my keyboard I have to hold down the shift key whilst typing ( or ). Why didn't the creators of List use [ and ]. It would save typing effort [yes I'm that lazy].

Anyway here is the script. Can you understand it? Work out which level its for?

 

; wake chapter title
; (wake chapter_blind)

;placing allies (pelicans and marines)
(ai_place sq_ss_johnsons_marines)

(if (<= (ai_living_count gr_marines) 1)
(ai_place sq_ss_dock_marines)
)

(ai_place sq_ss_pelican_01)
(ai_place sq_ss_pelican_02)

; place covenant
(ai_place sq_ss_cov_01)
(ai_place sq_ss_cov_02)
(ai_place sq_ss_cov_03)
(ai_place sq_ss_cov_04)

(if (>= (game_difficulty_get) heroic)
(begin
(cond
((<= (game_difficulty_get) normal) (ai_place sq_ss???))
((= (game_difficulty_get) heroic) (ai_place sq_ss_???))
((= (game_difficulty_get) legendary) (ai_place sq_ss_???))
)
(ai_place sq_ss_jackals_02)
(ai_place sq_ss_jackals_03)
(ai_place sq_ss_jackals_04)
(ai_place sq_ss_jackals_05)
)
)


Message Index




Replies:

AI Scriptscarab 8/5/11 4:50 a.m.
     Re: AI Scriptscarab 8/5/11 5:00 a.m.
           Fixed: AI Scriptscarab 8/5/11 5:26 a.m.
                 Re: Fixed: AI ScriptMoorpheusl9 8/5/11 6:07 a.m.
                       Re: Fixed: AI Scriptscarab 8/5/11 7:20 a.m.
                 Should've used Python *NM*JDQuackers 8/5/11 7:30 a.m.
     Re: AI ScriptGeneral Vagueness 8/5/11 12:30 p.m.
     HaloScriptkornman00 8/5/11 3:17 p.m.
           Re: HaloScriptscarab 8/7/11 9:06 a.m.
     Re: AI Scriptdmiller 8/7/11 1:17 a.m.
           Re: AI Scriptscarab 8/7/11 8:54 a.m.
                 Re: AI Scriptdmiller 8/7/11 9:29 a.m.
                       Re: AI ScriptMoorpheusl9 8/7/11 9:33 a.m.
                             Re: AI Scriptdmiller 8/7/11 9:35 a.m.
                       Re: AI Scriptscarab 8/7/11 10:12 a.m.
                             Re: AI ScriptZackDark 8/7/11 2:40 p.m.
                             Re: AI Scriptdmiller 8/7/11 5:02 p.m.
                                   Re: AI ScriptLouis Wu 8/7/11 5:15 p.m.
                                         Re: AI Scriptdmiller 8/7/11 5:23 p.m.
                                               Re: AI Scriptscarab 8/8/11 3:34 p.m.
                                                     Re: AI Scriptdmiller 8/8/11 9:51 p.m.
                                                     Re: AI ScriptJonnyOThan 8/11/11 12:42 p.m.
                                                           Re: AI Scriptscarab 8/11/11 4:32 p.m.
                                                                 Re: AI Scriptdmiller 8/13/11 2:21 p.m.
                                                                       Re: AI Scriptscarab 8/13/11 5:27 p.m.
                                   Re: AI ScriptRC Master 8/7/11 7:41 p.m.
                                         Re: AI ScriptZackDark 8/7/11 8:30 p.m.
                                               Re: AI ScriptGeneral Vagueness 8/7/11 8:36 p.m.
                                                     Re: AI ScriptZackDark 8/7/11 8:42 p.m.
                                         Re: AI Scriptdmiller 8/7/11 8:57 p.m.
                                               Re: AI ScriptHyokin 8/7/11 9:21 p.m.
                                                     Re: AI Scriptdmiller 8/7/11 11:03 p.m.
                                                           Re: AI ScriptZackDark 8/7/11 11:19 p.m.
                                                                 Re: AI Scriptdmiller 8/7/11 11:23 p.m.
                                                           Re: AI ScriptHyokin 8/7/11 11:20 p.m.
                                                                 Re: AI ScriptZackDark 8/7/11 11:22 p.m.
                                                                       Re: AI Scriptdmiller 8/7/11 11:26 p.m.
                                                                             Re: AI ScriptZackDark 8/7/11 11:27 p.m.
                                                                                   Welcome to the forums, Dan!Hyokin 8/7/11 11:34 p.m.
                                                                 Re: AI Scriptdmiller 8/7/11 11:44 p.m.
                                                                       Re: AI Scriptdmiller 8/7/11 11:45 p.m.
                                                                             Re: AI ScriptRC Master 8/8/11 7:10 a.m.
                                                                       Re: AI ScriptAvateur 8/7/11 11:50 p.m.
                                                                             Re: AI ScriptHyokin 8/7/11 11:57 p.m.
                                                                                   Re: AI Scriptdmiller 8/8/11 1:17 a.m.
                                                                                         Re: AI ScriptSonofMacPhisto 8/8/11 6:11 p.m.
                                                                                               Re: AI Scriptdmiller 8/8/11 9:54 p.m.
                                                                                                     Seriously dude, you're awesome *NM*ZackDark 8/8/11 10:46 p.m.
                                                                       Re: AI ScriptZackDark 8/7/11 11:50 p.m.
                                                                       Re: AI ScriptLeviathan 8/8/11 12:11 a.m.
                                                                             I also share this question *NM*ZackDark 8/8/11 12:13 a.m.
                                                                             Re: AI Scriptdmiller 8/8/11 1:21 a.m.
                                                                       Re: AI ScriptGeneral Vagueness 8/8/11 1:34 p.m.
                                                           Re: AI ScriptFyreWulff 8/8/11 12:41 a.m.
                                                                 Re: AI Scriptdmiller 8/8/11 10:54 a.m.
                                                                       Re: AI Scriptbluerunner 8/8/11 11:04 a.m.
                                                                             Re: AI Scriptdmiller 8/8/11 8:54 p.m.
                                                                                   Re: AI ScriptFyreWulff 8/9/11 4:56 p.m.
                                                                       Re: AI ScriptHyokin 8/8/11 11:09 a.m.
                                                                       Re: AI ScriptRC Master 8/8/11 1:40 p.m.
                                                                       Re: Thanks.Joe Duplessie (SNIPE 316) 8/8/11 2:44 p.m.
                                                                             Re: Thanks.General Vagueness 8/8/11 5:25 p.m.
                                                                                   x3 thanks for awesomeSonofMacPhisto 8/8/11 6:06 p.m.
                                                           Combat sandbox and mission designGhaleonEB 8/8/11 1:10 a.m.
                                                                 Re: Combat sandbox and mission designdmiller 8/8/11 1:26 a.m.
                                                                       Re: Combat sandbox and mission designdmiller 8/8/11 1:29 a.m.
                                                           Re: AI ScriptLord Friendship 8/8/11 12:33 p.m.
                                                                 Re: AI Scriptdmiller 8/8/11 8:55 p.m.
                                                           Re: AI ScriptGravemind 8/8/11 3:29 p.m.
                                                                 Re: AI Scriptscarab 8/8/11 3:49 p.m.
                                                                 Re: AI ScriptLurono 8/8/11 6:52 p.m.
                                                                       Re: AI ScriptSonofMacPhisto 8/8/11 7:00 p.m.
                                                                             Yes to both *NM*Lurono 8/8/11 7:15 p.m.
                                                                                   Ok, I'm not nuts. Well, I am... but... n/m :) *NM*SonofMacPhisto 8/8/11 7:22 p.m.
                                                                 Re: AI Scriptdmiller 8/8/11 9:42 p.m.
                                                                       Re: AI ScriptRC Master 8/9/11 9:34 a.m.
                                                                             Re: AI Scriptdmiller 8/9/11 9:47 p.m.
                                                                                   Re: AI ScriptJonnyOThan 8/10/11 3:27 p.m.
                                                                                         Re: AI ScriptRC Master 8/10/11 7:21 p.m.
                                                                                               Re: AI ScriptZackDark 8/10/11 10:37 p.m.
                                                                                                     Re: AI ScriptHyokin 8/10/11 11:36 p.m.
                                                                                                           Re: AI ScriptZackDark 8/10/11 11:59 p.m.
                                                                                                     Re: AI ScriptRC Master 8/11/11 8:30 p.m.
                                                                                                           343i, hire him too! *NM*Hyokin 8/11/11 10:02 p.m.
                                                                                                                 Re: 343i, hire him too!RC Master 8/13/11 10:34 a.m.
                                                                                                           Re: AI ScriptZackDark 8/11/11 11:02 p.m.
                                                                                                                 Re: AI ScriptRC Master 8/12/11 7:28 a.m.
                                                                                                                       Re: AI ScriptZackDark 8/12/11 6:26 p.m.
                                                                                                                             Re: AI Scriptdmiller 8/13/11 2:39 p.m.
                                                           Re: AI ScriptFyreWulff 8/9/11 5:23 p.m.
                                                                 Re: AI ScriptLurono 8/9/11 8:07 p.m.
                                                                       The worst kind *NM*scarab 8/10/11 1:03 a.m.
                                                                 And a serious answer...Lurono 8/9/11 8:13 p.m.
                                                                 Re: AI Scriptdmiller 8/9/11 9:39 p.m.
                                                                       Re: AI ScriptZackDark 8/9/11 10:37 p.m.
                                                                             Re: AI Scriptdmiller 8/9/11 10:41 p.m.
                                                                                   Re: AI ScriptZackDark 8/9/11 10:45 p.m.
                                                                                   Re: AI Scriptdmiller 8/9/11 10:47 p.m.
                                                                                         Re: AI ScriptZackDark 8/9/11 10:52 p.m.
                                                                                               Re: AI Scriptdmiller 8/9/11 11:13 p.m.
                                                                                                     Re: AI Scriptscarab 8/10/11 1:28 a.m.
                                                                                                           Re: AI Scriptdmiller 8/10/11 9:18 a.m.
                                                                                                                 Re: AI Scriptscarab 8/11/11 4:49 a.m.
                                                                                                                       Re: AI Scriptdmiller 8/11/11 9:49 a.m.
                                                                                                                 Re: AI ScriptDagoonite 8/11/11 10:31 a.m.
                                                                                                     Re: AI ScriptRC Master 8/11/11 11:41 a.m.
                                                                                                           Re: AI Scriptdmiller 8/12/11 1:20 a.m.
                                                                                                                 Re: AI ScriptRC Master 8/12/11 7:05 p.m.
                                                                                                                 Re: AI Script (ooh! Question!)RC Master 8/13/11 5:52 a.m.
                                                                                                                       Re: AI Script (ooh! Question!)dmiller 8/13/11 2:28 p.m.
                                                                                                                             Re: AI Script (ooh! Question!)dmiller 8/13/11 2:34 p.m.
                                                                                                                             Re: AI Script (ooh! Question!)RC Master 8/13/11 8:37 p.m.
                                                           Re: AI ScriptGeneral Vagueness 8/9/11 11:38 p.m.
                                                                 Re: AI Scriptmrbig 8/10/11 12:50 a.m.
                                                                       Re: AI Scriptdmiller 8/10/11 9:11 a.m.
                                         Aww crapRC Master 8/8/11 7:22 a.m.



contact us

The HBO Forum Archive is maintained with WebBBS 4.33.