Archive for the 'AI' Category

For a brief window after the release of 0.76b2 there was a compatible NTai being built by buildbot that everyone could have used. Despite the window lasting 4-5 days nobody bothered except me, and it is now too late to find svn versions of NTai that still work with the current release of spring.

But have no fear! I have repackaged NTai with the downloaded bianry for windows, along with toolkit and all the configuration files necessary.

You can find it here:

Download NTai for 0.76b1

I’m releasing an svn build of NTai XE9.8+ for people wanting to use P.U.R.E in skirmish mode, and for general testing. Included is an updated NTai Toolkit. This will not work with 0.75b2.

How to install:

  1. Extract the AI folder and overwrite the AI folder in your svn spring install
  2. Select NTai.dll when choosing an AI
  3. Play a P.U.R.E game.

An NTai toolkit is sitting in the AI folder as well, and DJ’s updated BA config has been included.

Download it here
Get P.U.R.E here

I’ve been cleaning up and fixing NTai ready for applying for my placement year. I’ve started moving things around making everything work with common sense, and undoing a lot of foobarred stuff I coded half asleep.

Read the rest of this entry »

I keep getting asked “where do I download the latest xyz?”

And I say it isnt quite that simple. So Ill explain how and why in 2 sections:

AFLobby

This is one of the easiest. Look in the big aflobby thread in the linux forum on the main spring forums, and it’ll have the latest official build in the header. Look in the first post or look at the last post and work backwards.

If you manage to get aflobby running and start it up, it’ll automatically check my website to see if there are any newer versions and popup a window with a changelog and a download link.

If you wan’t the very latest bleeding edge version or a version with a bugfix for a newly found bug or a small feature request, you may find a newer development version in the channel topic of #aflobby once you’ve logged in, or you can directly ask me. I have my build setup to automatically zip up aflobby ready to be handed out everytime I compile new code, and generating installers is very easy for me. Just don’t ask everyday.

If you want to stay at the very very latest aflobby with all the fancy new features, you can find aflobby in /trunk/lobbies/aflobby/ as a netbeans 6 project in the spring SVN. You can find links to the spring SVN in a sticky in their development forum.

NTai

This is where things might get problematic. Latest NTai hasnt been stable in a long time. I learnt a lot of stuff doing NTai and with age its become bloated in the code at times. That combined with a long run of bad luck with compilers and profiling tools means that there’re crashbugs and a longrunning lag issue that creeps in. The source of the latter issue has yet to be identified.

So while I’m rewritting and refactoring old code to try and keep things as tidy as possible to help squash bugs and improve the code readability, time has ticked by and the old user base is wondering where NTai has gone?

If you really need NTai you can find it in the spring svn in /trunk/AI/Global/NTai/AI/ where there should be a Visual Studio 2005 project and a codeblocks project. They may need minor modifications to make them work (the pure svn versions are specific to my system in one or two minor values). If you can’t compile yourself you’re best asking me for a copy personally however I doubt that anything I give you will actually work atm as it is probably a highly experimental build I haven’t finished fiddling with yet.

Alternatively you can look in my 700+ page NTai thread on the spring forums in the AI section, but I dont post binaries regularly so don’t rely on anything.

If you aren’t going to develop with NTai and your just a player who wan’ts an AI then you won’t find anything. When NTai becomes stable and the lag bug is squished Ill gather up all the configs and release an installer, and that’s when everyone can go hooray NTai! But untill then the average user has little business messing with NTai unless they want to learn the tricks of the trade and have an active interest.

Everything else

You’re likely to find it on Unknown-files, a file hosting site ran by iamacup. http://spring.unknown-files.net

Antistall is problematic. In order to prevent an AIs economy hitting rock bottom through overspending, or wasting resources by not spending enough and maxing out storage, antistallguides an AIs behaviour by saying what it can and can’t afford.

So what was the problem?

In theory the NTai algorithm is a perfect model of spring economics. However spring economics does not follow the intended model, and as such the antistall algorithm works better under OTA than spring, for the same reason people like argh complain springs economics are fundamentally flawed.

As a result the anti stall algorithm anticipates a cost and declares a unit too expensive, but in reality the fixed unit costs that are necessary may not be deductable because all the resources have already been suedfor construction costs, resulting in free resources. Thus the antistall algorithm is deemed to strict and the user complains, and the AI suffers from the flaw.

What was done about it?

To combat this new tags were introduced, to weight the antistall algorithm to be too strict, or too lenient, in order to find a compromise. But this lead to a no win situation where the optimum tag value lead to ok behaviour at the price of random fluctuations, creating decisions that were both too lenient, and too strict, all in the same game.

To deal with this there, were 2 avenues.

  1. Predict the cost, based on the past and extrapolate the future economic conditions based on the current direction,then weighted by the cost of the potential construction project being evaluated.
  2. Add other systems to catch the stall event and increase economic competency at a common sense level, that did not work on the basis of anticipating the future costs and filtering items that can’t be afforded.

Since a predictive algorithm would be imperfect and would need to be re-evaluated or suffer from unforeseen circumstances such as a unit thatwas reclaiming suddenly stopping and repairing an existing building turning an income into a cost and throwing off the predictions, I decided to take route 2.

To do route 2 I created b_rule, which fitted in with user demand at the time, which complained NTai had no intelligence like AAI or OTAI, and wouldn’t rebuild energy if its energy was destroyed. It made sense, as it made NTai more adaptive.

However it wasn’t enough so b_rule_extreme and the carry versions where introduced. This keyword acted like b_rule but only did so in extreme situations in order to prevent metal leakage or complete nanostall.

So if energy was below a certain set of parameters it would start building energy, or if energy was abundant but metal was not it would choose metal makers, if both resources where nearing the upper storage limit and had big surplus generation it’d build storage, or factories. And if the economy was stable it would just return. That way you could put in lots and lots of the keyword and it would act as a safety net. So much so interpolation was introduced to insert the keyword between every other keyword in tasklists.

An extra 2 keywords were added, b_rule_extreme_nofact, and b_rule_extreme_carry. The first did not build factories and the latter keeps repeating over and over again untill the economy has left the danger zone and re stabilized (aka when it reaches the point where the rules say it should skip it stops repeating and moves to the next task).

This is also where the build algorithm rule values in toolkit come from, the ones in the big 2 columns of text boxes. The values plug directly into the if statements controlling the b_rule mechanisms.

So what did the other AIs do?

Faced with the same problems the other AIs took various routes. Most AIs did not bother at all to handle the issue or simply didn’t get far enough for it to really matter.

AAI initially took the same route as me and had a simple antistall algorithm to nudge its economy in the right direction. However submarine ran into flaws and issues, and the algorithm despite being very simple, crippled AAI, and so it was commented out.

KAI on the other hand took the predictive route. Despite the large effort put into its economy manager classes, it still suffers from issues of either being too strict or too lenient.

Its for these reasons that I personally reccomend that users do not turn on the anti-stall algorithm in their configs. That doesn’t mean that an experienced config builder can’t fiddle around the values to encourage the optimum behavior with it, or that there aren’t alternative tools for preventing nanostall in NTai economics.