Im Phil and try to figoure out the best approach for my app. I was searching Stack for my question but I didnt find a completely answer. Assumptions:

  • It will be multiple user who can see in real time their vehicles(locations,state, fuel), places(state, is it planted, is it mowed) etc.
  • Action taken by players - e.g. User click build/drive and have to wait for example 45min. I want to display to user time to end of action.
  • should action be registered in queue system ? ( RabbitMQ or something like this,generally a message queuing system)
  • After this time the object of user should change - User get coins or the vehicle change his place from X to Y
  • Remove this action from queue and store information about ended action in DB

Is my approach correct? Could I ask for ways to implement this? Or should I go in a completely different direction? I will be grateful for all the advice!

EDIT: I found different solution: Store action in DB to build / drive and save the current timestamp and time when action is finished. Now i should have bacgrond process which will be looking into this DB and change state when the action is finished (add coins to player X e.g.) In the same time when user clik the request to server is send. In response got the time when te action start and finish. Javascript will be drawing to user the progres bar (calculated from current timestamp and from db) What in situation when user not send another request (not rerfresh site)? The script should check if action in finished (current timestamp > timestamp from db ) and then should automatically refresh user site. Is that correct? Second aproach is simpler to implement IMO.

  • 1
    \$\begingroup\$ It's unclear to me what you're asking here. "Could I ask for ways to implement this?" didn't you just describe a way to implement it — using message queuing? Is there something you're unsatisfied with about this approach? Is there a specific step in the process you need help implementing? Which step? "Is my approach correct?" well, did you try it? Did it work? If so, it's probably "correct enough." If not, what went wrong? We can help you solve that specific problem. \$\endgroup\$
    – DMGregory
    Aug 9 '19 at 0:00
  • \$\begingroup\$ Hi, My question is that using message queuing is good approach in web browrser games like this. Maybe is to complex, maybe i should use second approach( look at my edited post please) Best regards Phil \$\endgroup\$
    – Gierlos
    Aug 9 '19 at 8:18
  • \$\begingroup\$ @Gierlos its hard for people to tell if an approach is complicated or not. An experienced developer can make the most complicated design simple in its implementation. How do you become an experienced developer? Just start by making stuff, try different approaches, some will work, some won't. You have to make some mistakes to know why the correct way is correct. \$\endgroup\$
    – TomTsagk
    Aug 9 '19 at 8:40
  • \$\begingroup\$ It still sounds like you have an idea for how you want to implement this feature. My advice is to try it whichever way makes the most sense to you right now, or whichever way lets you get a test up & running faster. Then you can evaluate real running code to find out whether it actually meets your needs, rather than using the unreliable guesses and opinions of Internet strangers going off a vague and incomplete description. If you run into a bug or problem while you're building this test, then you can come here to ask for help solving that specific problem. \$\endgroup\$
    – DMGregory
    Aug 9 '19 at 11:23

You must log in to answer this question.

Browse other questions tagged .