Manic Digger is currently in pre-alpha development. You can find a to do list of features and bug fixes that are currently being worked on by developers at the moment.
Acquire the Source Code
- Download the latest msysgit (preview version).
- Install mysysgit using the standard options in the wizard.
- Download the latest 32 bit or 64 bit TortoiseGit for your copy of Windows. (How do I know if I need 32-bit or 64-bit?)
- Install TortioseGit using the standard options in the wizard.
- Create an empty folder in a location where you would like the code to be stored.
- Right-click on the new folder and select Git Clone...
- Put the following URL into the url textbox: git://manicdigger.git.sourceforge.net/gitroot/manicdigger/manicdigger and select OK
- At this point the source code should download, when it is finished select Close. The code should now be in the folder.
Compiling the Source Code
- Download Visual C# Express.
- VS 2010 works, but VS 2008 is better because project files are in VS 2008 format. Project files are automatically converted when opened in VS 2010, but MD uses VS 2008 format for compatibility.
- Install Visual C# Express with the default install wizard prompts. Allow your computer to restart after installation (if asked to by the install wizard).
- Open Visual C# Express, select File > Open Project... then navigate to your project and open the ManicDigger.sln solution file.
- At this point the source code can be compiled by selecting Build > Build Solution or by pressing Ctrl + Shift + B.
- Once compiled run build.bat in the Manic Digger directory to create a folder called "output" with all the files needed for client and server.
- The code can also be run by selecting Debug > Start Without Debugging or pressing Ctrl + F5
- Execute build.bat in the post build event...
- Get newest MonoDevelop - packages for Ubuntu 10.4 are available at http://badgerports.org. This is needed because current version in main Ubuntu repository has a bug - doesn't copy game data when running game in debugger.
Submitting Code Changes (Make a Patch)
- Important: Before submitting code changes, make sure that your changes work and do not break the game.
- Important: Before attempting refactoring, make patches with fixes / features first. See Open Source Contribution Etiquette. Best patches have screenshots or graphs.
Windows with TortoiseGit
- After making changes to the code, navigate to the base folder, right-click on it and select Git Commit -> "master".
- Enter a commit message about the changes made, then select OK.
- Git should report a Success on the commit. Select Close.
- Right-click on the base folder again and select Tortoise Git > Show Log.
- Right-click on the change in the list and select Format Patch.
- Select OK, and then close the success confirmation and the log window.
- Right-click on the base folder again and select Tortoise Git > Create Patch Serial....
- Select OK, then close the success confirmation.
- There should now be a .patch file inside the base directory. Use this file to post to the development forums.
- After sending some good patches you can get full repository access.
First: apt-get install git (if it's not installed)
git clone git://manicdigger.git.sourceforge.net/gitroot/manicdigger/manicdigger ...edit file.txt in editor cd manicdigger git add file.txt git commit -m "description of changes" git log -p git show 189e77252288349ade321543ce61600d9b55d211 > mypatch.patch
Diff of the most recent commit:
git diff HEAD^ HEAD
- If your patch includes a binary executable code (.dll library, .exe application) then provide a link to original distribution so we can verify that it's not malicious.
Main game code is inside ManicDiggerGameWindow class. When a piece of code is reusable, it should be moved to a separate class.
Why use .NET 2.0 instead of .NET 3.5 or .NET 4.0?
LINQ (.NET Framework 3.5) isn't included with Windows Vista or Windows XP. It would require installation of 200 MB update just to start game. Even on Windows XP .NET 2.0 is better because the download is only 20 MB. Also NET 3.5 doesn't work well on old versions of Mono.
Oldest version of MD required .NET 3.5. But change to 2.0 was worth it, especially with comparison to changes needed for running on Ubuntu/Macintosh:
- Change: 10 lines, <0.1% of code.
- Usage: 60% of computers
- Change: 5000 lines, 20% of code. (new menu/launcher, fixes)
- Usage 5% of computers.
- Code should be easily portable to other languages (for example C++):
- Don't use reflection. [what about xml serialization?]
- Don't use generators (iterators).
- When allocating memory with 'new' make sure it's easy to find a place where it should be deallocated.
- Don't use multidimensional arrays. (use MapUtil.Index3d() instead).
- External libraries should be accessed in single place/single class per library. [IOpenGl interface?]
- Don't use inline XML comments - they are too big. Even Mono and .NET don't use xml comments in their own BCL sources , .
Manic digger uses dependency injection.
- Don't use global (static) variables and functions. (except for simple math or helper functions). Don't use singletons.
- Inherit interfaces, don't inherit implementation (classes).
- Setup all components in Main().
- Don't allocate memory every frame.
- Use T, don't use List<T> or Dictionary<T1, T2>.
- Reuse arrays.
- When accessing multiple blocks, use Map.GetChunk() instead of Map.GetBlock().
- Inline functions in slowest loops.
- Use DateTime.UtcNow instead of DateTime.Now.
To add data file, edit GameModeFortress.csproj in notepad - it's not possible to setup relative path in Visual Studio.- Now game always reads from /data/ path.