netcan / AnimalChess

Animal Fight Chess Game(斗兽棋) written in rust.
https://netcan.github.io/2020/06/07/%E7%94%A8Rust%E5%86%99%E4%B8%80%E4%B8%AA%E6%96%97%E5%85%BD%E6%A3%8B%E6%B8%B8%E6%88%8F/
MIT License
94 stars 12 forks source link

How to run this on (64bit) windows (7) ? #3

Open JSettler opened 3 years ago

JSettler commented 3 years ago

Good day, how can i run this interesting game under windows 7 (64bit) ?

netcan commented 3 years ago

for windows, see https://github.com/Rust-SDL2/rust-sdl2#windows-msvc and cargo build

JSettler commented 3 years ago

Thank you for the answer, but i don't have enough space on C: left. Can i install Rust without having to install the Windows 10 SDK to my system (C:) drive?

netcan commented 3 years ago

Thank you for the answer, but i don't have enough space on C: left. Can i install Rust without having to install the Windows 10 SDK to my system (C:) drive?

you can choose Windows (MinGW) alternate way, it doesn't need msvc(windows sdk)

JSettler commented 3 years ago

Firstly, thank you very much for this great implementation and your hard work, i finally managed to build and play with it! :) Kudos. I have re-partitioned my hard-disc drive (i moved a partition into a free space, with an external tool, and then extended the C: partition into the newly created free space). Now my C: drive has ~90 GB capacity, thanks to being motivated by your great project (before this change it had only 40 GB, and i was unmotivated to change anything^^). I was able to install the Visual C++ Build tools and the RustUp-installation, then i downloaded the SDL2-libs and copied those into their Rust-folder (this was all a learning process for me, too!), while trying to compile i got errors, because the install wasn't as easy, i had to manually move some SDL-files to their folders (after searching for their static libraries in the interwebs), but after some trial & error i could build the project and play some games! Yay! :)

I already found a weakness (bug?) in the engine: it attacked with its mouse, which i could capture, i guess it tried to achieve a tempo or a good attack position, but it seemed to suffer from horizon-effect, after that i was able to gain the upper hand and defeat it in my first game. But the engine is quite good, if one takes into account that it only searches 7-8 plies/half-moves deep (as shown in the console). Can i give it parameters to set its thinking/searching depth?

JSettler commented 3 years ago

AnimalChessx86-64(depth7-8).zip (i forgot to upload the executable, here it is, readily bundled with all needed windows-DLLs) (its VT-report: https://www.virustotal.com/gui/file/24b08d75ae6735bd8751869caaa6aed15b9e488b0dc18921536017e3f396b490/detection )

[Edit:] Do you know of this Dou Shou Qi code? (It's based on an engine which was made by Jonathan K. Vis of LIACS institute.) doushouqi_['OpenDag' based on 'Bagheera'].zip

And lastly, another Dou Shou Qi program i had stored on my backup-hdd (i found it many years ago, in a now defunct website). Unfortunately, it is only for win32. But it does work really well under linux/wine :) [i tested that many months ago] AnimalChess (jungle game by skookumpete).zip (its VT report: https://www.virustotal.com/gui/file/37db9529bc7beecb1f510a1ca383899f50aefb1f79b3f7e50517ef871094ff13/detection )

netcan commented 3 years ago

I already found a weakness (bug?) in the engine: it attacked with its mouse, which i could capture, i guess it tried to achieve a tempo or a good attack position, but it seemed to suffer from horizon-effect, after that i was able to gain the upper hand and defeat it in my first game.

https://github.com/netcan/AnimalChess/blob/master/core/src/player/alpha_beta.rs#L47 here is strategy file, each chess has weight needs adjust.

But the engine is quite good, if one takes into account that it only searches 7-8 plies/half-moves deep (as shown in the console). Can i give it parameters to set its thinking/searching depth?

Max depth sets to 100, but it limits in time: 500ms, you can adjust time. https://github.com/netcan/AnimalChess/blob/master/core/src/player/alpha_beta.rs#L221

JSettler commented 3 years ago

Thank you for your kind help :) You might be interested into this subreddit: https://www.reddit.com/r/DouShouQi There i put all DSQ-links i found on the web. And i also posted download links for new executables of your program. (eg. this updated zipfile, which now contains 4 versions of it: AnimalChesswin64[r2].zip )

JSettler commented 3 years ago

Found a weird bug: it sometimes declares its own win, when repeating a position for the third time. Normally, a repetition is either:

netcan commented 3 years ago

Found a weird bug: it sometimes declares its own win, when repeating a position for the third time. Normally, a repetition is either:

  • a draw (remis) , or
  • illegal by rule , or
  • a loss for the causing side
  • or be avoided by the AI engine But never a win for the player who causes it.

there is a special rule to prevent game loop forever. you can simply modify check_win to disable it.

https://github.com/netcan/AnimalChess/blob/master/core/src/board.rs#L202

AnkoGo123 commented 3 years ago

我按照这个库 https://github.com/Rust-SDL2/rust-sdl2#windows-msvc 教程来做,还是编译出错,so sad!

netcan commented 3 years ago

我按照这个库 https://github.com/Rust-SDL2/rust-sdl2#windows-msvc 教程来做,还是编译出错,so sad!

msvc不行还有mingw方案...你也可以用这个人预编译好的包,不过是斗兽棋版本。

AnkoGo123 commented 3 years ago

没,我这边要多少更改下,所以不会用他编译好的程序,我是想通过js调用rust代码来实现和cocos creator结合在一起。我也是无奈的选择,我的rust基础仅仅是初步了解,我对go更加熟悉

---Original--- From: @.> Date: Sun, Aug 29, 2021 09:42 AM To: @.>; Cc: @.**@.>; Subject: Re: [netcan/AnimalChess] How to run this on (64bit) windows (7) ? (#3)

我按照这个库 https://github.com/Rust-SDL2/rust-sdl2#windows-msvc 教程来做,还是编译出错,so sad!

msvc不行还有mingw方案...你也可以用这个人预编译好的包,不过是斗兽棋版本。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

AnkoGo123 commented 3 years ago

你的象棋我终于编译通过后,才发觉没ai的...,然后我来编译这个斗兽棋:结果出现这个错误,之前的象棋我都可以运行过了,为什么这个就不能过呢?很奇怪,hub主可以给点建议吗?如下图: image

netcan commented 3 years ago

你的象棋我终于编译通过后,才发觉没ai的...,然后我来编译这个斗兽棋:结果出现这个错误,之前的象棋我都可以运行过了,为什么这个就不能过呢?很奇怪,hub主可以给点建议吗?如下图: image

检查一下你clone下来的rust-sdl2目录是不是空的。用下面的命令重新clone下。

git clone --depth=1 --recursive https://github.com/netcan/AnimalChess.git
AnkoGo123 commented 3 years ago

非常感谢您的及时帮助,我稍后尝试

---Original--- From: @.> Date: Sun, Aug 29, 2021 20:27 PM To: @.>; Cc: @.**@.>; Subject: Re: [netcan/AnimalChess] How to run this on (64bit) windows (7) ? (#3)

你的象棋我终于编译通过后,才发觉没ai的...,然后我来编译这个斗兽棋:结果出现这个错误,之前的象棋我都可以运行过了,为什么这个就不能过呢?很奇怪,hub主可以给点建议吗?如下图:

检查一下你clone下来的rust-sdl2目录是不是空的。用下面的命令重新clone下。 git clone --depth=1 --recursive https://github.com/netcan/AnimalChess.git

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

AnkoGo123 commented 3 years ago

你的象棋我终于编译通过后,才发觉没ai的...,然后我来编译这个斗兽棋:结果出现这个错误,之前的象棋我都可以运行过了,为什么这个就不能过呢?很奇怪,hub主可以给点建议吗?如下图: image

检查一下你clone下来的rust-sdl2目录是不是空的。用下面的命令重新clone下。

git clone --depth=1 --recursive https://github.com/netcan/AnimalChess.git

可以的,终于成功了,研究了你的项目3天,好艰辛的说,比go真的麻烦太多了。。之后我会在你的2个项目补全这些东西,希望能帮助到后来的人。目前你的象棋没ai,确实有点遗憾,后期我研究好算法后补上,但是这个算法真的不简单,,,我能力有限,包涵

AnkoGo123 commented 3 years ago

千辛万苦终于在win10跑起来了,参考链接:https://www.cnblogs.com/kileyi/p/11375216.html 依据本项目,注意文章提到的 Cargo.toml文件中不要加入 [dependencies] sdl2 = "0.32"

保持hub主原样Cargo.toml内容即可

编译后提示其他缺少的lib库下载:https://www.libsdl.org/projects/ 自行fan墙

AnkoGo123 commented 3 years ago

建议hub主采用这个gui库:https://github.com/hecrj/iced ,才没这么多艰难的依赖,单是搭建环境都要一周。。。即使是linux也不简单,,,而且我还是老手。。。

AnkoGo123 commented 3 years ago

编译后将AnimalChess\target\debug\animal_chess.exe复制到AnimalChess目录下即可执行,尚不知能否在别人电脑执行,可能需要上面介绍到的其他东西,待验证

AnkoGo123 commented 3 years ago

编译后将AnimalChess\target\debug\animal_chess.exe复制到AnimalChess目录下即可执行,尚不知能否在别人电脑执行,可能需要上面介绍到的其他东西,待验证

经过测试可以在别人电脑运行