Archive for November, 2007
Small Update
Posted by Joshua Smyth (Admin) in UnderKeep on November 2, 2007
As I’ve mentioned previously, I’ve got exams at the moment. But my next one isn’t for 6 days so I spent some time with the COU code tonight.
I’ve been meaning to create a monsterFactory pattern to generate monsters for a while now, and I’ve actually got the beginings of one in place – Now I’ve got more than one type of monster! Which makes things alot more interesting.
The monsters are organised across levels, so theres a level 1 monsterSet, level 2 monsterSet etc.. When the game generates levels there is a 20% chance a monster will be generated that is actually one level higher or one level lower than the current level. This is to mix things up a bit and have more variety as well as meeting new monsters as you progress down through the dungeon.
But what occured to me, is that it would be really nice to have something like LINQ to populate the levels. I’ve not worked with linq first hand, but from the sounds of it, it’s going to be nifty (It’s a Microsoft Tech, but if Sun Microsystems is smart they’ll implement something similar) For example: If I want a level to only consist of skeletons and undead, I have to write a custom iterator across all the monsters in my ArrayLists that contain the monster data, pull out a new arrayList containing only undead and then randomise across my new ArrayList – Ok, so that’s not actually hard to do – but it doesn’t scale well, as there are any number of other dimensions I might want to query over. Say all creatures that require magic items to kill, are between levels 4-8, are immune to fire and explode when killed – Ok, that’s a stretch, but you get the idea. It would be far easier to write that in a query language than in actual code and because linq works on data in memory (as well as data in a database) I’ve got a feeling it’s going to be quite useful for any data driven project that doesn’t require anything as heavy weight as a relational database. Just give me a quick way to take different views of my data! Besides do you actually want your customers to have to install mySQL server?
The next major bit of code to write is the animation system. Lots of the upcoming features are going to require that this code is done soon – combat and spellcasting in particular, and then the fun can begin.
Edit – Monsters now drop items when you kill them – woot!