Mulitplayer

#1
Since I have nothing else to do, I have decided to make a complete and total multiplayer suggestion. It probably won't get added, but hey, it's always nice to write a large suggestion once in a while.

Multiplayer Empires of the Undergrowth
This is a suggestion for a multiplayer mode that will probably satisfy every single part except for well.. connecting and stuff like that because I have no idea how to do that. But I do know how other things work. Like packets. And code. (not c++ tho) So without further to say, here we go.

Basic Long Lasting Servers
Let us start by creating our server. Click the new multiplayer tab, and then click 'Create Server', enter our server name, 'amogus sussus' and press 'Start'. This will create a folder at some place called [Name of Server]-eotu, so in this case amogus-sussus-eotu. In this folder, you will find another folder called 'Plugins', a file called 'config.somefileextension', and finally a file called 'amogus-sussus.someotherfileextention'. Now, to start our server, we just click the amogus-sussus file and boom. A new window that is DIFFERENT from the main EotU (to reduce lag) opens up. From here, you are allowed to monitor players, plugins (which we will talk about later), and the server chat. Amazing! Now, you can keep this window up for however long you want, so anyone can join at any time.

Configuration
The configuration file we mentioned earlier is where you can modify the basic properties of your server by just typing either true or false, the desired name, or the desired number. Here is a list of them:

  • Server Address
  • Maximum Total Players
  • Auto Save Delay (Zero For None)
Joining a Server
Joining a server is simple. Open up your game, click the multiplayer tab, and then click the join server tab. Then type the name of the server, or if it doesn't have one, the IP. After fifteen seconds or so, you should be in the game! Now you can do stuff.

Levels
Each player inside a server is allowed to be in one level at a time. The server will send over its desired level to the player and the client will use that data to create a world that is just like normal EotU, except with all the server stuff that we will talk about. Levels are not per player, unless you literally make a new level for each and every player. The levels are where multiplayer actually takes place, because you can create a level with the right settings for you and your friend, and whenever a client enters the server, just assign it to your desired level, and boom, you and your friend are playing together. Here are a list of all the properties of a single level you are allowed to change:

  • Mob Spawn Rate
  • Difficulty
  • Win Condition
  • Max Players
  • Player Team Sizes
  • Randomized Caverns
  • Fog of War
  • Environmental Creatures
  • Upkeep
  • Entering Other Colonies
  • Uber Creatures
  • Nocturnal and Diurnal
  • Enemies Fighting
  • Attack Waves
  • Increase Difficulty Near Victory
  • Creative
  • Time
  • Landmarks
  • Max Plant Count
Text
Text can be expressed in three different forms. First off, we have chat. Any client can send a message into chat by simply pressing enter and typing the message out. The message will then be sent to the server and then into all the other clients. Secondly, there's overlay text which appears above the middle of the screen and is meant for stuff like announcements. Only the server can set these. And finally, there's objective text which is just objectives.. Only the server manages these.
 
#2
Packets
Lastly, there are packets. Packets are just packets of information. Nothing else. They are simple. Try to understand them. The client can send one to the server, and then the server to clients. This is how the client communicates with the server. To make things a lot simpler here, we can think of the server as our own client, with each of the properties of a client, except for the fact that it doesnt have a player or camera. It only has the main level object and some other information. But the thing about the server is this is where all the good stuff happens like plugin making. And it's all because of packets. Here are a list of them:

Client - Server

  • Connect Request
    • sendPacket(0, -1, "")
    • Tries to establish a connection between the server.
    • Sent when client initially tries to join server.
  • Get Level Data
    • sendPacket(2, -1, "")
    • Requests the assigned (if none, the default) level
    • Sent after a connect response packet is received
  • Disconnect Request
    • sendPacket(14, -1, "")
    • Tells the server to destroy a player.
    • Sent when the client disconnects.
  • Dig Block
    • sendPacket(17, tileIndex, "")
    • Tells the server to queue a block to dig.
    • Sent when the player tries to destroy a tile.
  • Place Tile
    • sendPacket(18, tileIndex, "")
    • Tells the server to queue a tile getting built.
    • Sent when the player tries to place a tile.
  • Destroy Tile
    • sendPacket(19, tileIndex, "")
    • Tells the server to queue a tile to be destroyed.
    • Sent when the player tries to trash a tile.
Server - Client
  • Connect Response
    • sendPacket(1, playerSlot, "")
    • Sends the client back a response.
    • Sent when a client requests for a connection.
  • Set Level Data
    • sendPacket(3, -1, levelData)
    • Sends the client the level information.
    • Sent when a client requests level data.
  • Overlay Text
    • sendPacket(7, -1, text)
    • Sends the clients overlay text.
    • Never sent unless via plugin.
  • Level Info
    • sendPacket(8, level, "")
    • Sends the client the level object so it can extract the settings.
    • Sent after a client is fully joined (also includes objective text).
  • Ant Update
    • sendPacket(9, antIndex, "")
    • Sends the client updated ant positions and battles.
    • Sent when needed.
  • Entity Death
    • sendPacket(10, index, "")
    • Sends the client an instruction to destroy an entity.
    • Sent when an entity dies.
  • Entity Creation
    • sendPacket(11, index, "")
    • Sends the client an entity to inhabit a specific index.
    • Sent when an entity is born.
  • Colony Death
    • sendPacket(12, colony, "")
    • Sends the client an instruction to destroy a colony.
    • Sent when the queen of that colony dies.
  • Game Won
    • sendPacket(13, colony, "")
    • Sends the client the colony index who just won.
    • Sent when a colony wins the game.
  • Player Active
    • sendPacket(15, index, "")
    • Sends clients an instruction to activate or deactivate a player.
    • Sent when a player joins or disconnects.
  • Create Colony
    • sendPacket(16, colony, "")
    • Sends clients a colony that has just been born.
    • Sent when a player fully joins.
Syncing Between
  • Player Info
    • sendPacket(4, playerSlot, "")
    • Sends the client player info from another player when they join.
    • Sends the server its own player info (colony type, name, etc.) when joined.
  • Pheromone
    • sendPacket(5, playerSlot, "")
    • Sends the client another player's current pheromones when changed.
    • Sends the server the current position of pheromones when changed.
  • Server Chat
    • sendPacket(6, -1, "")
    • Sends the client a chat message when one is sent.
    • Sends the server the message when the player sends one.
Plugins
Plugins can be created by creating a cpp file in the plugins folder in your server folder. Then you can include a few libraries and start coding. It's really that simple. When the server is initialized, the plugins in the folder will load. You can choose to disable them if you want. But here's a quick idea: sending packets to specific players only. For example, you can set the level to creative after people have already joined, send the level data packet to a specific player, disable creative, and now, only that specific player will have creative mode. Cool, right?
-Incandescent
 
Top