Ethereal networking and rooms

I am using the Ethereal network library and I have a use case that hopefully someone has solved. It seems like I need a concept of “rooms” … here is the use case:

The game is a space game with fleets out in sector space. When two fleets engage each other I was to cut to a battle scene where all the ships in the fleets battle. Due to this, I will need to instantiate a new battle scene for each battle. If Ethereal has the concept of rooms I would be able to spin up a new room, tell the clients to switch to that room and all would be good. A second use case that has the same requirement is when you view a planet … A new scene would show you the planet and all the space stations in orbit.

Has anyone solved for this in conjunction with the Ethereal network library?

You might want to explain more about what isolation you require in your “room”. From previous offline conversations, I remember them being pretty isolated and one step short of separate servers.

What do you expect to be shared across rooms and what do you expect to be separate?

For example, if you are sharing the networking connection then given that CPU is finite I’m not sure there is much benefit to having multiple zone managers… other than perhaps the ability to have less ID rollover, ie: smaller ID bit sizes. I don’t remember the details from our conversations before.

Else, most games could probably simulate ‘rooms’ by just picking different y ranges or something.

Since I will be using your entity system and ethereal for this project I will explain the isolation within that context…

  • Single connection from client to server

  • Server has an entity set per room (or scene).

  • Client gets an entity set for room #1

  • Client tells the server that it only wants updates for entities in room #1

  • Ethereal server only sends room #1 entity position/rotation updates to that client connection within the frame.

The client can flush it’s entity set and request an entity set for another room and register for that room at any time. My initial thought was to have a complete Ethereal stack on the server for each room and bind / unbind it to a connection through a registration mechanism but although that will work I see it as not only a kludge, but VERY wast-full. An alternate approach would be to have a way to tag frame updates on the server with a room id and let Ethereal handle what connections get the frame update just like it does that with zones today.

EDIT: After thinking about it more … it would be more efficient to pass the room ID to the updateEntity() method of the zone manager and it would use it as a secondary filter. This would require that the zone manager is room aware though. So basically propogate the room ID into the StateEntry of a StateBlock and the stateChanged() method of the NetworkStateListener can decide if this StateEntry should be ignored or processed.

…which ultimately to me seems no different than deciding -1000 < y < 1000 is one room and 1000 < y < 2000 is another and so on. You could today already use elevation to encode a room ID.


Did you mean EntityData per room? Or is the whole server still using the same EntityData.

Because in the latter case, a room ID could effectively just be a big multiplier on your ‘local’ Y value or something. Even if it’s a bit of a hack, it would tell you if the approach is even useful for you. (It also is the way I planned to support different ‘planes’ in Mythruna if I need them.)

I need the Y because it’s an opened world game. Hence why I would prefer the “room” filter approach instead of relying on zones along the Y axis to represent rooms.

Server has one EntityData with the “roomID” component on each entity

There is probably some factor of y that would work. Given that they are doubles, I doubt that your players can fly through all of them. Galaxies are way wider than they are tall.

But given that it’s an open world, why bother to partition it farther than that? Are the rooms to provide instancing or something?

Rooms are for fleet battle scenes and planet views. Players want battle scenes for fleet battles isolated in a battle arena instead of the sector view. They also want to be able to have base views where they can see their base on a terrain grid and be able to attack base components

I’m not understanding why those aren’t just zoomed in views of the same ‘space’.

In sector view I show a fleet icon representing a fleet. When one fleet icon attacks another fleet icon the user engages in battle … they can have up to 7 fleet battle going on at the same time. A user can view any one of those fleet battles and manually control all the ships in their fleet. When you view a fleet battle your fleet icon turns into ships in a battle scene. It’s hard to explain without visual references.

EDIT: I guess I can use the Y but it feels like a kludge to me

@pspeed The kluge of using the Y do depict different scenes bothered me and I could not sleep over it so I implemented and tested a sceneId long value in ethereal with the option to pass in a scene id when you update an entity in your game loop through a new update method/ I also introduced a new message called SceneIdMesssage that the client can send to switch scenes. By default the scene ID is set to zero for backwards compatibility. I tested it and it works perfectly … your example es-ethereal sample game works without modifications with the updates. This way if the client wants to switch scenes it just needs to send a message and the server flips the scene like magic.

I have no idea how to send you the changes if you are interested in them.

The effected files are:

and the new file is

Are you familiar with github at all? It’s pretty straight forward to submit a pull request.

Not sure why a special message is needed. That seems very game specific.

Also, ‘space’ is probably a better name than ‘scene’, I guess. You are effectively defining different spaces and this would ultimately have to be reflected in any persistent positions and so on.

Unfortunately I am a cvs/ecipse guy instead of github :frowning: … call me old school … but google is my friend so I will figure out how to submit a pull request. I will change sceneID to spaceID … the new message gives the client a way to tell the server that it wants to switch spaces

but a) RPC/RMI would be better, no? b) that’s very game specific since the client generally shouldn’t control which scene they are viewing.

…which makes me wonder if you’ve handle the case where the server switches the space ID. Generally that’s the way most games would want to do it to avoid cheating.

I can support both client and server scene changes. On the server you can set the sceneId through a setter on the NetworkStateListener. Good point on the cheating bit though.