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
For windows please download binaries from appveyor
https://ci.appveyor.com/project/etorth/mir2x/build/artifacts
If complains missing dll, you may need to copy .dll files from mir2x/bin to mir2x/client and mir2x/server.
mir2x requires cmake v3+ and gcc support c++17 to run. Mir2x needs some pre-installed packages before compile:
libsdl2-dev
libsdl2-image-dev
libsdl2-ttf-dev
libsdl2-mixer-dev
libpng-dev
liblua5.3-dev
libmysqlclient-dev
libfltk1.3-dev
Cmake complains if libs are missing. After install all these dependencies, clone and compile the repo. By default cmake tries to install in /usr/local. use ``CMAKE_INSTALL_PREFIX" to customize.
$ git clone https://github.com/etorth/mir2x.git
$ cd mir2x
$ mkdir b
$ cd b
$ cmake .. -DCMAKE_INSTALL_PREFIX=${PWD}/install
$ make
$ make install
The above steps install binaries in mir2x/b/install. By default mir2x server uses embeded sqlite3. But if you prefer mysql, you have to start mysql server on your host, and create the default database:
$ cd mir2x/b/install/tools/dbcreator/
$ ./main.sh
Start the monoserver, click menu server/launch to start the service before start client:
$ cd mir2x/b/install/server
$ ./monoserver
Start client, currently you can use default account (id = test, pwd = 123456) to try it:
$ cd mir2x/b/install/client
$ ./client
Global variables:
- no globals of builtin types, they are lacking of multithread access control.
- no globals of class instances, use pointer instead, for better construction/destruction control.
- all member functions of globals should be:
- simple
- thread-safe
- atomic operations
- name all global pointers as g_XXXX and use them by extern, and
- allocate them at beginning of main()
- remain valid during the whole run, and ONLY free them at process exit.
Error handling:
- use exception for good/bad path control, force catch at exit of main() or clone().
- do strict parameters checking before doing actual logic, no assumptions.
- let the crash happen ASAP if any fatal error detected
General rules:
- make all member functions self-contained, avoid first/second half logic.
- don't do optimization too early, perfer simple/clear logic.
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.
- 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.
- ThreadPool - A simple C++11 Thread Pool implementation
- astar-algorithm - Implementation of the A* algorithm in C++ and C#