Giter Club home page Giter Club logo

qsanguosha's Introduction

Open Source Sanguosha

Homepage: http://qsanguosha.org
API reference: http://gaodayihao.github.com/QSanguosha/api
Documentation: https://github.com/gaodayihao/QSanguosha/wiki (Chinese)

Lisense

Code

This game is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See the LICENSE file for more details.

Material

Our Materials are under the terms of the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)

You are free to:

Share — copy and redistribute the material in any medium or format

Under the following terms:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

NonCommercial — You may not use the material for commercial purposes.

NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material.

See the CC BY-NC-ND 4.0 file for more details.

Introduction

Sanguosha is both a popular board game and online game, this project try to clone the Sanguosha online version. The whole project is written in C++, using Qt's graphics view framework as the game engine. I've tried many other open source game engines, such as SDL, HGE, Clanlib and others, but many of them lack some important features. Although Qt is an application framework instead of a game engine, its graphics view framework is suitable for my game developing. By Moligaloo

Features

  1. Framework

    • Open source with Qt graphics view framework
    • Use FMOD as sound engine
    • Use Freetype in Font Rendering
    • Use Lua as AI and extension script
  2. Operation experience

    • Full package (include all yoka extension package)
    • Keyboard shortcut
    • Double-click to use cards
    • Cards sorting (by card type and card suit)
    • Multilayer display when cards are more than an upperlimit
  3. Extensible

    • Some MODs are available based on this game
    • Lua Packages are supported in this game

HOW TO BUILD

Tips: "~" stands for the folder where the repo is in.

VS2013(Windows)

  1. Download the following packages: (1) QT libraries for Windows (Visual Studio 2013, 5.3.2) http://download.qt-project.org/official_releases/qt/5.3/5.3.2/q

  2. Open Qsanguosha.sln right under ~/builds/vs2013, change the Configuration to Release Qt5|Win32.

  3. Right click project "QSanguosha" in your Solution Explorer, select "Properties", go to "Debugging" tab, set "Working Directory" to "$(ProjectDir)...." (do not enter the quote marks). Then select "OK".

4.1. [optional] Right click "sanguosha.ts" in the folder "Translaton Files" in project "QSanguosha", select "lrelease".

  1. You are now able to build the solution. When compilation succeeded, the QSanguosha.exe is in ~/Bin folder. You should move this file to ~ folder.

  2. Copy 6 files from Qt libraries to ~, they are listed below: Qt5Core.dll Qt5Gui.dll Qt5Network.dll Qt5Qml.dll Qt5Quick.dll Qt5Widgets.dll

    Copy 2 files from VS redist to ~, they are listed below: msvcp120.dll msvcr120.dll

  3. Double-click the QSanguosha.exe and have fun!

Mac OS X

  1. Install XCode from App Store and enable the command tool

  2. Download and install the libraries and Qt Creator from http://download.qt-project.org/official_releases/qt/5.3/5.3.2/qt-opensource-mac-x64-clang-5.3.2.dmg

  3. Download the source code and install swig from http://sourceforge.net/projects/swig/files/swig/ and make sure the version of swig is 3.0.1 or later. Tips: unzip the source code tarball and open a terminal, type: ./configure --without-pcre make sudo make install

  4. Open a terminal here, type: cd swig swig -c++ -lua sanguosha.i

  5. Open QSanguosha.pro with Qt Creator, configure the project and make sure the project is compiled with clang. Change the configuration to Release.

  6. You are now able to build the solution. When compilation succeeded, the QSanguosha.app folder is in ~/../Build-QSanguosha-**/ folder. I highly recommend you move this folder to ~.

  7. This step is the most important and difficult one. Please pay a lot of attention to read this step. Open a terminal here, type:

   otool -L QSanguosha.app/Contents/MacOS/QSanguosha

You'll see something like this:

   QSanguosha.app/Contents/MacOS/QSanguosha:
   ./libfmodex.dylib (compatibility version 1.0.0, current version 1.0.0)
   libfreetype.1.dylib (compatibility version 1.0.0, current version 1.0.0)
   (QtDir)/5.3/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtQml.framework/Versions/5/QtQml (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.3.2, current version 5.3.2)
   /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
   /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
   /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

Pay attention to the 2 lines contains libfmodex.dylib or libfreetype.1.dylib. using install_name_tool to change the path of the 2 library files to their absolute paths, like this:

   install_name_tool -change ./libfmodex.dylib ~/lib/mac/lib/libfmodex.dylib QSanguosha.app/Contents/MacOS/QSanguosha
   install_name_tool -change libfreetype.1.dylib ~/lib/mac/lib/libfreetype.dylib  QSanguosha.app/Contents/MacOS/QSanguosha

Type:

   otool -L QSanguosha.app/Contents/MacOS/QSanguosha

if you see all the directories is absolute path, it should succeed. (~ stands for the project dir)

   QSanguosha.app/Contents/MacOS/QSanguosha:
   ~/lib/mac/lib/libfmodex.dylib (compatibility version 1.0.0, current version 1.0.0)
   ~/lib/mac/lib/libfreetype.dylib (compatibility version 1.0.0, current version 1.0.0)
   (QtDir)/5.3/clang_64/lib/QtDeclarative.framework/Versions/5/QtDeclarative (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtXmlPatterns.framework/Versions/5/QtXmlPatterns (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.3.2, current version 5.3.2)
   (QtDir)/5.3/clang_64/lib/QtScript.framework/Versions/5/QtScript (compatibility version 5.3.2, current version 5.3.2)
   /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
   /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
   /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

Type:

   macdeployqt QSanguosha.app/

Some times the macdeployqt is not in the system directories, in this case you should go to the Qt Install Dir and find this file.

Type:

   otool -L QSanguosha.app/Contents/MacOS/QSanguosha

if you see all the non-system libraries is in @executable_path, it should succeed.

   QSanguosha.app/Contents/MacOS/QSanguosha:
   @executable_path/../Frameworks/libfmodex.dylib (compatibility version 1.0.0, current version 1.0.0)
   @executable_path/../Frameworks/libfreetype.dylib (compatibility version 1.0.0, current version 1.0.0)
   @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.3.2, current version 5.3.2)
   @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.2, current version 5.3.2)
   @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.2, current version 5.3.2)
   @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.2, current version 5.3.2)
   @executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml (compatibility version 5.3.2, current version 5.3.2)
   @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.3.2, current version 5.3.2)
   /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
   /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
   /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

8.copy the following folders and files to QSanguosha.app/Contents/MacOS/, they are listed below:

   ai-selector/
   audio/
   developers/
   diy/
   font/
   image/
   lang/
   lua/
   rule/
   skins/
   ui-script/
   qt_zh_CN.qm
   sanguosha.qss

8.1 [optional] select Tools/External/QtLinguist/lrelease, copy ~/Builds/vs2013/sanguosha.qm to QSanguosha.app/Contents/MacOS.

  1. Double-click QSanguosha.app folder and have fun!

Linux or MinGW(Windows)

  1. Download and install the libraries and Qt Creator from Qt offical website or software sources, make sure the version of Qt libraries is 5.3.x. (I strongly recommand you download the libraries and Qt Creator from software sources in Linux, because the compliation causes a lot of time) (If you are using MinGW, make sure the version of MinGW is compatible with Qt Libraries)

  2. Install SWIG (Linux)Download and install the swig from http://sourceforge.net/projects/swig/files/swig/ or software sources, make sure the version of swig is 3.0.1 or later.

    (MinGW)Download the swigwin (swig for Windows, 3.0.2) http://sourceforge.net/projects/swig/files/swigwin/ Create a ~/tools/swig folder under your source directory. Unzip swigwin and copy all unzipped files to ~/tools/swig.

  3. Open a terminal here, type: (Linux)

   cd swig
   swig -c++ -lua sanguosha.i
   cd ../lib/linux
   (x86)cd x86 (or) (x64)cd x64
   sudo cp libfmodex*.so /usr/lib (root password required)
   sudo ldconfig

(MinGW)

   cd swig
   ..\tools\swig\swig.exe -c++ -lua sanguosha.i
  1. Open QSanguosha.pro, configure the project and make sure the project is compiled with g++. Change the configuration to Release.

  2. (optional) select Tools/External/QtLinguist/lrelease, copy ~/Builds/vs2013/sanguosha.qm to ~.

  3. You are now able to build the solution. When compilation succeeded, the (MinGW)QSanguosha.exe or (Linux)QSanguosha is in ~/../Build-QSanguosha-**/ folder. You should move this file to ~ folder.

  4. (MinGW only) Copy 8 files from Qt libraries to ~, they are listed below:

   Qt5Core.dll
   Qt5Gui.dll
   Qt5Network.dll
   Qt5Qml.dll
   Qt5Quick.dll
   Qt5Widgets.dll

(MinGW only) Copy 3 files from MinGW bin folder to ~, they are listed below:

   libgcc_s_dw2-1.dll
   libstdc++-6.dll
   libwinpthread-1.dll

qsanguosha's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qsanguosha's Issues

src/setting.cpp

ifndef QT_NO_DEBUG
default_host = "irc.freenode.net"

條件編譯else內容後面忘記";"了,
大概在62行

win下编译的问题,求教

在win下编译的时候出现不能连接static-libircclient.lib和irrKlang.lib的问题。
前面编译时还有找不到"resource/icon/sgs.ico",修改icon.rc里的路径过掉了。
问一下是不是我的qt配置有问题?

linux編譯[QSanguosha.pro]

請將QSanguosha.pro中unix里
LIBS += -laudiere
修改為
LIBS += -laudiere -lircclient

添加 -lircclient

编译问题求教

我用QtCreator无法链接那个静态库,想请教一下作者你的编程环境。我现在准备用MSVC编译Qt了,但就怕是不需要。。。

Linux 下单机模式无法启动

看了一下,原因是 Linux 下面没有 USERNAME 这个环境变量,需要用 USER 替代,而 Windows 下面又没有 USER ……

详见 src/setting.cpp 第 61 行。

A bug about Zuoci

Version: guixin-45-3819ae2

Description: according to the FAQ on qsanguosha.com, Zuoci can only change the skill of Huashen if he changes the general he chooses, and an example given there is about Huatuo. It says that according to this rule, Zuoci cannot choose Qingnang within his phase and Jijiu outside his phase to perfectly simulate Huatuo. Yet in the game it is possible. Hopefully it would be fixed soon. Thank you very much.

Relevant link:http://www.qsanguosha.com/attachment.php?aid=MTA4MjF8ZWM3ZGM0M2R8MTMxMTMwOTcxMnxlZGJkTmdkc3FjSWdrN0ZqL0I4M2c5UDBvU1h3cUFQNTRGWjkzaDdIQ08xY0pTUQ%3D%3D&noupdate=yes

when i run swig.sh,i get error

error message:
sanguosha.i:437: Error: 'Equip' is multiply defined in the generated module.
sanguosha.i:63: Error: Previous declaration of 'Equip'
sanguosha.i:590: Error: 'Skill' is multiply defined in the generated module.
sanguosha.i:434: Error: Previous declaration of 'Skill'

how can i fix it?

Linux 下编译错误,麻烦解决一下

看起来似乎有些类型在 Linux 下没有:

src/server.cpp: 在成员函数‘void Server::daemonize()’中:
src/server.cpp:379:9: 错误:‘WORD’在此作用域中尚未声明
src/server.cpp:379:14: 错误:expected ‘;’ before ‘wVersionRequested’
src/server.cpp:380:9: 错误:‘WSADATA’在此作用域中尚未声明
src/server.cpp:380:17: 错误:expected ‘;’ before ‘wsaData’
src/server.cpp:382:21: 错误:‘wVersionRequested’在此作用域中尚未声明
src/server.cpp:382:41: 错误:‘wsaData’在此作用域中尚未声明
src/server.cpp:382:48: 错误:‘WSAStartup’在此作用域中尚未声明
make: *** [server.o] 错误 1

qmake时的问题

本人使用的系统是centos5.5,自带qt3,后来安装了qt4,
在qmake时,出现下列错误,请帮帮忙,谢谢!
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer

Untitled

请修改为
unix {
LIBS += -lm -llua -lIrrKlang -lplibjs -lplibul
}

swig的问题

为什么我打开swig,他就闪了一下命令提示符就没了。。。。。。。。。我的版本是2.0.4

-server 模式未加载扩展包设置

根据当前代码版本

server.cpp:799 给客户端发送服务器设置,其中包含禁止的扩展包
socket->send("setup " + Sanguosha->getSetupString());

engine.cpp:382 getSetupString中 :406 获取禁止的扩展包
<< Sanguosha->getBanPackages().join("+")

:267 getBanPackages 是从 :268 ban_package 中获取数据
return ban_package.toList();

而 ban_package 是由 :263 Engine::addBanPackage 中的 :264 设置
ban_package.insert(package_name);

调用 addBanPackage 在 server.cpp:723 即启动服务器设置对话框保存设置时
Sanguosha->addBanPackage(package_name);

因为服务器未以 GUI 启动,所以 ban_package 无值
我暂时将 engine.cpp:268
return ban_package.toList();
改为
return Config.BanPackages;
解决该问题

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.