After working on the game engine for so long I finally got the urge to work on ORG again.  I had made it not fun by adding aspects to the gameplay that simply distracted players from what actually made it fun.  So I removed the parts I felt were like this.  I also added AI.  It’s fun to watch the AI spreading across the land, and it was also fun to code it.

Leave a comment


Tonight I replaced my own text rendering code with calls to DirectX.  Lession: don’t write my own text rendering code unless I really have to, which I didn’t.

Over the weekend with what little time I had, I took a break from the game engine and rewrote the abstract military structure classes that I used in GCM.  The new one makes proper use of Linq instead of ugly traditional traversals.  And it’s thoroughly commented!  And it uses recursive generics for clean extension with no awful casts!  I also wrote IO classes for converting these structures to and from XML, and a php version.  I’m not sure where I’ll use this code, but it’s a foundation for a lot of potential projects.

1 Comment


I’ve been slowly restructuring the “game engine” that resulted from the making of P&C and ORG.  ORG was based on the P&C code, I just stripped out the P&C specific code which left about half of the total easily reusable.  That’s why ORG was quick to make.

I first rewrote the csv file handling code, which I started using halfway through the making of P&C and have used in almost every project since.  The new code is shorter, cleaner, faster, and commented — I like using it.

Next I decided to clean up the Graphics and UI engine.  This is probably the most complex part of the game engine.  First I’ve split it all from the game code into a separate project, with a single class to communicate between the graphics part and the game.  Tonight I finished connecting the loose ends from this move and the game (I’m working with a copy of ORG) started and ran successfully.

Now there’s a lot of cleaning up I want to do.  However, I’m still happy with the original design, so it certainly won’t be a complete rewrite.  One thing I intend to replace is my text renderer.  I foolishly “rolled my own”, generating a bitmap with the characters and writing the oft-reinvented wheel that renders individual characters in the strings.  SlimDX provides this capability anyway, so I’ll be using it instead.

I also need to add more “widgets” to my library, which is currently very limited.  I need a text box at least.  I’ve wondered if I could use .NET controls, and not reinvent this wheel, but I don’t think they’d fit with the structure of my gui engine, and I don’t know if it’s practical to use .NET controls and do the drawing with DirectX.

Leave a comment


This last week I’ve not done a whole lot, unless working counts.  I played a few games of Settlers of Catan online.  I made a little program where I could keep track of who has what resources so I could know who to steal from, but then people can rob each other so resource change hands that I don’t see.  And it was too hard to keep up with that while playing anyway, so I abandoned it and just won the old fashioned way.  Fail.

So far this month I haven’t had a good new idea, or inspiration to keep working on any of the projects I’ve already started.  Maybe I’m being lazy, I don’t know.  So I’ve started working a bit on my Utilities library, which has a lot of the general-purpose C# code I’ve written since I discovered C# back in ’09.  I guess it’s a “project” itself, but I’ve never worked on it outside the context of another “project”.  I don’t remember which project I “started” it in, but I’ve had a Utilities folder with a whole bunch of code in the Utilities namespace.  Every time I started a new project I would copy that folder in from the last project.  This was easy to do, but now I’ve got a lot of projects all with their own Utilities folder, no two of which are the same.

But it’s not that bad.  Now I’ve taken the latest one and made it its own C# Project, and started adding it as a reference in my projects as I work on them.  This has the advantage that all of it is in one place, and improvements to it will be available in all of them.  The disadvantage is that changes to it might break previous projects next time I try to work on them.  So far I think this has made me write better code in it, since I’m denied the freedom I had before, I’m pressured to write public interfaces that I can’t just change on a whim.


Today I rewrote my “ArraySet” class (what a name, you have no idea what it does).  It’s an array wrapper with a mix of map (dictionary) and list functionality.  The purpose is for cases where you have a lot of objects that need an ID number, and you do a ton of fetching by ID and a lot of iterating, and need to be able to add and remove objects a lot.  I have this situation a lot.

Now, a Dictionary<int, T> can serve the purpose.  But I have a probably irrational distaste for doing all that hashing when it’s really not necessary, and the keys are arbitrary so they can all be close to 0.  In my benchmarks, the ArraySet appears to take 2/3 as much time for a fetch by ID as the Dictionary does.  Iterating is a little bit faster, depending on how close together the keys (or IDs) are.  Adding and removing is as fast, as long as you keep the keys close together.

My last one had some bugs with iterating because I implemented my own iterator class without really understanding it.  I hadn’t yet discovered the yield keyword.  Since it had bugs, I used a Dictionary instead.  Now, perhaps that will change.

Leave a comment


This morning I saw someone had a problem with the ORG installer.  I think I know what the problem was, but the real problem is that the auto updater was just too frail.  If anything goes wrong during the update process, most likely it would fail and it might leave the version files in such a way that future attempts to update won’t work.

So today I fixed up the updater.  Now all of the temporary files it uses are in a temporary folder, so if the updater fails the main directory won’t get messed up.  I also added logging, my standard error report system, and a lot of verifications throughout the process to make sure it works, and ensure that if anything goes wrong, it will either recover or let the user restart the process, letting the user know what went wrong.


Another thing I did today was make a simple IP address finder.  It gives me my router’s IP, local IP, and the names/ips of as many local computers as it finds — and then it doesn’t do anything else.  It weighs 15kb, and gives the IPs as soon as it finds them, so it won’t freeze up if there’s a network problem.  It’s a very trivial thing, I wanted it because I often need to find various IPs on my network and this is faster than using a browser or typing in the console.  Download

IP Finder Screenshot

Leave a comment


Since I last posted I played Crusader Kings, and found it very enjoyable.  It inspired me to make this, which is a sort of online “strategic” game that leads to battles which are fought in Mount & Blade.  I don’t think it will go anywhere now, I did enjoy the battles I had with my brothers, and it was interesting to make. I started out with the whole thing being a website, but all the processing I was doing with the database ran really slow and wasn’t fun to write in php at all.  So I quickly decided to do it in C# (surprise!).  Linq in C# is so much more fun than writing SQL/php.

The way the whole thing works is there’s all these people and fiefs and such, and whenever the players (me, etc) decide to have a battle, I have months go by in the game where people grow older, die, get money, etc, until a baron decides to attack another baron.  So since the game only ran when a host (me) was there to run it, I could make use of my own computer for the processing.  So I have it download most of the tables in the database, and load them into memory in the C# app, and do the processing there.  I have some php that generates the data classes and the read/write routines in C#, complete with automatically generated properties to handle the relations between the objects, like a person having Father and Mother, a fief having Owner, and so on.  This was cool.

So when a battle is run, the data gets exported as csv files from the database, zipped on the server, downloaded, unzipped, and read into memory on my local machine.  Reading into memory is multithreaded so I can take advantage of my i5.  Not that it makes a difference, cutting the read time from ~20ms to ~10ms.  After the processing is done, the whole thing is written back out to csvs, zipped, uploaded again and then imported directly back into the database.

With that structure in place, throwing together the game logic was just fun with Linq.  I also wasted some time making it multithreaded just for fun.  Then my brother and I played it all day once and I haven’t messed with it since.  I’m thinking of what project to work on next.  If I find people to play ORG with I might start working on that again, but my chief rival who makes me fix bad gameplay by beating me with it is away, so I don’t know.

Leave a comment


I’ve kept at it all week and the game is coming along nicely.  It’s still a lot of fun for me after playing it for hours. 

I’ve put up a web page for it at  There are pictures and info there along with a download link.

Leave a comment


The prototype I’m working with is crazy fun.

I just started testing it with some people today online.  We’ve had up to 5 players.

It’s extremely buggy and not user friendly, but we did play half a dozen matches in the last two hours that worked.  Since we’ve had so much fun with it, I’ll put the current alpha version out there, here’s a download link:

(original download link is outdated, full game available here):

Extract anywhere, double click PAC.exe to run.  No further instructions yet.  Since it auto updates, it’s fine to release now even if no one sees the release yet.

If you don’t have DirectX 9.0c, you can install it with this:

Now I need to leave it for a while so I can write papers and prepare for exams.

Leave a comment


I haven’t posted here in a long time, the last major update for Plot & Conquer was back in October or November, I can’t remember.  Since then I’ve spent almost all my free time working on this.

And as of the past week, I’ve dug out the old P&C code again, chopped off the P&C specific parts, and started a new project.  The main points are that it’s real time rather than turn based, and uses a direct connection for multiplayer, instead of the PBEM-ish style of P&C. 

I’m not settled on a game to make with this system yet, the current prototype that I’m experimenting with (and playing because it’s fun) is a game of exploration and settling on a randomly generated terrain hex-map. 

Leave a comment

What’s going on now  

I haven’t posted anything here in a while.

I have been working on the game every day, as bug reports come in or when people give suggestions.  I’ve been able to fix all the bugs I’ve had reported so far.

Having the automatic update system is wonderful. When someone makes a suggestion that I like, I can immediately do it, and then click my “Deploy update” button, and in 15 seconds the update is live and anyone playing the game will have it.  It also keeps a record of all the files that changed with each update so if anything bad happens I can undo, but that hasn’t really happened.

School started again for me on August 30, so I’ve been very busy with that. 
I have all of the places where people can give comments/suggestions/bug reports linked to my email, so I can check my email when I get home and see everything that’s happened while I was away in one place.  If nothing’s happened, I can get busy right away on homework or the next improvement to the game. 

Leave a comment