Simple erl game server framework中文
Compiled by rebar3, or execute the compile.bat script.
start.bat or start.sh
Go to client and execute run.bat, which is simply implemented by python script.
In the proto directory, press serial number + module name.proto (e.g. 1login.proto, 2role.proto...) Write the protocol and click run.bat to generate
- proto.py to generate the route file route.erl
- protoc-erl to generate erlang protocol file
Compile 3rd\gpb to generate protoc-erl or use 3rd\gpb\bin\protoc-erl.
- protoc generate client protocol file
gate learns to use gen_statem behavior and uses Ranch as acceptor pool, and uses gen_server with minor modifications (see gen_server behavior used by the framework)
Process: one role for one thread, load a player on the gate by starting the role, and use mysql to store them.
role.erl gen_server
start(Args) ->%% Args is a list of elements passed in from outside
supervisor:start_child(role_sup, Args).
%% For simple_one_for_one supervisor, start => {'role', start_link, []}, apply(M,F,Args ++ []) call role:start_link(list_expanded), Module:init(list_expanded) will be called
Ranch
mysql-otp-poolboy
lager Recently when I uploaded, I realized that lager's previous bugs have been fixed, so I don't need to fork it locally anymore.
gdb
dynamic_compile