Answer the question
In order to leave comments, you need to log in
I am writing a 2D real time game on Photon. How to implement AI on the server?
I would be grateful if you tell me where to dig. Share advice / link to the article. How to implement AI on Photon server. All other server logic washed down. I understand that it seems to be just a random number generator in an eternal loop. It's just not clear how to implement it on the server side, since it turns out to send signals to everyone only when creating a peer: ClientPeer.
Answer the question
In order to leave comments, you need to log in
Random number generator? Eternal cycle? On the server side?
It's unclear.
Implementation of AI on the server side (including the photon):
Step 1. Come up with the logic of the AI (create an algorithm) - this has nothing to do with the photon - pure algorithmics.
Step 2. Create a handler that, in all cases, when the player is within the "radius" of the game object with the AI - sends information to the player about the actions of the AI (its location, current animation, etc.).
Step 3. Assign the received data on the "client" to the game object, which is our AI.
Thanks for the answer. The question is how to create a handler that would unilaterally send data. So far, I have only written a client handler that receives a request from the client, processes and sends a response. And how to make it send data itself, without requests, depending on data changes on the server (positions of objects, etc.).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question