Perenthia–Development Diary #1

I am working on Perenthia again, doing some re-design work to try and make the game fun but also maintainable by one person, me. I am going to catalog my development journey and the design decisions made along the way. I am trying to take what I learned from the prototype/alpha stage and improve upon it with realistic goals and tasks. Since it is just me working on it, other than contracting out the artwork pieces, I need to stay focused on making it fun and trying to implement the features that I think will be fun.

I have actually already started working on a re-usable library to host multi-player games. I have the basic framework in place which includes a base GameObject that provides a dictionary or properties and implements a behaviors system to allow custom behaviors to be created and attached to objects. I also have a master Game class that can be started and runs the server frame loop, updating the world and any loaded objects, behaviors or game components. I used MEF to define externally loaded components and data libraries. The Game class expects an IWorld implementation, some repositories for objects and users and optionally a list of IGameComponents. The IGameComponents are updated with each frame loop so I figured those would be good for creating things like a weather component, pack AI, etc. The IWorld is also a game component but has a few specific methods defined to access data contained within the world from the Game object. Behaviors are simple objects that can be attached to a game object and also contain and Update method that is called during the game object’s update method.

All this is server side code intended to run a virtual world. In addition to the re-usable game server I have a Perenthia specific library built on top of it that defines the aspects that are unique to Perenthia itself. For instance, Perenthia contains a Skill and Race object and loads that data during the world initialization. The underlying virtual world framework is not aware that skills and races exist, just that game objects are being added, removed and updated.

For data storage I put all world data that loads with the world initialization into SQL tables and a few external flat files. User and player data I am going to store in MongoDb to take advantage of the document storage mechanic and store an entire player object as one record. After using relational data for years to store objects and wiring up code to handle the relationships, etc. I find the document storage a refreshing change. I took a look at EF and code first but could not obtain the same level of ease of use as with a document store. I ended up having to code way too much logic specific to how the objects are stored rather than just saving them.

For the initial game client I decided to go the Html5/Javascript route to be able to present to the majority of players. I am using SignalR for the client to server communication and worked out some generic interfaces in the underlying server framework to allow for switching the communication technology. I am also using ScriptSharp to build the client side game logic. I find that using ScriptSharp is helpful as you get compile time errors and can resolve some issues up front without having to use console.log statements for everything. The string typing of objects does help to catch some case typos, etc. that are common for me when doing Javascript.

I have also created a world building tool for use with Perenthia. It allows me to draw the tiles that make up the world and save them as flat files for world initialization on the server. Using ScriptSharp I also coded some logic on the client to retrieve and load the maps. I can manage some of the SQL table stuff using the world build but want to get it to the point where I can add objects. My plan is to drop objects onto the map where an object resides within a tile, so not completely to scale or anything. My initial thoughts are to be able to add things like shops, taverns, etc. I also want to be able to add things like trees that can be cut down or a rock quarry for mining. I just not have not gotten to fleshing out all those details as of yet but that is the general plan.

What I am currently working on is randomization of creature encounters. I created a table to hold creature templates and then cataloged them by terrain. So for instance, in grass one might encounter a rat or kobold. In addition to that I created a feature in the world builder for editing creature zones. I store some zones in the database and then draw them on the world tiles to create the creature zones. So what I am working on is when a player moves onto a tile, if an encounter should happen I check to see if any creatures exist for the current terrain. If creatures exist I randomly get one with the level range marked by the zone. I am also thinking I may not return any creatures that are too low level for the player so you are not bogged down by encounters in low level areas and can move more freely into higher level areas. Once I get to where I have some decent encounters I am going to move on to the item system.

11/21/2011