Please note that all screen shots displayed in this blog are works in progress and in no way represent the appearance of the final game. Check out the main site here.

Be sure to follow us everywhere with these links!



Monday, July 4, 2011

Tech

So I've been asked by some people to share some of the more intimate details of the tech behind The Sword of Ahkranox, so for all you budding game developers out there, enjoy the read.

And, before you read on, if you disagree with the way I'm doing any of this, or are planning on ridiculing my methods, or telling me I should be doing it another way to the way I'm currently doing it, please refer to this link.

If you're just in for a good read, then please continue:

The Tech:
Malevolence: The Sword of Ahkranox is written in three different languages. The first and foremost language that it is written in is C++. This was used for all of the 3D rendering of the engine. To do this I have made extensive use of the DarkGDK.NET libraries by The Game Creators. However, the C++ portion is merely to create my OWN set of libraries (since I'm not 100% happy with the DarkGDK libraries on their own, and I have insisted on reinventing the wheel and modifying their output). So C++ has been used purely for that purpose. Once those libraries were complete, I then used Visual C#.NET to tie the game together and give it its front-end. Visual C#.NET is definitely the core device that holds the game together and gives it its Windows interaction. However, the main bulk of the processing objects that are used in the game are written in DarkBASIC Professional and brought into Visual C#.NET via the DarkGDK.NET. All of the things like the procedural content generation, etc, is done in this manner. Now that the engine proper is sorted out, most of my coding has been in processing, so these days I mostly am writing DarkBASIC Professional code, and only having to modify my C# or C++ files when absolutely necessary. I'm an old-school BASIC coder, so this is what works best for me.
So why not just drop the C++ and C# and just write the thing purely in DarkBASIC Professional? Good question! While DarkBASIC Professional is a fantastic package and they have done a really awesome job in putting together a really solid platform, all programs made in it are incredibly heavy on the system resources and any decent sort of game written in it takes a monster of a machine to run. By reinventing their SDK in C++ and controlling its Windows interaction in C#, I have been able to directly be in control of which system resources are used and in what way, making me able to write a considerably more powerful engine than what would normally be able to be done in pure DarkBASIC Professional.
As a side-note here, I'd like to add that if you have tried DarkBASIC back in the day, and haven't yet tried out DarkBASIC Professional, I cannot stress to you enough how much you need to try it out. It's a whole new language and literally about 500 times more versatile and powerful than its predecessor.

The Engine:

So the engine is grid-based first person game. The design was modeled off of the classic grid-based first person engines of the mid-nineties that powered such titles as Might and Magic, Eye of the Beholder, and the like. I grew up loving these games, but always thought they could have been better.
So because of this, the game is broken up into a 2D grid. Each grid space represents a different item. Each grid space can only contain one item. Things like walls, destroyable objects, chests, fountains, columns, etc. They are placed using the procedural engine (which I will describe in that section)
When loading the level, the engine looks into this grid and places the corresponding 3D objects into the world. The player is then placed into this world, and as they move about it, the engine refers to the 2D grid (which is still stored in memory) to see whether the player is allowed to move forward or not (based on the solidity of the object in front of them)
Monsters follow a similar system as their modified Dijkstra algorithm refers to the 2D grid to see where their available paths are.

The Procedural Content:
So this is the super-secret part, but I'll tell you a bit about it. Yes, The Sword of Ahkranox's in-game world is quite literally infinite. No, I'm not exaggerating. The engine makes use of a new type of procedural generation that I invented myself. No fractals, no Perlin noise, no blobs, no diamonds. Instead it makes use of a hyperbolic paraboloid generating seeds which are used to create the world in four dimensions. X, Y and Z co-ordinates as well as a time coefficient. Changes that the player makes to the world as they move through it are stored in a temporary database but are then reset after the player has given enough time and distance between them. So, if you empty a chest in one dungeon, then travel across the world, eventually that chest will re-fill, however, due to the time coefficient, the seed that generates the content of that chest will now be different, thus putting different content in that chest.
The AI of NPCs and monsters also follows this procedural generation, so people won't just sit in one spot, but will travel around the world while you play, depending on their role.
This generation accounts for almost everything in the game. Spell creation, item creation, weapon creation, potion creation, NPC dialogue system, even the spell effects that happen on the screen. Due to this, the world that the player explores will be ever-changing and infinite. They won't keep finding the same old weapons or items, there will be no end to the number of spells they can find or use, they won't even keep having the same conversations with NPCs.
"That's impossible!" I hear you cry. Well, it's already working fine. I know you're only seeing the dungeons at the moment, but that's because their pretty. The other parts of the game aren't pretty yet ;-)

The Assets:
There are a lot of assets in the game, and to create them I personally have been using Adobe Photoshop CS4, as well as 3ds Max 2011. Other artists on the team have been using Photoshop as well as programs such as Illustrator and ArtRage (great program if you ever have the time to have a play) and one of our artists is even sticking with purely traditional methods and materials, and then digitizing them later.


So that's everything for now. If anyone has any other questions, please feel free to comment on this post or send me an email and I'll answer as best I can!

3 comments:

  1. Alex, Yes! Thanks for the post. The game is looking great and I'm excited for a demo.

    Also, forget about any haters. I don't think there are any though. :)

    ReplyDelete
  2. Thanks dude :) it's so much fun to play. I can't wait to unleash it upon the world!

    ReplyDelete