All Projects → fanchy → H2engine

fanchy / H2engine

Licence: gpl-3.0
H2服务器引擎架构是轻量级的,与其说是引擎,个人觉得称之为平台更为合适。因为它封装的功能少之又少,但是提供了非常简洁方便的扩展机制,使得可以用C++、python、lua、js、php来开发具体的服务器功能。H2引擎的灵感来源于web服务器Apache。

Programming Languages

c
50402 projects - #5 most used programming language
js
455 projects

Projects that are alternatives of or similar to H2engine

Kaetram Open
An open-source 2D HTML5 adventure based off BrowserQuest (BQ).
Stars: ✭ 138 (-35.81%)
Mutual labels:  game-engine, mmo
Noahgameframe
A fast, scalable, distributed game server engine/framework for C++, include the actor library, network library, can be used as a real time multiplayer game engine ( MMO RPG/MOBA ), which support C#/Lua script/ Unity3d, Cocos2dx and plan to support Unreal.
Stars: ✭ 3,258 (+1415.35%)
Mutual labels:  game-engine, mmo
Indigo
An FP game engine for Scala.
Stars: ✭ 196 (-8.84%)
Mutual labels:  game-engine
Blah
A small 2d c++ game framework
Stars: ✭ 212 (-1.4%)
Mutual labels:  game-engine
Vulkan Renderer
A new 3D game engine using modern C++ and Vulkan API
Stars: ✭ 205 (-4.65%)
Mutual labels:  game-engine
Astera
A C99 Cross Platform 2D Game Library
Stars: ✭ 193 (-10.23%)
Mutual labels:  game-engine
Flaxengine
Flax Engine – multi-platform 3D game engine
Stars: ✭ 3,127 (+1354.42%)
Mutual labels:  game-engine
Directx12gameengine
DirectX 12 .NET game engine
Stars: ✭ 194 (-9.77%)
Mutual labels:  game-engine
Lumixengine
3D C++ Game Engine - yet another open source game engine
Stars: ✭ 2,604 (+1111.16%)
Mutual labels:  game-engine
Tdengine
game server for Rust + Lua
Stars: ✭ 203 (-5.58%)
Mutual labels:  game-engine
Frag
A cross-platform 2D|3D game framework for the Nim programming language
Stars: ✭ 210 (-2.33%)
Mutual labels:  game-engine
Oksocket
An blocking socket client for Android applications.
Stars: ✭ 2,359 (+997.21%)
Mutual labels:  tcp-server
Dgengine
An implementation of the Diablo 1 game engine
Stars: ✭ 199 (-7.44%)
Mutual labels:  game-engine
Engine
A basic cross-platform 3D game engine
Stars: ✭ 208 (-3.26%)
Mutual labels:  game-engine
G3nd
G3N Game Engine Demo
Stars: ✭ 197 (-8.37%)
Mutual labels:  game-engine
Esenthelengine
Full Source of Esenthel Engine and its Tools
Stars: ✭ 204 (-5.12%)
Mutual labels:  game-engine
Untoldengine
An easy to use, Open-Source, 3D game engine for iOS/macOS game development.
Stars: ✭ 193 (-10.23%)
Mutual labels:  game-engine
Pydark
PyDark is a 2D and Online Multiplayer video game framework written on-top of Python and PyGame.
Stars: ✭ 201 (-6.51%)
Mutual labels:  game-engine
Babylon.js
Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
Stars: ✭ 15,479 (+7099.53%)
Mutual labels:  game-engine
Arsenal
Blender game engine written in Rust.
Stars: ✭ 214 (-0.47%)
Mutual labels:  game-engine

Build Status Gitter

Tank tutorial

client:

server:

  • cmake CMakeLists.txt
  • make h2engine
  • ./h2engine -d
  • make h2workerlua
  • ./h2workerlua

H2Engine 服务器引擎

H2服务器引擎架构是轻量级的,与其说是引擎,个人觉得称之为平台更为合适。因为它封装的功能少之又少,但是提供了非常简洁方便的扩展机制,使得可以用C++、python、lua、js、php来开发具体的服务器功能。H2引擎的灵感来源于web服务器Apache。

  1. H2引擎集成了websocket,也推荐大家在长连接应用中,逐渐使用websocket。
  2. 协议的封包pb、thrift已经很够用了,H2引擎支持pb、thrift、json以及传统二进制struct,但是推荐thrift,主要是效率和多语言支持都更好。
  3. 基于网游服务器的场景,H2引擎考虑到单台物理机的处理能力当前足以应付单服的需求,所以将H2的架构设计为部署在同机上,这样大大简化了服务器的架构,多gate的架构其实来源于rpg刚兴起的年代,那时候服务器的内存有限,cpu多核也还没流行,但是今非昔比,单机模式也就是伪分布式模式其实更符合实际。
  4. 针对传统网游服务器架构中多进程数据共享的痛点,H2做了特殊的设计,由于H2Worker在同一台机器上,得以使H2可以通过共享内存共享数据。   大家知道,Apache+php之所以在web领域里流行,还有很大一个原因是php的框架又多又好用,相比而言,网游服务器领域的引擎、框架都太落后了,主要原因还是服务器没有形成标准。从web的成熟经验来看,功能开发的快,就要有好多框架,要有好的框架,就要有成熟标准的引擎,现在市面上有些游戏服务器引擎就经常会糅合引擎和框架的功能,有的甚至夹杂了游戏服务器的数据结构和游戏逻辑。H2Engine的设计哲学,引擎的归引擎,框架的归框架,虽然跟Apache相比距离“引擎”的称号相距甚远,但是这是H2的目标。另外,基于H2的框架也会不断的增加完善。举个例子,针对rpg游戏,我们可以设计出一套c++的框架,比如封装地图管理、角色管理、道具管理、任务系统、成就系统、副本系统、npc系统等,想想看,2d rpg领域相关的系统还是很好抽象的。问题是没有标准的、成熟的引擎作为基础。相关从业人员应该有共鸣,比如A团队开发一套任务系统,给B团队也是用不了啊,大家的定时器、数据库接口都不一样,无法做到拿来就用。如果大家都用H2,别人开源的系统分分钟就可以拿来用,想象下还是挺美好的。不同的游戏类型框架实现是不一样的,不同语言实现细节也会不同,使用H2Engine引擎后可以根据不同游戏类型、不同语言分类框架。

构建

H2Engine目前只有Linux版本,使用cmake,确保系统安装了cmake

$ cmake  CMakeLists.txt

H2Engine进程分另个,h2engine 和h2worker ,其中h2worker根据使用语言的不同,分h2workerpy、h2workerlua、h2workerjs、h2workerphp,根据你使用的语言构建你需要的h2worker即可。

$ make h2engine
$ make h2workerlua
$ make h2workerpy
$ make h2workerjs
$ make h2workerphp

Windows 下需要下载CodeBlocks,然后打开工程文件h2.workspace

依赖说明:

  • cmake:构建的时候需要
  • python2.6或python2.7:构建h2workerpy的时候需要
  • lua5:构建h2workerlua的时候需要
  • js v8:构建h2workerjs的时候需要
  • libphp5:构建h2workerphp的时候需要,注意需要下载php源码编译出来允许嵌入的版本,./configure --enable-embed --prefix=~/php5dir - --with-iconv=/usr/local/libiconv

运行

$ ./h2engine -d
$ ./h2workerpy
$ ./h2workerlua
$ ./h2workerjs
$ ./h2workerphp

h2engine是核心,需要首先启动,woker进程根据你需要的语言,启动你需要的版本即可。

Further Reading

Contact Information

QQ群

群名称:h2engine 群 号:599634962

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].