I am developing a text-based multiplayer-RPG using React and dotNet core. The fight logic is handled on server side. Basically what fight() does is:

  • a while loop that iterate 100 times; in each iteration the characters attack each other; actions are stored in a string list
  • a winner is determined either at the end of the while loop or one's hp is below 0
  • write the fight result and rewards into database
  • send response back to client with the combat log (that string list)

This is what the fight() basically does. Players clicks fight and get the result and the report instantly. I would like to make the fight more engaging to the players by showing the fight's progress in each round (and add time interval between rounds).

I don't know how to achieve this. I would appreciate any ideas you share.

I could let the client side see a "replay" of the fight using the response from the server, but that's not what I want. Maybe this is something other idle games are doing. I don't know since I don't have much experience of game developing.

  • 1
    \$\begingroup\$ maybe create loop on client side which will run every iteration on server size - and then in this loop on client side you can display result for every iteration and sleep between iterations. \$\endgroup\$
    – furas
    Jan 5, 2021 at 3:14
  • 1
    \$\begingroup\$ What is it about the replay that differs from what you want? Are you concerned about delay? For typical server latency that should be easy to cover with a very short intro animation. \$\endgroup\$
    – DMGregory
    Jan 5, 2021 at 3:17
  • 1
    \$\begingroup\$ As mentioned, your fight method is likely instantaneous. Run it, send the log to the client and let the client handle the pacing of the fight. (You'll likely eventually need a button "skip to the end" because some players are in a hurry anyway.) \$\endgroup\$
    – Vaillancourt
    Jan 5, 2021 at 3:17
  • \$\begingroup\$ @Vaillancourt Is it what those idle games are doing now (the result is already made on the server. The client's job is just to replay it)? \$\endgroup\$
    – nkforce
    Jan 5, 2021 at 3:32
  • 1
    \$\begingroup\$ And for the client there is no difference between a replay of the fight or getting the update one by one. If there is no user input, how can the player even know that it is a replay? For all he knows it is a live fight. \$\endgroup\$
    – Zibelas
    Jan 5, 2021 at 8:14


You must log in to answer this question.

Browse other questions tagged .