Admin Tools

by Cameron Albert 31. January 2008 00:22

I spent some time working on admin tools tonight for Perenthia. All the tools I am building will be web based rather than a mix of windows and web, which is what  have for the current beta 1 version of Perenthia. The current version has some web based admin stuff for content and items but the main beast is a windows application for drawing out the maps and terrain. I decided to rebuild this into a web based component so I can admin Perenthia from anywhere. 

The tools I have so far are:

  • Place/Map Editor - Add/edit rooms, exits
  • Connection Viewer - View active connected players
  • Online/Offline Toggle - To shutoff access to the game engine for maintenance, etc.
  • Item Template Editor - To add item templates, from which items are generated or created
  • Log Viewer - View error, chat, etc. logs
  • Content Editor - For news, pages, etc.

Tools I plan to add as I go:

  • NPC Editor - To add/edit NPCs
  • Quest Editor - Add quests, set key NPCs, set rewards, etc. 

Tags: ,

Game Development | Perenthia PBBG

Place Manager

by Cameron Albert 30. January 2008 17:19

In my previous post Memory Management I was talking about storing character and room data in server memory.

For the Character memory management I basically just use a DateTime value that gets updated each time a request is made by the connected player. If the DateTime exceeds a certain limit such as 20 minutes then the character data is saved and removed from memory. If the player just has a long pause between requests their character data will be reloaded if they make another request after the cleanup.

For the Room or Place data I've though about doing the same thing, just store a DateTime value and update it whenever a player performs an action in the room. I am not sure this is the best approach since the only commands that reference the Place object are movement, looking, some inventory and buying commands. Other actions such as casting spells, viewing stats, private chat, etc. do not reference the Place object. Of course, I guess if you are not accessing the Place object no need to have it in memory but once a player attempts to move again I would need to reload the Place. I might just maintain a list in the Place object of all the players currently located there and only remove the object once those references have been removed. I'll try a few things and record what I find.

Tags: , ,

Game Development | Perenthia PBBG

Memory Management

by Cameron Albert 29. January 2008 17:59

For Perenthia I am planning on utilizing server memory as much as possible without crippling the web server. To do that I am going to be maintaining player data and room data in memory for fast access and quicker responses from the interface.

The basic idea is that players login, choose a character and begin playing. This character information will be loaded into memory and persisted to the database when the data is changed, such as when commands are executed. As players move around the rooms they enter will also be persisted into memory to make loading and re-loading rooms faster.

The trick will be effective management of these resources. Character data will be removed after inactivity but I haven't figured out a good scheme for removal of the room data. Hope to have that working before too long though.

Anyway, that is the plan, we'll see how it works out. :) 

Tags: , ,

Game Development | Perenthia PBBG

A Silverlight Pirate Game

by Cameron Albert 11. December 2007 17:11

I've decided to take a little break from working on Perenthia and focus some time on building some smaller, shorter life span games. I have two reasons for doing this; the first being that by building some smaller games I can get the games completed faster which is very encouraging and allows me to have new projects to work on. Perenthia is very time consuming because I keep making it complex, I feel it needs this complexity though to be a fun and engaging game. The second reason is that I want to get my feet wet in Silverlight and building some smaller games would give me just that. I will continue working on Perenthia but want to get a few more of my ideas built and playable before finishing it out.

That being said the first Silverlight game I will be creating will be a Pirate game where you sail around, avoiding the navy, attacking ships and finding buried treasure. Doing something like this will enable me to get core mechanics worked out in Silverlight along with animation, collision detection, etc.

As it stands right now I have the basic player movement and ship movement down. The graphics are pretty bad as it was just something for prototyping. The game will be a top down view and hopefully provide some fun gameplay in short intervals. I want to be able to persist the player information so you can pick back up where you left off and ultimately complete the game.

The goal of the game will be to attain the buried fortune of a long dead pirate named Rough Hand James. He created a map to his treasure and scattered the pieces all across the globe. It will be your adventure to find those map pieces and locate the treasure. You will start out on your ship with the first clue to the treasure and along the way you may encounter the Royal Navy, sea monsters and other pirates. You will engage in sea and land battles, loot merchant vessels and follow clues through towns, uncharted waters and wilderness all to find the greatest fortune every massed by one pirate.

I am going to work a little on the graphics and get some animations working and then I will post either a screenshot or working prototype of the game in the next few days. 

PBBG Engine Update

by Cameron Albert 27. November 2007 16:06

Work continues on Perenthia and my PBBG Engine. I think I got the core PBBG engine framework complete, at least complete enough to start porting over the content items from Perenthia. My goal is to get a small area working with a few items, monsters, etc. before I port over the entire database.

I am hoping to improve performance in this new version as well as complete several of the features I didn't get implemented in Beta 1. The engine uses a lof of in memory objects while still persisting the world to the database. Running a lot of this in memory will eat of memory on the web server but will hopefully improve performance in regards to interactions from users. The main bulk of the places or rooms will be loaded up into memory when the application starts. Along with this load will be a load of NPCs and items located in towns and designated areas. Then, whenever a player logs in and begins playing their player object will be loaded into memory as well. At regular intervals the world state will be updated and player objects persisted to the database. Inactive player objects will be saved and then discarded from memory until the next time the player logs in.

Loading these objects into memory will keep the database connection initialization and IO traffic to a minimum and help speed up actions such as moving around and engaging NPCs. Since I don't know of anyone actually doing this I'm not completely sure it will work. :) My testing so far is working great and at most I may need to beef up the RAM on the web server.

I am still planning for a January release of Beta 2 and depending on how that beta goes; a full release in the early Spring.

SQL 2005 XML Data Type, Stored Procedures and Lists

by Cameron Albert 14. November 2007 17:41

I've seen a lot of stuff out there regarding the SQL 2005 XML data type but most of it is just regurgitates the MSDN documentation. That's fine and all but what about practical uses of it? Well, I have a practical use sample. In building my persistent browser based game Perenthia I have a concept of a Place. A place is a virtual space in which objects are stored. For Perenthia the places represent the various rooms or tiles players move around on. The place or room has exits defined that allow the player to move from one place to the next. The exits are the typical directions; north, south, up, down, etc. In the database I have a Places table and a PlaceExits table. The Places table stores all the information regarding a place and the PlaceExits table stores the placeId along with a directionId and destinationId so I know what exits are available in any room and what rooms they lead to.

The simplified schema for the places would be:

 Places Tables

 In the stored procedure that retrieves the place information I use the following query snippet in the select clause:

    SELECT

        p.*,

    (
            SELECT
                e.DirectionId        AS "@directionId",
                e.DestinationId        AS "@destinationId"
            FROM
                dbo.PlaceExits e
            WHERE
                e.PlaceId = p.PlaceId
            FOR XML PATH('exit'), ROOT('exits')
        ) AS ExitsXml

    FROM dbo.Places p 

 This creates an XML fragment I can then parse in the application to fill a collection of Exits on the Place object.

When saving place information I pass XML generated from the Exits collection in a stored procedure like so:

CREATE PROCEDURE dbo.Places_SavePlace  (@PlaceId int, @ExitsXml xml)

From within the save procedure I perform an update or insert of the place data and then execute the following sql to insert and update the exits for the current place:

    -- Exits

    -- Process the existing exits first

    UPDATE
        dbo.PlaceExits
    SET
        DestinationId    = e.ex.value('(@destinationId)[1]', 'int')
    FROM
        @ExitsXml.nodes('/exits/exit') as e(ex)
    WHERE
        PlaceId = @PlaceId
        AND DirectionId = e.ex.value('(@directionId)[1]', 'tinyint')

    -- Process any new exits

    INSERT INTO dbo.PlaceExits
    (
        ObjectId, DirectionId, DestinationId
    )
    SELECT
        @PlaceId,
        e.ex.value('(@directionId)[1]', 'tinyint'),
        e.ex.value('(@destinationId)[1]', 'int')
    FROM
        @ExitsXml.nodes('/exits/exit') as e(ex)
    WHERE
        e.ex.value('(@directionId)[1]', 'tinyint') NOT IN
        (
            SELECT DirectionId FROM dbo.PlaceExits WHERE PlaceId = @PlaceId
        )

This is working pretty well and keeps me from having to loop through the exits in the application and make multiple database calls. 

Templates and Objects

by Cameron Albert 13. November 2007 17:23
My PBBG engine being used for the Perenthia 2 beta will consist of templates and objects to define all game related world objects. Everything within the virtual world will be an instance of an object or object record. Each object record will be based on a template instance or template record. Using this model I will be able to add templates for things like swords, monsters, etc. and then create object records for each in game instance.

Tags: , ,

Game Development | Perenthia PBBG

Game Play Considerations

by Cameron Albert 13. November 2007 13:58

What I am wanting to do with this next beta version of Perenthia is to provide players with several avenues for advancement and various activities they can participate in either solo or against other players. I think I've got the database and engine design felxible enough to allow this so I've been putting together lists of activites, quests, etc. that the players will be able to do in game.

I want new players to be able to feel a sense of accomplishment early on but I don't just want the monsters to get harder as they level, I want the whole game dynamic to change as you gain more experience. An example of this might be that in early levels you are runnning around the wilderness killing various monsters but as you level up the monsters stop giving experience, forcing you to venture into some of the dungeons. In the dungeons you find harder monsters but also encounter situations where other skills come into play such as solving puzzles, etc. Then as you move beyond these levels you will need to start aquiring heavy duty items such as a ship or airship in order to venture into the mountains or cross the oceans. These are just basic ideas I've had and want to be able to incorporate them into the game to make the fun and challenging at all levels instead of just another level treadmill game. I know I get bored of most role playing games after the first 10 levels or so because it is just the same thing over and over again. I am hoping that I can break out of this mold and create a fun and lasting experience for players. 

Tags: , , ,

Game Development | Perenthia PBBG

Performance and Browser Based Games

by Cameron Albert 9. November 2007 10:31

One of my biggest concerns for my persistent browser based games, aside from gameplay, is performance. Persistent browser based games have the same issues that normal client/server applications have in regards to internet latency but with a PBBG you do not have a persistent socket in which to push data from the server. This limitation makes it difficult to to real time player activites. Most PBBGs seem to be strategy games operating on a turn based daily type of cycle. This is probably the most useful model but what if you do want to offer real time interaction? Real time interaction can be handled via AJAX in that you can poll the server for new information every few seconds but you could run into some serious performance issues if you send a lot of data down the pipe when actions occur. For that reason I am trying to work out an AJAX based system for downloading game content in the background while the player moves about the world. Once I get the Silverlight components built and tested I should be able to accomplish the same things with Silverlight and provide a nicer user experience.

I think I got just about everything ready for my new PBBG engine so now I can start writing the database queries for the standard commands the system will accept. I am focusing on performance as much as possible for this new engine. Perenthia is working OK but is a little slow when moving around. I can reduce this somewhat by performing asynchronous calls to preload a lot of the data on the client but I still need to stream line everything. After all, in order to move I don't need the player profile description coming back from the database, I just need the information related to moving. 

Tags: , , ,

Game Development | Perenthia PBBG

Database Model for a PBBG

by Cameron Albert 9. November 2007 00:22
I've worked on some large projects in the past with 500+ database tables but I have yet to see any persistent browser based games or any games get up that kind of table count. I only have 61 tables in Perenthia right now with a few more features to add which could possibly add another 10 tables. I would be curious to see a larger model, to see what kinds of things are handled. Right now I have tables for users, roles, places, things, avatars, skills, attributes, quests, guilds, professions and an assortment of lookup tables for things like item conditions, materials, titles, levels, etc.

Tags: , , ,

Game Development | Perenthia PBBG

Powered by BlogEngine.NET 1.5.0.7
Modified Theme by Mads Kristensen

About the Author

CameronAlbert.com I am Senior Software Development Consultant specializing in Silverlight, WPF and the Microsoft .NET Framework. 

I have released an iPhone game called the Adventures of Puppyman that was built using ExEn and am currently working on a WP7 and iPhone version of Perenthia soon to be released.

View Cameron Albert's profile on LinkedIn
See how we're connected

Follow cameronalbert on Twitter

 

Recommended Books

Silverlight 4 Business Application Development - Beginner's Guide:

http://www.packtpub.com/microsoft-silverlight-4-business-application-development-beginners-guide/book

Microsoft Silverlight 4 Business Application Development: Beginner’s Guide