Friday 26 December 2014

Development Blog #0005 - Exploration and WLNewmanBrainBasic

I spent this week upgrading the AI in Wool, this Rust simulator.


Recap

Last week we saw a video of newmans building bases, and ignoring each other.  They would move randomly until they happened across a resource, and subsequently gather it.  After gathering enough wood for a base, they would spend about 60s of simulated time building their wood shack, then set out again for more resources.  When enough had been gathered for wood weapons, wood armor (aka burlap), and wood tools, they would head straight back to their base, and craft it.  This was repeated until they had built T2, and a bugg kicked in and prevented them from moving on to T3 (metal base & accessories).

This Week

It was a rushed job to get base building included in last week's blog post.  Clearly, the AI needed some tender love and care.  Newmans now craft bases and accessories up to and including T3 (metal).  They now attack each other if it is worth the risk.  They respawn at their own base if they die, or respawn on the beach if they are homeless.

Improvements
After debugging last week's code, I started on improvements.  I created an exploration system.  So, instead of newmans randomly moving and bumping into resources, newmans look around in a 100m radius, and move toward their desired resource.  Pretty simple improvement, but newmans were immediately devouring the forests as soon as the game started -- which is great.  A lot of combat happens in the precious first hour, and it is cool to watch.
But then I did better.  Instead of moving randomly until a desired resource is spotted, a newman will systematically explore a region of the map.  The region is either the area immediately around them, or the area around their base.  This improvement caused newmans to actively search the map in pursuit of their desires.  It's a huge milestone because it marks the end of random movement.  That is, every decision became deliberate.  The newmans got scary powerful.

Issues
There was a minor issue with this though, as often one would see many newmans headed to the same invisible location, without any a priori reason.  It didn't look authentic.  So, I added noise to each of the locations, scattering the exploration points.  The scary newmans became individuals.


Scary WLNewmanBrainBasic

The Future


The goal of this project is to determine whether or not My Ideal Progression System is really all that great -- and if it isn't, come up with a better one.  I mapped out the future of this project this week.  It's going to take at least another month to produce some good looking, accurate, and understandable graphs out of this simulator.  I can't wait for that.  With enough support and feedback from the community, I'm set to see this through to the indefinite end -- so please leave me a comment :)

As for the next steps, it's pretty obvious there are too many bases scattered around, and no one is taking advantage of it.  It actually reminds me of how experimental plays right now, considering it takes 3 + people to (maybe) breach a tier 1 base.  It sucks.  So, I'm going to code the raiding system.

Raiding System
The plan is to give defending newmans a 20% bonus chance to win a fight.  They will have the option to sally out (open the doors and dare the invader inside) or to wait it out until the attacker breaches the walls.  Once the walls are breached, the defender will retain his advantage given his bunkered position and knowledge of his home.  However, the defender absolutely must fight once the walls are breached.  Upon successfully raiding a home, the raider will claim ownership, and must repair the base in order prevent other newmans from re-claiming it.  It will cost a hefty fee in tools to breach a base.  I've decided it should work this way, or mass raiding would take place.  It should be a bit risky raiding a base -- one should expect a profit (maybe) less than half the time -- with zero information about the base.  However, if a newman watches a base, and estimates the amount of resources inside based on the frequency of their enemie's visits, profitable raids will be attained.

Of course, after raids are in place, the AI will be next.  I'll include multiple base building as well as resource storing in the AI update.  Should be super cool to see newmans raiding each other.  It will cause a greater spread in the base distribution too, as no one wants to be close to a high level base :)
Later, I'll add an online / offline system to simulate player's limited ability to play Rust.  After that, I'll finally move away from WLNewmanBrainBasic, and move into something like WLNewmanBrainDecent.  It will be an overhaul of the AI system -- trying to come as close to a human rust player as I can. Soon as that is complete, I should be able to log some data, and process it in Matlab.

Food For Thought
I'm still on the fence about animals and food gathering.  On one side, it's super easy to gather animals to eat, far easier than it is to even build the first tier wood shack.  On the otherside, would this really be an accurate Rust simulator without food and starvation?  I guess that depends on whether or not starvation would be a significant factor in the survival of a newman.  When I look at my own plays of Rust, I absolutely never die of starvation.  It's just one more errand to run while I'm out gathering wood and stone.  However, it does usually force me toward a forest.  As I said, I'm on the fence.

Is food and starvation important? (for this simulator)

1 comment: