Skip to content

GreatEmerald/libarcomage

Repository files navigation

libarcomage v0.2.0
Revision 2016-07-03, GreatEmerald

The backend library for card games, where two players use resources to play 
cards with a variety of effects that help build their own tower or destroy the 
opponent's tower as quickly as possible.

The library written in D, and uses Lua scripts to allow users to easily create 
new cards or card decks, or to alter the computer AI. These changes apply to 
any frontend to the library.

Make sure to install a frontend, like DArcomage or CLArcomage, to be able to 
actually play.


========
BUILDING
========

Building libarcomage itself is only relevant to Linux systems, as Windows does 
not yet support building dlls from D source code. For build instructions there, 
refer to build instructions for each individual frontend.

To build the shared library on Linux, you need:
  Mandatory:
    DMD 2.052+ (Digital Mars D compiler): 
http://www.digitalmars.com/d/download.html
    Lua 5.1 (liblua5.1-dev on Debian and lua-devel on openSUSE)
    Make (GNU Make, gmake)
    CMake 3.0+ (cmake)
  Optional (bundled):
    LuaD (libluad)

NOTE: D compilers other than DMD were not tested, but might also work. However, 
the CMakeD build system may not properly support them at this time. Patches 
welcome.

If you have cloned the repository from git, and don't have LuaD installed, then 
enable the bundled LuaD by updating git submodules:

git submodule update --init

The build process involves changing directory to "build", running CMake, then 
running make and finally install with either make install or by using CPack to 
generate an RPM, then installing it with a native package manager. You can pass 
the build type to CMake to change the build optimisation. All the commands, in 
short, are:

cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

By default, it is assumed that you have LuaD installed as a shared library. If 
you want to compile it statically into libarcomage itself, tell CMake about it:

cmake -DCMAKE_BUILD_TYPE=Release -DDYNAMIC_LINKING=NO ..

If the library gets installed to the wrong lib{,32,64} directory, you can pass 
it to CMake too:

cmake -DCMAKE_INSTALL_LIBDIR=/usr/lib64 ..

To install directly:

make install

Or to make an RPM:

cpack -G RPM

Which you can then install, for instance:

zypper install libarcomage*

=========
STRUCTURE
=========

This project includes several directories, whose use may not be obvious at first
glance, so I have provided an overview of the directory structure for the
library sources below.

  +-- build
  +-- candydoc
  +-- cmake
  +-- include
  |   +-- LuaD
  +-- lua
  |   +-- Arcomage
  |   +-- MArcomage
  |   +-- Touhou
  +-- src
  +-- utils
  |-- CMakeLists.txt
  |-- COPYING.TXT
  |-- CREDITS.TXT
  |-- DESCRIPTION.TXT
  |-- README.TXT

build is a placeholder directory where all the files generated by cmake should 
go to.

candydoc contains the files of CanDyDoc, the D documentation framework.

cmake contains the CMakeD module that tells CMake how to compile D code.

include contains the source code of LuaD, used to read Lua-based configuration 
files.

lua contains the Lua scripts for the game. They control the configuration, 
manage installed card decks and define computer AI, and thus are needed to run 
the game. lua/Arcomage contains the information about the stock Arcomage deck, 
lua/MArcomage will contains some of the cards used in the MArcomage project, and 
Touhou is a deck based on spell cards from the Touhou Project.

src is the D source code. That's the crucial (and the most interesting) part of
the project, since the D code is at the core of the program and manages the
whole logic of the game, such as player statistics, card queue, executes actions
performed by cards etc.

utils contains miscellaneous utilities for building the code. They were used 
before the transition to CMake. Now their use is discouraged, but they are 
fairly simple and thus are useful to see what is supposed to be happening during 
compilation under the hood (but they are static, so likely won't work without 
adjustments).

CMakeLists.txt is part of the CMake build system, not a human-readable file.

COPYING.TXT is a text file that contains GPL licensing information.

CREDITS.TXT is a text file that notes people who have contributed or helped the
project in some way, as well as the libraries used by the project.

DESCRIPTION.TXT is a package description, used by CPack to make nice installers.

README.TXT is this file, in case you haven't noticed :)