Giter Club home page Giter Club logo

qsanguosha's Introduction

Open Source Sanguosha

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

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.

Features

  1. Framework

    • Open source with Qt graphics view framework
    • Use FMOD as sound engine
    • Use plib as joystick backend
    • Use Lua as AI script
  2. Operation experience

    • Full package (include all yoka extension package)
    • Drag card to target to use card
    • Keyboard shortcut
    • 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

qsanguosha's People

Contributors

againstthecurrent avatar beginnerslob avatar clarkcyt avatar death- avatar donle avatar gaodayihao avatar gutenye avatar haveatry823 avatar hypercross avatar ibicdlcod avatar iven avatar moligaloo avatar pansz avatar paracel avatar pl4y3pic avatar popkc avatar ubun avatar william8915 avatar yanguam avatar yourtommy avatar

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

qsanguosha's Issues

lua的CreateSkillCard接口是否已经失效或更改

myview_card=sgs.CreateSkillCard{
    name="myview_card",
    target_fixed=false,
    will_throw = false,
    once = true,
    filter=function(self,targets,to_select,player)
        return #targets<3
    end,    
    on_use=function(self,room,player,targets)
                --nothing
        return false
    end,    
}

myview=sgs.CreateViewAsSkill{
    name="myview",
    n=0,
    view_filter = function(self,selected, to_select)
        return true
    end,    
    view_as=function(self, cards)
        if #cards==0 then 
            local acard=myview_card:clone()         
            acard:setSkillName(self:objectName())     
            return acard
        end
    end,
    enabled_at_play=function(self,player) 
        return true
    end,
    enabled_at_response=function(self,player,pattern) 
        return false
    end,
}

最简单的视为技能,里面没有任何代码,就一个空壳子,但是运行的时候报错程序崩溃
今天最新的源代码,32位xp系统+QT Creator编译。
麻烦帮忙看一下,这个代码哪里出问题了。

img

按鈕錯位問題

一局遊戲結束后點擊返回主菜單就會出現按鈕錯位的問題。

Rewrite miniscenario loader

Currently there are at least 5 places you need to change simply to add one more miniscene, across several lua, cpp, ini, txt files in all different places; including:

  1. In miniscenarios.cpp, add "ADD_CUSTOM_SCENARIO(34)"
  2. In etc/customScenes, add "34.txt"
  3. In lang/Zh_cn/Mini.lua, add ["_mini_34"] = "SceneName"
  4. In settings.cpp, change "Settings::S_MINI_SCENE_STAGE_TOTAL = 34"
  5. In lua/config.lua, change "for i=1, 34 do"

Even the most experienced programmers should be frustrated by all these mess intended for nothing but trapping them. This is seriously a shame and needs to be untangled.

一张牌不能离手的bug……

呃还是曹植
落英收了一张梅花杀(上一个issue里重复收的一张)
有连弩
用该杀指定目标会出现指示线,有杀的效果
但是不会离手
弃牌阶段弃不掉
嗯就是这样

Need to design new UI to fix xuanhuo.

We have to create a new UI to solve some problem such as got one's cards in a time. If all gose wll, part of the skills also can use the interface, e.g. qixing.

手牌负数&落英bug

孙尚香两手牌,用两张梅花杀和孙权结姻
然后曹植发动四次落英,收进四张梅花杀(相同的两组)
尚香手牌变为-2
原因不明

贯石斧UI需要调整

贯石斧应该在提示弃牌时自动处于选中状态,考虑一下是贯石的技能归类不对还是UI的问题,如果是前者则修改服务器端

Change background image

Replace the current background image with a lighter color one. Besides, adjust opacity of the infoPlane(chatbox and logbox) to 255 in qss.
Background image should be seperate from that of the start scene. Start scene can use fixed bg rather than the one user specified.

found bug:神周瑜发动业炎时程序崩溃

bug现象 神周瑜发动原大业炎时程序崩溃
bug频率:必现(AI和玩家都会)

我调试发现 崩溃点在 CompareByActionOrder ()函数中的 a->getRoom(); 上。 (调试时传入的a并非合理值也非NULL。)

[test] 关于测试的几点建议

主要为了提高测试效率.

增加命令行参数

$ ./QSanguosha [command] [options]
    command ::= roomserver lobbyserver client local
    options 
        -h, --help
        --test
        --limit <secs>
        --mode <mode>

有--test命令的, 就会多出 '自由弃牌', '蛊惑', '仁德', '直谏', '拿来', '天道', '咆哮' 的按钮. (并且这些按钮可以是激活或不激活状态-激活或不激活这个技能. e.g. 默认不激活的有'天道', '咆哮‘)

ui的改进

  • 作弊->伤害制造器的 伤害目标默认选着是当前玩家. (而不是始终是主公)
  • 增加 作弊->青囊 菜单. (里面有确定按钮,最小按钮,最大按钮-直接把血补满.)
  • 作弊->在服务器端执行脚本: 增加历史记录框, 直接双击某个历史就执行了这个脚本。

不明真相的崩溃

2人局(非KOF),我主孙权,对面翼曹仁, 曹仁结束回合(已经出现了回合分界线),游戏崩溃。

落英bug

貂蝉头上贴着梅花乐
于禁拆了
然后曹植发动落英收走了

Lijian Bug

when use Lijian ,the costs won't be discarded.

Something about Dashboard

1.头像处勾玉对齐
2.mark显示位置
3.自由弃牌按钮
4.托管状态的字体显示
5.获得技能时文字移动位置
6.左慈化身牌显示

虎牢关联军能够选择暗将(注:并没开启暗将)

Alt Text

我是吕布,联军三个是电脑,没有开暗将模式,但是联军有一个选择了暗将。

你的回环地址是 127.0.0.1,这个地址仅对你的本机有效
你的局域网地址: 192.168.1.105, 这个地址仅对处于同于同一局域网的用户可用
绑定的端口号: 9527
游戏模式为 4 人局 [虎牢关1v3]
玩家人数为 4
操作时间是 15 秒
自由选将是 启用
双将模式未启用
禁用场景模式
禁用同将模式
暗将模式已关闭
国战模式已关闭
服务器启用了 AI,AI 的延迟是 1000 毫秒
服务器启用了 AI 聊天
127.0.0.1:3435 已连接
QSanguosha AI 20120405 (V0.8 Stable), Powered by Lua 5.1
sgs1 断开

[lua] alternative syntax to write extensions

Here is another way to write skill, trigger, etc. which using object-oriented programming.

Tuxi = class("Tuxi", ViewAsSkill, {
  initialize = function(self)
    ViewAsSkill.initialize(self)
    self.name = "foo"
    self.n = 0
  end,

  view_as = function(self, skill, cards)
    ...
  end
})
tuxi = Tuxi:create() -- need at file scope
zhangliao:addSkill(tuxi)

TuxiCard = class("TuxiCard", SkillCard, {
  initialize = function(self)
    SkillCard.initialize(self)
    self.name = "tuxi"
    self.target_fixed = false
  end,

  on_effect = function(self, card, effect)
    ...
  end
})
tuxi_card = TuxiCard:create() -- need at file scope

There are a lot benefit, For example, zhangchunhua's shangshi.

Shangshi = class("Shangshi", TriggerSkill, {
    initialize = function(self)
        TriggerSkill.initialize(self)
        self.frequency = sgs.Compulsory
    end,

    on_trigger = function(self)
        ...
    end
})

ShangshiStateChanged = class("ShangshiStateChanged", Shangshi, {
    initialize = function(self)
        Shangshi.initialize(self)
        self.events = {sgs.PostHpReduced, ..} 
        self.priority = -1
    end,
})

ShangshiCardMove = class("ShangshiCardMove", Shangshi, {
    initialize = function(self)
        Shangshi.initialize(self)
        self.events = {sgs.CardsMoveOneTime, ..}
        self.priority = 2
    end,
})

Any comments are welcome. Current it's in lua branch, I'll merge it into master if everyone feels fine about it.

EDIT: Actually I prefer this syntax to replace the old one. Use one syntax is better than two.

The Qixing UI has a problem

1.Estimate is not only Qixing has this problem. When a card move from PlaceSpecial, the UI will go wrong.
2.The pile button of self player, it 's menu should always visible, but now it is hide.

Figure out why there is an unreferenced CompareByActionOrder in gamerule.cpp

Our github history has been screwed up. So we are not able to find who's "guilty" for each line of code in current repository. Specifically I find that there is an unreferenced CompareByActionOrder function in gamerule.cpp. It's originally called by case CardUsed of gamerule::trigger. Figure out if the original sorting is really necessary; i yes, add it back; if not, delete the CompareByActionOrder function.

move dashboard's phase to the side

Somehow dashboard's phase icon is now in the center rather than the right. Is this intentional? If not, change the skin settings to move it to the side.

虎牢关第二阶段,神吕布决斗关羽后程序就crash

虎牢关第二阶段,神吕布决斗关羽后程序就crash

  1. 虎牢关第二阶段,神吕布决斗关羽后程序就crash,我是玩的香香,其他角色都是 ai
  2. 另关羽位置不对,UI问题,关羽出牌时把孙尚香的判定区和武器全盖住了

程序是 07-28 commit 75fbff6 最新代码编译的。 windows xp sp2

貌似我听说 程序崩溃后 dmp 目录会生成一些调试文件,但是我这次没有,dmp目录是空的。

Make ViewAsSkill generic for both server and client's usage

Currently viewAs and viewFilter are only for client side usage. To make it usable on server side for anti-cheating and other purposes. Do following things:

  1. Put currentPlayer, currentPhase and ardUseStruct.pattern into RoomState.
  2. Add a function in Engine that can returns a RoomState for both client and server.
  3. Update roomstate accordingly in both server and client side.
  4. Search for "ClientInstance->getStatus()" and "ClientInstance->getPattern()" in all "Solution" scope, replace all of them with Sanguosha->getRoomState()->getStatus(), Sanguosha->getRoomState()->getPattern()

Assertion fail when client receive the following packet

RX: [782,0,1,23,["amazing_grace","sgs5","sgs5"]]
QSanguosha: src/jsoncpp/src/json_value.cpp:692: const char* Json::Value::asCString() const: Assertion `type_ == stringValue' failed.
Aborted (core dumped)

RX is the packet received.

[extensions] package directory

for a user-mod, we can put everything into one folder, it's easy to manage. (add, remove)

<source>/package/
    <name>/
        extenions/
        ai/
        image/
        audio/

依然是卡牌BUG

曹操奸雄一張方片Q的火攻。。。已經攻了幾十次了。。。。還在攻呢。。。

手牌-1張

神憤后會出現手牌-1張的情況。具體出現原因不明。

Baonue is not true

As 0t1's FAQ,it should be confimed that whether damage.from's Kindom is "qun" at the same time as Kuanggu(confirm the distance).
it will make a wrong that :
when Zuoci use Huashen to change to a General whose Kingdom isn't "qun" and do a damage to Caiwenji,if Caiwenji is Dead in this way,Zuoci will turn to himself because of Duanchang(also turn to "qun"),it cannot trigger Baonue in fact,and now it can trigger.

AI Crash

Crossbow
lua/ai/smart-ai.lua:1159: bad argument #1 to 'min' (number expected, got nil)
activate
stack traceback:
lua/ai/smart-ai.lua:122: in function <lua/ai/smart-ai.lua:102>

关于协议包类型的定义。

目前对于包的类型定义,有下列几种:

  •   S_SERVER_REQUEST,
    
  •   S_SERVER_REPLY,
    
  •   S_SERVER_NOTIFICATION,
    
  •   S_CLIENT_REQUEST,
    
  •   S_CLIENT_REPLY,
    
  •   S_CLIENT_NOTIFICATION,
    

实际上,需要描述的有三个层面的信息:

  1. 发送方(SERVER,CLIENT)
  2. 接受方(SERVER,CLIENT)
  3. 类型(REQUEST,REPLY,NOTIFICATION)

现有情况下,因为只考虑了 SERVER to CLIENT 以及 CLIENT to SERVER 的信息,所以,2x3 只有六种类别。

但是,如果 SERVER to SERVER 需要考虑,再加上,ROOMSERVER 与 LOBBYSERVER 两种不同的 SERVER,所以,实际上来源变成了三种:ROOM,LOBBY,CLIENT

实际就会有三个层面:3x3x3 = 27 种类别。

现在有几种方案实现:

  1. 用 27 个枚举来实现,这样仍然保持一个字段,只是类型从现在的 6 种变成了 27 种(当然这其中某些方式可能不会出现,但仍然需要记录下来。这个方案,协议字段数量不变:[1,2,3,4,[]]
  2. 扩展为两个字段,发送方+类型,9个枚举,接受方,3个枚举。这个方案需要在目前的协议中扩展一个字段:[1,2,3,4,5,[]]
  3. 扩展为两个字段,发送方+类型+接受方,各3个枚举。这个方案需要在目前的协议中扩展两个字段:[1,2,3,4,5,6,[]]

哪个比较合适呢?

Several minor UI problems

  1. Huashen cards (Hero cards) animation are too fast to be seen. Consider change the origin of huashen cards created.
  2. Nullification animation to dashboard has a wrong destination.
  3. Need to simulate a cancel button click upon trust button click to avoid hanging forever.
  4. Trust text position need adjustment.

Linux下面编译失败

which: invalid option -- 's'
/usr/bin/qmake
which: invalid option -- 's'
/usr/bin/swig
Generate lua binding code
Generating Makefile using project file
WARNING: Failure to find: src/core/statistics.cpp
WARNING: Failure to find: src/core/statistics.h
Compile it
make: *** No rule to make target `src/core/statistics.cpp', needed by `statistics.o'.  Stop.
Updating '/home/guten/game/nsanguosha/sanguosha.qm'...
    Generated 708 translation(s) (708 finished and 0 unfinished)
Well, everything is OK. You can run it with ./QSanguosha

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.