You’re right, I need to use a middle ware, because I’m not getting anywhere with the FSocket class :L
Was my second idea! But C# man.
Hi, can you give me some direction about how to do this? I will need to use Rabbit MQ to exchange message between mobile app& application on window, any info will be more appreciate
Is there an example of integrating ue4 with RabbitMQ?
You should start there with tests/examples from a RabbitMQ client from one of C++ ones (here’s one: GitHub - alanxz/SimpleAmqpClient: Simple C++ Interface to rabbitmq-c) . When you get a feel for using the API by itself along with setting up the broker, you’ll be ready bring it into your UE4 project by adding it’s include path and link against the client lib.
Just a heads up, you’ll want to also check for AMQP C++ clients which can be used to connect to a RabbitMQ broker.
Alternative brokers are ZeroMQ, Redis, ActiveMQ but may have different client implmentations.
Actually, I just made it simple.
I added a TCP Listener Server in another UE Project with empty world etc.
So for me, the other ue Server handles all this stuff for me ( i can simply simlink changed network pakets and can reuse code directly)
Thats mostly the fastest and stablest thing, i tried.
My background is in writing low latency FX arbitrage software. My general approach to writing a network server (based on stealing my arb code) goes like this:
- c++ using raw socket libraries. Prefer UDP and handle re-transmission yourself. TCP does a whole lot of buffering that can slow things down.
- Maintain a database of ‘game state’, and a log of changes to state in a stack format, with a depth of say a minute or so of events. When events on state change occur you change the db, and push it on to the stack. If a client asks for a retransmit, it asks for wither From sync number xxxx or for specific change numbers.
- Server uses 1 thread per client, socket is blocking. This one REALLY lowers useless polling of ports looking for new messages arriving.
- Develop a protocol for how to move state and a protocol for asking for things to be done (rpc). The state moves need to be considered from a c struct pov. Critically use bit fields on the structs to economize on bytes that don’t even need to be moved. With that said though, a standard ethernet frame is ~1300bytes anyway, so, YMMV in optimising down to the last byte.
*Get used to multithreading approaches, in particular critical sections and mutexes. This is critically important when you are updating the database and have tons of clients streaming in data non stop.
Using these techniques my MT server is able to have dozens of clients connected streaming tons of data in and the process somehow still doesn’t even use 1% of the CPU. So, it’s quite scalable this way.
Depending on your game you might look in to running the clients to a ‘lockstep’ system. This IMHO is probably the best approach for most circumstances, but possibly questionable for MMO type games.
I would add that cheating is gaming’s biggest problem right now. IMHO at the very least a DiffeHelman front end in to some kind of cypher library to encrypt in transit is fairly mandatory. Since your not a bank or the NSA you can probably get away with a nice simple old blowfish library. Providing the key exchange is handed well by the DH blowfish would be good enough for most games and as easy to implement as zlib.
The architecture of how you manage ‘authoritative state’ is the harder problem. You either need to have a full headless game built in to the server which all client depend on for state or your local clients can be hacked to give bad state to the server and people mysteriously start using admin powers in a multiplayer game. (like teleport, instakill, etc)
thanks @egm . I tried using rabbitmq c++ clients but there is no working example anywhere. I tried to build them and run it on visual studio but I couldn’t run any of them because of their dependencies to thirdparty libs.
We need a messaging queue client for unreal engine to load balance the requests. Do you have any suggestions for a queue mechanism that’ll work with UE4.