Saturday, April 23, 2011

Spore: Outsourcing May Be Necessary

Act 3 of the Diablo Spore project is underway.

Kurast Docks

This time around, I've been organized. I laid out the quest plan, recognized the actors and made notes on each.  The notes include what they kind of look like, what their scripts are and any other attribute I want to keep in mind. I actually started writing everything down, not to be organized, but to get my ideas down before I forgot them. I definitely forgot some ideas in the previous acts that came back to me after I completed the adventure.

Since the ideas are all laid out, I just have to build everything.  Putting all the pieces together on the planet is fun. The challenges include spacing, debugging (or deglitching in Spore's case), adjusting flow and other level design aspects. The other building part is creating all the actors (the buildings, creatures, items, etc.). This part is fun, but not as fun as the former creative aspect nor is it the aspect that I want practice. Unfortunately, the latter takes up much more time. Since I already have everything planned, it's painfully obvious how much actor building I have to grind through.

How do I find another's creation that embodie Hratli?
I could use other Spore creators' creations, but how do you find a suitable model for Hratli or Ormus' temple? I've been considering finding someone who might be interested in just pumping out the models, but I have my doubts anyone would be that interested.

Saturday, April 9, 2011

Minecraft: Castle Fort Tour

Earlier, I showed you the framework of a castle.  In an attempt to tie up some lose ends, I've gone back and added a fair amount of detail.  It's no longer some ugly organized stack of cobblestone.


The details actually took a day to put together.  Filling up the moat, picking flowers and acquiring dye for the tapestries were the most time consuming tasks.  Getting the central parts of water to a level height required building temporary pillars to dump water springs around.  For the dye, I needed to spawn a new terrain block, since the current world was generated prior to the patch that included dye. I then set up a temporary base to dig for lapis ore.  Finally, those red flowers to place in the garden and colour the curtains actually required a little stroll. Did I mention I also needed to throw the colours on the sheep to beat the coloured wool out of them?


Another loose end finished up!

Sims 3: Komodo Urbania

Awhile ago I put 99% of a Sims 3 lot together...and forgot about it.  I just came back and fixed it up.

I purposely chose a small lot to keep my goal feasible. I also wanted to try something a little more Miami and a little less Northern.  I present Komodo Urbania...


It basically turned into a one-man spy home.  

I really enjoyed making the jungle like garden and fountain.  Even though it's a cubic home, I honestly think the exterior looks pretty sweet. Faux natural never looked so good.  

There is a rooftop pool, but I must admit, it makes the floor below look ugly.  You can see in the video that the pool wall texture couldn't be painted over.  I came up with the idea of the rooftop pool from just testing the limitations of the tools.  Sometimes just learning your tools bares new ideas.  The same thing happened when I went to see if the secret doors could be painted over.  Now the cellar is accessed via a push wall.  Best protect that liquor.

I might actually do more lots for the Sims 3, the tool is pretty powerful.


Friday, April 8, 2011

Setting up Navigation: A Couple Lessons Learned

While building 'The Sightless Eye' for Spore, I had the goals of not enforcing certain play styles (ex. combat only) and building the planet the way I think it would naturally set itself up.  These both contributed to difficult and boring navigation for the player.

To allow various play styles, I kept the objectives as simple as possible.  For example, instead of requiring a player to "Enter the Cave" and "Kill the Shamen", I just required the player to "Kill the Shamen" and let the going to the cave part be implied.  However, since the mini map only pointed to the actual shamen if "Enter the Cave" wasn't an objective, it makes it difficult to find the cave entrance.  If the player goes off the implied path, they might spend a long time just circling the mountain that envelopes the cave.

The mountains block direct access to the objective, so a player may have to circle most of them if they don't find the entrance right away.
A place that sets itself up naturally tends to spread out more than a conceived setting.  Two towns wouldn't naturally be a stone's throw from each other.  Placing towns and objectives a distance apart in Spore wouldn't be so bad if the mini-map objective pointer wasn't so terrible. Because it portrays an actual (relatively small) sphere, instead of the usual 2D plane, it doesn't account well for the bends, especially at the poles.  The pointer will generally guide you at an arced path to the objective.  Long walks made longer make for boring sessions of just holding 'w'.

Notice the mini-map pointer points perpendicular to the shortest path (the white arrows) thanks to imposing a 3D plane on a 2D graphic.

The navigation flow of a 'natural' setting.
Since I realized this near the end of making the adventure, I tried to rectify it by placing big giant arrows that pointed in the right direction. Sadly, I was already near the complexity maximum, so I couldn't add many arrows, and the ones I did were only useful if you were already on the right path.

The lone arrow tells you to just go through
the bush and hope for the best.
Better arrow placement through town to a followable road..
For "The Secret of the Vizjerei" I made less wilderness paths (more actual pathways), compacted the objective locales and placed more effective arrows.  Overall, this worked without compromising the feel of the adventure. Sure, if you thought about it, those abandoned ruins are awfully close to town, but the suspension of disbelief covers that.  Adding actual paths also added more detail to the map.  The treks between objectives are better paced and more enjoyable in the second adventure.

The navigation flow of a 'conceived' setting.  Also note the use of pathways between locales.
I still want to do a better job at incorporating direction into dialogue, but I've taken some good lessons from building the first adventure applied them to the second.

Monday, April 4, 2011

Spore: Diabloesque Act 1 & 2

I've just finished up Act 2 for the Spore version of Diablo. I've taken quite a few lessons from creating Act 1 and applied them to Act 2.  I think Act 2 is a bit easier, with prettier scenery, and much less walking.











Be sure to check them out and don't forget to leave some feedback! I also hope to have a short blog about my lessons in walking distance and player navigation posted on Wednesday.

Saturday, January 29, 2011

Age of Empires 2: Startup Tutorial to AI Scripting - Part 2 of 2

Continued from Part 1

Advanced Script
Lets take the previous script and beef it up to demonstrate a couple more concepts. This time around, the script will build a small army of men-at-arms and attack an opponent.

Once again, due to formatting and length reasons I've uploaded the script file.  Just download it and open it with your text editor.

Now we're scripting!
Advanced but Important
If you look through the script you'll notice I added a wild-card parameter, some constants, some not-so-obvious facts and actions, a couple important strategic numbers and a goal.

Wild-card Parameter
If you look at the rule that trains the military unit, you'll notice that instead of "militiaman" or "man-at-arms", it trains a "militiaman-line". This wild-card parameter trains any of the unit-types that can be upgraded from a militiaman. This kind of parameter helps save rules by allowing you to not have to add redundant rules for training militiamen, men-at-arms, long-swordsmen, etc.

Constants
At the beginning of the script, I added a few constants to make my script easier to read and edit. A constant allows me to substitute a value with a name.

(defconst [name] [value] )

This means that after this constant declaration, you can put the name instead of the value in rules. Constants are best used if you plan on using the same value in many rules, but may need to change the value when adjusting your code in the future. Instead of changing all the values in each rule, you can just change the value in the constant declaration.

'True' and 'Disable-self'
The fact 'true' is useful for setting up strategic-numbers and goals to your preferred default values. If 'true' is the only fact, then the rule is always run.

The action 'disable-self' allows you to run a rule one-time and then never again. It is useful for turning off a rule with 'true' as a fact, like the advanced example script shows for setting the initial value of goal 1.

Builder Distribution
Just note that 'sn-percent-civilian-builders' and its sister number, 'sn-cap-civilian-builders' should be set to 100 if you want your 'build' actions to happen immediately. If you ran the first script, you may have noticed that villagers did not build a building the moment the facts were true. This is because the 'build' action actually puts the building action in a queue and only once a villager is free does the villager build.

The strategic number 'sn-initial-exploration-required is also usually set to '0' if you want your villagers to begin building as soon as the map starts.

Stop gathering and build me a house, dammit!
Goals
The most important concept I added to the new script was a goal. These are the user controlled variables of Age of Empires AI scripting. In the above example I used goal 1 to indicate whether the script should build an army (value of 1) or not (value of 0). Just to note, the line "(goal 1 0)" is read as "goal 1 is set to 0". Sadly, you can't make more broad comparisons than this using '>' or '<'.

While I didn't use a constant to replace '1' in the above example, it is common practice to do so. For example, I could have used the term 'build_army' to indicate goal 1 with the following:

(defconst build_army 1)


(defrule
(true)
=>
(set-goal build_army 0)
(disable-self)
)

You can have 70 goals (1 through 70) and the value of goals can range from -32000 to 32000.

Processing Your Script
Okay, hopefully you now have an idea of what an AI script looks like. It's time to mention a few details of how exactly the game processes your script and some of the implications.

Rule OrderThe game frequently runs a pass on your script from top to bottom. This means that your first rule will always be read before your second rule. Which in turn means that the following two scripts will yield different results:

Script 1
(defrule
(can-train archer-line)
=>
(train archer-line)
)


(defrule
(can-train skirmisher-line)
=>
(train skirmisher-line)
)


Script 2
(defrule
(can-train skirmisher-line)
=>
(train skirmisher-line)
)


(defrule
(can-train archer-line)
=>
(train archer-line)
)

The first script will try to train an archer in an archery range before a skirmisher and the second will do the opposite.

The 'can-build' Rule
A script can only attempt one 'build x' action through a single pass of the script.  This means that using the 'build x' rule when the AI doesn't have resources or space to build 'x' will cause all the following 'build x' rules to not run.  To prevent this, make sure you always use the 'can-build x' fact in rules using the 'build x' action.  You don't need to use 'can-train x' and 'can-research x', but they are useful if you have actions other than 'train x' or 'research x' in the rule.

Wrap Up
I hope that you now have the knowledge to produce an AI script or at least take an existing script and play around with it. Remember, this guide was meant to get you as far as making a functioning AI. There are still many topics that are left untouched here that need to be learned before you can produce a full-scale AI. At the end of this article, I've left some notes on important further reading. Still, your best resources are the AOKH forums and the AIScripters forums. Thank you for reading and best of luck with your AoE projects.

Further Reading
Town Size Attack (TSA) - TOAO_DaVe's Guide
Walls - see "enable-wall-placement" in CPSB
Load Statements - see "Load Command" and "Conditional Statements" in CPSB
Escrow - Scripter64's Guide