C# simulation runner created as an illustration of our design pattern course.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.nuget
SharpSimulator
.gitignore
README.md
SharpSimulator.sln
icon.png

README.md

icon

SharpSimulator

SharpSimulator is an attempt at making a simulator able to emulate various scenarios involving multiple entities with various behaviours and interactions. The simulations are described by json files and feature nice 2D graphics. The whole project is made in C# and Gtk# using MonoDevelop.

This project is meant to showcase the use of design patterns in high level programming languages. It implements a Strategy Pattern, a State Machine, a Chain Of Responsability, an Abstract Factory Pattern and several others.

You can access this project on github here.

Builing

You can build the solution using Xamarin Studio, MonoDevelop or Visual Studio.

Or, from the command line from inside the SharpSimulator directory:

xbuild

or

msbuild

depending on if you have the appropriated command line tools in your path.

Build dependencies

NUnit

To build the project, you may need to redownload the NUnit NuGet packages

  • NUnit
  • NUnit Runner
  • Json.net

Make sure you are using .the proper version of .NET.

Gtk#

In addition, you will need the Gtk# Library to run the project. The installation method depends on the platform.

Windows

To install Gtk# on windows you can download and run this installer.

Alternativelly, install Xamarin Studio and everything should work out of the box.

Mac OS X
  • With macports

    sudo port install gtk-sharp

  • Without macports

You should find what you're looking for here.

Alternativelly, install Xamarin Studio and everything should work out of the box.

Linux

I'm pretty sure you know what you're doing so I shouldn't have to tell you what to do here.

Entities

The Entities are the base classes of the simulator. The two main super-classes that you can derive from are CivilianEntity and FighterEntity.

The StructurePoints of an Entity can be interpreted as life points. When they reach 0, the Entity is destroyed.

Logging (debug or otherwise)

If you must display textual outputs for debugging or other purposes, you are encouraged to use the Logger class. You cas use it according to the the following exeample.

Logger.LogChain.Message ("Hello World !", Logger.Level.ERROR);

The Logger class will handle the display according to the message Level.

Possible Levels of include :

  • NONE
  • SIMULATOR_INFO
  • SIMULATOR_DEBUG
  • SIMULATION_INFO
  • SIMULATION_NOTICE
  • SIMULATION_DEBUG
  • ERROR
  • ALL

Direct use of System.ConsoleWriteLine and similar methods is discouraged.