It is time again for me to let you all know what i've been working on this week.
Content So Far
I have spent a large part of the week implementing dynamic data driven content. WTF is that?
Well, it means that I didn't want to make all these monsters and items inside the code, with all their attributes hard coded. I mean, I don't know at the moment, what and how those abilities or whatever will be in a year or so in the game.
Also, I didn't want to make some custom data format either. The data is all in nice XML still.
The content editor that I mentioned in my previous post, creates new content really fast. Much faster than having an xml editor, and figuring out the layout manually. It was a nice first step, but not what I had in mind for a release version. I went back to the design table. This is what I came up with:
Dynamic Data Driven Content
I managed to implement a way to use CodeDom to instance a dynamic type as a static type. I used the ExpandoObject. WTF is that?
Well, ExpandoObject is this neat thing in .NET 4.0+, that allows a coder to add properties to it on the fly. Like a propertybag (WTF: google that for more info). WTF is all that stuff about CodeDom and whatever? Well, it's a way to look into a program, after it's compiled and running, to see under the hood.
Once I move onto Expression Trees (which don't work with dynamic types) I can use my new technique to bypass this Microsoft issue. Then, rules (behaviours) can be dynamic too. Hopefully emergent behaviour in the game will allow the cloud AI to evolve smarter and faster.
Long story short, I can add any properties or attributes to monsters inside the content xml, and the game will use those properties WITHOUT being recompiled. So, if I have a game version 1.10, and i want to say add a new attack attribute to a monster, I can do that without needing to restart the game, the new attack attribute just appears.
What next?
Now that I have solved how to create new content without coding for all eventual properties, I can start to adapt popular game items and monsters (eg. Ultima Online stuff) into xml files. I don't need to worry if I miss out something now, I can add it in later, and it will not cause issues with the game code.
Another neat thing about this: I can procedurally evolve attributes onto monsters, morph them from one type to another, or even let the game itself create totally new monsters during gameplay.
Hopefully the neural network code I have for monster brains will allow special breeding more than genetic algos "survival of the fittest".
I will spend most of next week recoding the content editor to allow for self evolving monsters and content, and that I can use dynamic data read in from the content xml files.
Is the neural network code working? When I read the post about AI, my first thought was that Kohonen SOM wouldn't work well for decision making because it doesn't have any means of learning whether decisions are good or bad.
ReplyDeleteThe array is in place, but not part of the running code. In the behaviour tree, the som will act as a weight. Together with some type of ruleset in expression trees, i'm hoping that the som will provide a way for the rule to be rebalanced. I'll write a proper post more on this later on, when i move onto the code.
ReplyDeletePersonally, if I were going to use an adaptive neural network in my monster AI, I'd cut out the decision trees and just base the whole system on the neural network.
ReplyDeleteI'd give it access to the visible parts of the monster and player state, a few details of the surroundings (available cover, presence of allies), and some output nodes to allow it to make decisions.
Then let it fight against itself for a few thousand iterations, using a genetic algorithm to shape it into a reasonably competent fighter without human supervision.
Thanks for that comment. Very interesting. Something to ponder over but definitely valid points to consider.
ReplyDelete