mir2x is a c/s based mir2ei implementation with various platforms supported. It contains all need components for game players and developers:
- client
- monoserver
- pkgviewer
- animaker
- mapeditor
- dbcreator
mir2x requires cmake v3+ and gcc support c++14 to run.
Install the dependencies and devDependencies and start the server.
$ git clone https://github.com/etorth/mir2x.git
$ cd mir2x
$ mkdir b
$ cd b
$ cmake ..
$ make
global variables:
- don't use global of build-in type or struct since no multithread control.
- don't use global of class instanse since confusing construction/distruction.
actually:
- only use class pointer;
- only reference it by ``extern g_VarXXX";
- no local function for operation on global variable only, means:
- all operations over global variables should be self-contained;
- all global variable pointers stay valid during the whole procedure;
Since I already have a powerful log system, I won't use exception. If un-recoverable error happens
- log system record the detailed info by LOGTYPE_FATAL;
- then just let it crash, or use exit(0) to do forced kill;
The function who throws always think it's a fatal error so it just throw, but how to handle this ``fatal" error or do catch sub-clause really takes it as fatal is decided not by the thrower, but the catcher.
For modules like mapeditor which doesn't have a log system, always put assertion to check parameters. If functions invoked with invalid parameters, fail assertion and let it crash.
General rules for functions:
- put strict parameters check above doing actual logic;
- take invalid argument as severe error, just log the error and let it crash;
- never give assumption for argument;
- try best to make each memeber function self-contained to avoid first-half / second-half splitted functions;
General rules for classes:
- an object should be in legal state when created, by factory method or constructor;
- an object should stay valid if no input provided;
- put strict parameters check when provide input to objects, and reject immedately if not valid;
- avoid to do state validation outside an object;
- external call of member function should never break current object, keep log instead;
mir2x uses a number of open source projects to work properly, and of course itself is open source with a public repository on github, please remind me if I missed anything.
- SDL2 - A cross-platform development library designed to provide a hardware abstraction layer.
- FLTK - A cross-platform C++ GUI toolkit for UNIX®/Linux® (X11), Microsoft® Windows®, and MacOS® X.
- asio - A cross-platform C++ library for network and low-level I/O programming.
- theron - A lightweight C++ concurrency library based on the Actor Model.
- g3log - An asynchronous, "crash safe", logger that is easy to use.
- lua - A powerful, efficient, lightweight, embeddable scripting language.
- sol2 - A fast, simple C++ and Lua binding.
- mariadb - A community-developed fork of the MySQL relational database management system.
- luasql - LuaSQL is a simple interface from Lua to a DBMS.
- tinyxml2 - A simple, small, efficient, C++ XML parser.
- utf8-cpp - A simple, portable and lightweigt C++ library for UTF-8 string handling.
- libpng - The official PNG reference library.
- libzip - C library for reading, creating, and modifying zip archives.
- ThreadPool - A simple C++11 Thread Pool implementation
- astar-algorithm - Implementation of the A* algorithm in C++ and C#