Module: GameOverseer
- Defined in:
- lib/gameoverseer.rb,
lib/gameoverseer/version.rb,
lib/gameoverseer/console/console.rb,
lib/gameoverseer/services/service.rb,
lib/gameoverseer/services/services.rb,
lib/gameoverseer/server/renet_server.rb,
lib/gameoverseer/clients/client_manager.rb,
lib/gameoverseer/channels/channel_manager.rb,
lib/gameoverseer/messages/message_manager.rb,
lib/gameoverseer/input_handler/input_handler.rb,
lib/gameoverseer/packet_handler/packet_handler.rb,
lib/gameoverseer/packet_handler/json_packet_handler.rb,
lib/gameoverseer/encryption_handler/encryption_handler.rb,
lib/gameoverseer/packet_handler/messagepack_packet_handler.rb
Overview
General purpose game server that uses services (plugins) for logic.
Defined Under Namespace
Modules: Services Classes: ChannelManager, ClientManager, Console, ENetServer, ENetServerRunner, EncryptionHandler, InputHandler, JsonPacketHandler, MessageManager, MessagePackPacketHandler, PacketHandler, Service
Constant Summary collapse
- VERSION =
"0.1.8"
- RELEASE_NAME =
1.0 is to be “Ice Crystal”
"Blank Slate"
Class Method Summary collapse
-
.activate(host, port, use_inbuilt_console = false, packet_handler = JsonPacketHandler, encryption_handler = nil) ⇒ Object
Start server.
-
.deactivate ⇒ Object
Stop server.
Class Method Details
.activate(host, port, use_inbuilt_console = false, packet_handler = JsonPacketHandler, encryption_handler = nil) ⇒ Object
Start server
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/gameoverseer.rb', line 40 def self.activate(host, port, use_inbuilt_console = false, packet_handler = JsonPacketHandler, encryption_handler = nil) begin if use_inbuilt_console require "gosu" GameOverseer::Console.log "Using inbuilt console" end rescue LoadError fatal "Install gosu 0.10.8 or later to use inbuilt console." end GameOverseer::ChannelManager.new GameOverseer::MessageManager.new GameOverseer::ClientManager.new @console = GameOverseer::Console.new if use_inbuilt_console @server = GameOverseer::ENetServerRunner.new Thread.new {@server.start(host, port, packet_handler, encryption_handler)} @console.show if use_inbuilt_console sleep at_exit do GameOverseer::Console.instance.close if use_inbuilt_console @server.supervisor.terminate if defined?(@server.supervisor.terminate) GameOverseer::Console.log "Server Shutdown" end end |
.deactivate ⇒ Object
Stop server
69 70 71 72 |
# File 'lib/gameoverseer.rb', line 69 def self.deactivate puts "ALERT \"CONSOLE CLOSED. LOST CONTROL OF SERVER.\"" @server.supervisor.terminate end |