ketoo / 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.
https://github.com/ketoo/NoahGameFrame/wiki
Apache License 2.0
3.92k stars 1.09k forks source link
architecture game game-development game-engine game-server gamedev gameserver mmo mmorpg server-architecture unity unity3d

2021.7.9 在新西兰奥克兰的一场车祸中,ketoo 永远离开了我们。

On July 9, 2021, ketoo left us forever in a car accident in Auckland, New Zealand.

由于mater有权限合并了, master-new 分支后续不再维护。 直接维护master即可,pr也提交到master即可

Since mater has permission to merge, the master-new branch will no longer be maintained. You can directly maintain the master, and the pr can also be submitted to the master

NoahGameFrame

QQ群:330241037 NF开源服务器引擎2群

Tutorial && Documents

https://github.com/ketoo/NoahGameFrame/wiki

What is NoahGameFrame?

NoahGameFrame (NF) is a lightweight, fast, scalable, distributed plugin framework. NF is greatly inspired by OGRE and Bigworld.

Features

Tutorial && Documents

https://github.com/ketoo/NoahGameFrame/wiki

Architecture

App Architecture:

App Architecture

Server Architecture

Server Architecture

Get the Sources:

git clone https://github.com/ketoo/NoahGameFrame.git

or

svn checkout https://github.com/ketoo/NoahGameFrame

Dependencies

Tutorial && Documents

https://github.com/ketoo/NoahGameFrame/wiki

IF YOU CAN NOT BUILD THE DEPENDENCIES THEN PLEASE RUN THE CMDS BELOW TO SET UP THE ENVIRONMENT:

Supported Compilers

Build and Install

FOR WINDOWS, MSVC >= 2019

  1. Git pull all source
  2. Run the script file named build_dep.bat where located /Dependencies (墙内上网的同学请点击:墙内下载依赖库.bat)
  3. Build the solution(if u build failed, please build again(not rebuild all))
  4. Run the binary file by _Out/rund.bat

FOR LINUX(UBUNTU, CENTOS) ---- please use administrator(or sudo) to do these:

  1. Git pull all source
  2. Run install4cmake.sh to build NF (or run cd /Dependencies ./build_dep.sh then run buildServer.sh)
  3. Run the binary file by _Out/rund.sh

IF YOU LIVING IN A COUNTRY CANNOT ACCESS GITHUB FASTLY PLZ BUILD NF WITH VPN

HOW TO RUN HELLO WORLD

https://github.com/ketoo/NoahGameFrame/wiki/How-to-run-the-Helloworld

HOW TO DEBUG WITH UNITY3D

https://github.com/ketoo/NoahGameFrame/wiki/How-to-debug-with-unity3d

Unity Multiplayer Demo

WebSite: https://github.com/ketoo/NFUnitySDK

Showcase

Tutorial && Documents

https://github.com/ketoo/NoahGameFrame/wiki

License

The NFrame project is currently available under the Apache License.

Tutorial:

01-Hello world, add a module


// -------------------------------------------------------------------------
//    @FileName         :    HelloWorld1.h
//    @Author           :    ketoo
//    @Date             :    2014-05-01 08:51
//    @Module           :   HelloWorld1
//
// -------------------------------------------------------------------------

#ifndef NFC_HELLO_WORLD1_H
#define NFC_HELLO_WORLD1_H

#include "NFComm/NFPluginModule/NFIPluginManager.h"

class HelloWorld1
    : public NFIModule
{
public:
    HelloWorld1(NFIPluginManager* p)
    {
        pPluginManager = p;
    }

    virtual bool Init();
    virtual bool AfterInit();

    virtual bool Execute();

    virtual bool BeforeShut();
    virtual bool Shut();

protected:

};

#endif

#include "HelloWorld1.h"

bool HelloWorld1::Init()
{
    // Use this for initialization

    std::cout << "Hello, world1, Init" << std::endl;

    return true;
}

bool HelloWorld1::AfterInit()
{
    // AfterInit is called after Init

    std::cout << "Hello, world1, AfterInit" << std::endl;

    return true;
}

bool HelloWorld1::Execute()
{
    // Execute is called once per frame

    //std::cout << "Hello, world1, Execute" << std::endl;

    return true;
}

bool HelloWorld1::BeforeShut()
{
    //before final

    std::cout << "Hello, world1, BeforeShut" << std::endl;

    return true;
}

bool HelloWorld1::Shut()
{
    //final

    std::cout << "Hello, world1, Shut" << std::endl;

    return true;
}

02-Hello world, test data driver


03-Hello world, test heartbeat and event system


04-Hello actor, test actor model(async event system)

How to Create a New LuaScriptModule

Step 1

Create a Lua Script File, and Must Contain following functions

Mostly like this

test_module.lua

test_module = {}
register_module(test_module,"test_module");

function test_module.awake()

end

function test_module.init()
end

function test_module.after_init()
end

function test_module.ready_execute()
end

function test_module.before_shut()
end

function test_module.shut()
end

Step 2

Add your LuaScriptModule Infomation into script_list.lua

ScriptList={
    {tbl=nil, tblName="TestModule"},
    {tbl=nil, tblName="TestModule2"},
}

load_script_file(ScriptList)

Hot fix

Add your lua script file name on here script_reload.lua


New Feature in future: Blue Print System

Demo:

Showcase


Amazing open source projects:

breeze

gce

moon

Tutorial && Documents

https://github.com/ketoo/NoahGameFrame/wiki