Archive for C#

MySQL Backup Engine

Finally, I got around to updating my database backup utility! I started by creating a MySQL connection library and a “Backup Engine” library, which I hooked up to a test console app. This approach will allow me to have two different applications that use the same back end. One application will be a windows client and the there will be a command line utility as well.

The original version was created over a year ago and hasn’t been worked on until now.

The new project consists of:

  • Database connection library
  • Database Backup engine
  • Commandline app
  • Windows forms app

It saves backup into .sql files of predefined size. I created a DynamicFile class which saves text data into multiple files and allows the programmer to get the list of filenames afterwards:

Actually, I extended this class into DynamicSqlFile and created some methods useful for writing SQL files:

It has a handful of useful methods, like WriteComment(), which automatically appends “– ” before the text and ends it with a NewLine character. It also returns and instance of itself, making this possible:

Which makes for very compact and readable code. It ends up looking like this in the SQL file:

Commandline interface:

cmd_backup

Work in progress

Work in progress

Edit distance algorithm

This little algorithm is one of the coolest things I learned from the programming lectures with Dr Bryan Duggan. Essentially this algorithm shows how much one word needs to be edited to change into another word. It is very useful for writing a spellchecker, or a music recognition app. Below is a C# implementation of the algorithm:

the getEditDistance() method returns 0 if both words are equal, 1 of one letter needs to be changed, etc.

Sudoku

I made this little program to test my sudoku-solving algorithm around the christmas time. I used XNA to draw the puzzle, and solving algorithm works in a separate thread (included below). This is not the best algorithm since it can’t solve “hard” puzzles. But it can logically deduct numbers (no guessing) and put them in the right place.

sudoku

SudokuSolver.cs:

Tornado Apocalypse

This is a fun little game we made at GameCraft in Thurles. We made it in 7 hours and used the engine from our earlier project, VM Warfare. Tornado Apocalypse won the best overall game at the event! The game supports 1 to 2 players and has 2 levels. The goal of this game is to evade zombies and find chopper hidden in random part of the map.

Tornado Apocalypse

The goal of this game is to GET TO DA CHOPPAH!

The goal of this game is to GET TO DA CHOPPAH!

Best game winners at GameCraft 2013

First Prize: Nokie Lumia 800

Download Tornado Apocalypse
Download Source code

VM Warfare

VM Warfare

VM Warfare is a multiplayer/singleplayer deathmatch game that won the Best Multiplayer Game award at GamesFleadh 2013. I created it together with Viktor Zolin, who made map editor and tile engine, while I mad emost of the game itself.

You are a soldier defending the Earth against alien attack. To help you with this, helicopters will randomly drop fuel supplies and toolboxes around the map – pick them up to replenish your fuel and health. But be careful! Aliens will want to collect them too!

Some info about the game:

  • Won the Best Multiplayer Game award
  • AI is clever, it will not go into obstacles, it will run away looking for health boxes if they’re low on health
  • Apart from health, you need to mind your fuel bar or you will be immobilized
  • Fuel and health boxes are dropped by helicopters
  • Explosions are dynamically generated from particles
  • Multiplayer mode allows for up to 4 players – each player needs to connect with an xbox controller and 1 can use the keyboard.
Typical gameplay

Typical gameplay

You can invite friends over and enjoy the award winning split-screen multiplayer experience, or face hordes of aliens by yourself.

Multiplayer mode allows up for 4 players

Multiplayer mode allows up for 4 players

Project in Visual Studio

Project in Visual Studio

Download VM Warfare
Download source code (Game only, no tile engine)