This site requires JavaScript, please enable it in your browser!
Greenfoot back
bourne
bourne wrote ...

2013/12/30

UserInfo - Multiplayer topics

bourne bourne

2013/12/30

#
shrucis1: bourne, I like how even though the scenario does pretty much nothing, you still don't forget to put your logo in first. On another topic, are you planning on making any more online Greenfoot games? I've got an idea for one I'm working on, but I'm still trying to puzzle through your UserInfo Battleship code. Something in particular I can't quite get is how you do you last seen time for a user. If you could help me with this, that'd be great. bourne: Haha, it's by coincidence it shows first. Actually I haven't included it in my recent projects simply because I've been lazy. It is here because this project was built on top of an old project which had it already. I was planning on another multiplayer design after I finished this project which should be soon. And the last seen time for a user works as follows: As the scenario is running, there is a thread which updates an int field in UserInfo (cycles through values 0-15), every 5 seconds. The scenario also records this value found for all other UserInfos, and checks routinely for if the value has changed for each of them, recording the new values, and noting the activity of the particular user.
shrucis1 shrucis1

2013/12/30

#
Thanks for posting your reply here, bourne, this was part of what was causing me to think that my comments weren't posting, as after I posted it, when I went to the recent activity, I didn't see my comment. Also, I noticed:
bourne wrote...
...As the scenario is running, there is a thread which updates an int field in UserInfo...
Are you using multi-threading in your projects? It does seem to be quite fast even though it's checking those values periodically.
bourne bourne

2013/12/30

#
Yes, you don't want to be calling the UserInfo methods like getTop(int) or store() in the main thread of execution if you don't want pauses with the scenario to the user. And I used a couple different threads for different purposes.
You need to login to post a reply.