Rogue AI – Day 3/4

I had to pack up my workstation, and move it to my new house (all other moving done last week thankfully) but I don’t have internet here yet which is both good and bad for development (especially considering I’m making a multiplayer game). So this post is a two day summary given I didn’t get the opportunity to do one yesterday.

I’ve completed the back-end data structure that holds all of the AI tile information, and it mostly connects to the front end interface so if you click away from a tile and come back to it, its settings are now preserved. I also wrote the code to compress and uncompress the whole thing into a byte stream so it can be sent over the network to the server to play publicly for everyone. A bonus of this is also the ability to stream into a local file, so you can save your progress. That took much less time than I anticipated so I’m glad that my networking code is good and simple enough to easily take that kind of thing on.

I don’t really have any screenshots worth showing today, but here is a taste of how the IF evaluator works. There are 5 different data types: Number, Direction, Target, Item, String and Boolean. Each data type has a dynamic selection chain for the left and right side of the IF, so a side for a Number type might evaluate to: [Enemies In Sight], or [Specific][“4”], or [Variable][“storedNumber6”] and once evaluated will be joined using using the selected comparison (ie =, != < > etc).

Where it gets really tricky is some selectors can contain selectors of other types, so an example of one with Number is: [Target Health][using target: <Target Selector>]. Now a Target selector might evaluate to: [Self] or [Variable][“target1”] or where it gets super twisted [Friend In Sight][using index: <Number Evaluator>] (that’s right, a number selection can contain a target selection which can contain a number selection ad infinitum)

So a full IF chain might look like this: IF [Target Health][Self][<][Target Health][Enemy In Sight][Specific][1] THEN which means: IF your own health is less than the health of the first enemy in sight. From here you might want your AI to retreat or do some action differently.

Today I need to work on getting an AI to actually evaluate the whole grid, and start properly using/testing it. I feel like I might end up close to the wire because I haven’t really even started any dungeon generation or you know… the actual game.

Leave a Reply