Giter Club home page Giter Club logo

chess's Introduction

双人象棋

image

go实现的双人象棋,支持在线对战

功能描述

可以通过客户端,登陆注册 , 加入房间对战、观战

技术细节

棋盘通过ebtien 库绘制,键鼠交互

客户端调用服务器接口

邮箱注册登录

进入房间,人满2人自动开始,他人可进入观战

客户端发起tcp请求,发送棋盘数据给服务器,服务器推送到websocket , 客户端再通过协程监听websocket连接读取棋盘数据,然后进行实时渲染

客户端负责逻辑处理,服务端仅负责收发数据,因此并发较高

棋局回放:服务器拿到棋盘数据根据用户信息入库,后续客户端访问接口,服务器定时从websocket推数据,服务器拿数据本地渲染回放(未做完)

使用方法

client文件夹单独放在一个项目中,可以多开几个项目测试,运行即可,按照提示输入邮箱和用户名,然后查看验证码,输入验证码,输入房间号(最好6位),若未满两人会进行等待,满两人自动开始,先进入的为红方

或者通过EXE文件双击运行

接口简述

//发送邮箱验证码
r.POST("/getmailac", getmailac)
//登录注册
r.POST("/login", login)
//拿token
r.POST("/auth", authHandler)
//进入房间 进入升级为ws连接 然后进行初始化 本地维护room和roomcount
r.GET("/enterroom/:roomId", JWTAuthMiddleware(), enterroom)
//检查人数
r.POST("/checkroomcount", checkroom)

chess's People

Contributors

lluckyboi avatar

Stargazers

 avatar

Watchers

 avatar

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.