- Joined
- May 10, 2007
- Messages
- 60
Documentation of what functions and objects do and do not work in AI
Documentation of which races are and are not assignable by the game
Documentation of how units and equivalencies are counted by different JASS Functions
9 months ago, I started this project... then 2 months later I stopped... then 2.5 months later I started again... then 2 months later I stopped again...
Now, 2.5 months later... I am not sure if I will pick it up again so there is even less of a reason for me not to share it on here.
Hive Workshop, I present to you...
AI scripting but with custom stats for units but with minimal use of the object editor and map triggers
Looks like you spent 10 minutes in a hex editor converting non-hero units into units
No proper names defined in the object editor.
"You just set them with triggers" I hear you say, but if we go into the trigger editor:
Oh, would you look at that. Nothing there, except... an AI script? And if we go to imports...
99 Kilobytes??? That's right, mofos, I have 2483 lines of JASS in my AI Script.
WHY?!
How, you ask? It starts, as I mentioned, 9 months ago when I realized that common.ai (the library of native functions for the AI engine) used some functions from common.j (the library of native functions for the trigger engine), which prompted me to start experimenting with which functions worked and what could be done with it.
My first idea was to create an interface to allow the AI engine to send commands back to the trigger engine. The latter has the CommandAI function for relaying messages to the former, but it can only send pairs of integer values, and the AI engine does not have a way to send messages back. My solution was to have the AI engine create a unit to serve as an "interface". The trigger engine can hook this unit because it sends an entering unit-signal when spawned. From there, both engines can communicate back and forth, and more importantly send lots more data at a time, as a unit can contain two locations (unit's current location and its rally point), a widget (by rally point), a string (its name), reals (hit points, mana, armor, attack cooldown, acquisition range...), integers (ability levels, custom values, damage values...) and probably more.
Because I am one of those kinds of people, I instantly knew what I wanted to do with it.
However, due to issues with testing and too many things not working (most functions with strings corrupt them, converting anything to a string crashes the game), I started over. Rather than focusing on creating new factions whole cloth, I would first recreate an existing faction and its AI, and then this could be slowly converted into a wholly new faction.
Not how, why?!
Oh right, well, I also realized I had tricked myself into doing Distributed Systems even though I did not enjoy that course, so I opted to try to do as little communication with the map as possible, and not use an interface. This would also make it easier to reuse the script on different maps, because it would require less setup with triggers from the map's side.
However, AI scripts generally NEVER refer to units directly, and one of the things that are totally non-functional in the AI engine are triggers. So the only way to effectively access units' handle is for the AI script itself to create it. This also means the script ends up having to keep track of all the units and buildings explicitly. Because the target locations of build orders cannot be accessed, and a building being constructed can't be accessed, the script also has to recreate building planning and construction. It maintains multiple arrays for these stages of buildings for this purpose. Because I wanted to be able to use the same unit type for multiple "unit types", unit counting was also recreated in the script. Oh yeah, and I recreated the Dungeon Keeper naming system for fun once I moved to testing with Hero Units.
No, why did you do all this instead of just using the object editor???
Oh right, uh:
Mostly because right now, the Orc AI ends up building like 5 Voodoo Lounges as if it is not keeping track of how many are already under construction but it's the only building it happens with and I dunno why. I am considering rewriting from scratch again and maybe come up with a way to track it better? But yeah.
Also no idea if this works on Reforged, I am on 1.30b or smthing
Documentation of which races are and are not assignable by the game
Documentation of how units and equivalencies are counted by different JASS Functions
9 months ago, I started this project... then 2 months later I stopped... then 2.5 months later I started again... then 2 months later I stopped again...
Now, 2.5 months later... I am not sure if I will pick it up again so there is even less of a reason for me not to share it on here.
Hive Workshop, I present to you...
AI scripting but with custom stats for units but with minimal use of the object editor and map triggers
Looks like you spent 10 minutes in a hex editor converting non-hero units into units
No proper names defined in the object editor.
"You just set them with triggers" I hear you say, but if we go into the trigger editor:
Oh, would you look at that. Nothing there, except... an AI script? And if we go to imports...
99 Kilobytes??? That's right, mofos, I have 2483 lines of JASS in my AI Script.
WHY?!
How, you ask? It starts, as I mentioned, 9 months ago when I realized that common.ai (the library of native functions for the AI engine) used some functions from common.j (the library of native functions for the trigger engine), which prompted me to start experimenting with which functions worked and what could be done with it.
My first idea was to create an interface to allow the AI engine to send commands back to the trigger engine. The latter has the CommandAI function for relaying messages to the former, but it can only send pairs of integer values, and the AI engine does not have a way to send messages back. My solution was to have the AI engine create a unit to serve as an "interface". The trigger engine can hook this unit because it sends an entering unit-signal when spawned. From there, both engines can communicate back and forth, and more importantly send lots more data at a time, as a unit can contain two locations (unit's current location and its rally point), a widget (by rally point), a string (its name), reals (hit points, mana, armor, attack cooldown, acquisition range...), integers (ability levels, custom values, damage values...) and probably more.
Because I am one of those kinds of people, I instantly knew what I wanted to do with it.
However, due to issues with testing and too many things not working (most functions with strings corrupt them, converting anything to a string crashes the game), I started over. Rather than focusing on creating new factions whole cloth, I would first recreate an existing faction and its AI, and then this could be slowly converted into a wholly new faction.
Not how, why?!
Oh right, well, I also realized I had tricked myself into doing Distributed Systems even though I did not enjoy that course, so I opted to try to do as little communication with the map as possible, and not use an interface. This would also make it easier to reuse the script on different maps, because it would require less setup with triggers from the map's side.
However, AI scripts generally NEVER refer to units directly, and one of the things that are totally non-functional in the AI engine are triggers. So the only way to effectively access units' handle is for the AI script itself to create it. This also means the script ends up having to keep track of all the units and buildings explicitly. Because the target locations of build orders cannot be accessed, and a building being constructed can't be accessed, the script also has to recreate building planning and construction. It maintains multiple arrays for these stages of buildings for this purpose. Because I wanted to be able to use the same unit type for multiple "unit types", unit counting was also recreated in the script. Oh yeah, and I recreated the Dungeon Keeper naming system for fun once I moved to testing with Hero Units.
No, why did you do all this instead of just using the object editor???
Oh right, uh:
- Autism
- Desperately wanting to prove to myself that I am not a script kiddie
- Genuine interest in finding out what could and couldn't be done with JASS in an AI script
- Previous attempts to create custom factions had me lose interest due to having to set up the techtree from scratch in the object editor
Mostly because right now, the Orc AI ends up building like 5 Voodoo Lounges as if it is not keeping track of how many are already under construction but it's the only building it happens with and I dunno why. I am considering rewriting from scratch again and maybe come up with a way to track it better? But yeah.
Also no idea if this works on Reforged, I am on 1.30b or smthing
Attachments
Last edited:
