Why Use C# to Build a Rougelike Game


What's all the fuss about Rouguelike games?
 
If you haven't heard about Roguelike games - it is time you get started. Roguelike's are best summed up by Wikipedia.
 
"The roguelike is a sub-genre of role-playing video games, characterized by randomization for replay ability, permanent death, and turn-based movement. Most roguelikes feature ASCII graphics, with newer ones increasingly offering tile-based graphics. Games are typically dungeon crawls, with many monsters, items, and environmental features. Computer roguelikes usually employ the majority of the keyboard to facilitate interaction with items and the environment. The name of the genre comes from the 1980 game Rogue."
 
Wikipedia 2012
 
Its a strong Indie game development movement that is growing at a significant rate and has attracted enoormous interest from a lot of gamers who are slightly over the overflow of First Player Shooter (FPS) games going around.
 
Why would I use C# to build a roguelike
 
Although maybe not the most obvious choice for general game development - C# is well suited to a good old school roguelike because it is such a simple and brilliant language. The following are the big reasons I think that make it a great choice for developing a roguelike game. You can find more information on the use of C# for roguelike development at http://www.domscode.com/
 
LINQ
 
Without a doubt the power of LINQ minimises a lot of code and keeps your code really quite neat. Think about a simple Object model like:
 
 DUNGEON -> LEVELS -> ROOMS -> ITEMS
 
So this says that a dungeon can have multiple levels, and each level can have multiple rooms and each room can have multiple items. Now if for some reason we wanted to determine the number of items in a given level (lets say we have currentLevel) we could do something like:
 
 
var countItemsOnEachLevel =
 
        from l in dungeon.Levels
 
        from r in l.Rooms
 
        from i in r.Items
 
        select i; 
 Console.WriteLine("Items on each level {0}",
 countItemsOnEachLevel.Count());
 

Or let's say we have
 
DUNGEON -> LEVELS -> MONSTERS
 
So again this means our dungeon can multiple levels and each level can have multiple monsters. Now if we need to work out the number of monsters alive on each level.
 
 
var countMonstersAliveOnEachLevel =
 
        from l in dungeon.Levels
        
from m in l.Monsters
        
where m.HitPoints > 0
        
select m; 
 Console.WriteLine("Monsters alive on each level {0}",
 countMonstersAliveOnEachLevel.Count());

 
Full OO Support
 
The use of Inheritance, Encapsulation and polymorphism is quite critical to building a good roguelike object model.
 
Great Community Support
 
There are so many great sites to get support on C# development and the shear size of the development community means that you don't have to go far to get answers to questions or advice on C# development issues. C-sharpcorner, stackoverflow and MSDN are just a few great sites to get assistance.
 
Free Dev Tools
 
VS2010 express is fine to build a roguelike and of course its free.
 
Happy coding and adventuring..

Up Next
    Ebook Download
    View all
    Learn
    View all