Sim-eth-es: sending data to clients that is not game entities

Was wondering how you broadcast data that is not entity-related. For instance, my game has waves of mobs. This wave-number is a global number identifying the game difficulty so to speak. I want to broadcast this to clients and have them show which wave they are on.

Creating an EntityComponent makes little sense since there’s ever only 1 entity with this component, so the set of entities would only ever be of size 1. But on the other hand it would be easy to broadcast using the system already in place.

I must be missing something because @pspeed thinks of everything it seems :smiley:

If you have global game related state then I see no problem with having a game entity to attach components to. I mean, you can simply broadcast whatever network messages that you want, of course… but then you’ll be duplicating a lot of the same stuff already done.

I would never ever (ever) use an EntitySet if I only ever expect there to be one entity (like the player entity is another example for score, etc.)… that’s precisely the sort of thing that WatchedEntity is for.

Or you can use the RMI stuffs.
For example you can add method getGameDifficulty() to GameSession service from Sim-eth-es examples

Thank you. I guess I can basically set the information on all players. Then grab the information on the client side using WatchedEntity.

Or just set it on a game session entity that is linked to the players in that session (well, that the players in that session link to… potAYto, potAHto.)

So one entity to hold game session data, and several entities to link that entity to the players in the world?

One entity to hold game session data.

Presumably you already have player entities… so you’d add a component to link them to their game session.

Then someday you can support multiple game sessions if you want to.

3 Likes