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

2013/4/13

UserInfo object that is always avaliable.

Gevater_Tod4711 Gevater_Tod4711

2013/4/13

#
Hi all. Is there something like a UserInfo object that is avaliable every time and always the same for any user that is playing? My problem is that I'm trying to improve my worms game so that the shooting algorithm is a adaptiv one that improves itselves. But therefore I need something to write down the improved values. If the game is played offline that's no problem. I use a file reader and that's it. But while playing the game on the webside I can't use a file reader or writer and so I need something like this special UserInfo object. Is there something like this in Greenfoot?
danpost danpost

2013/4/13

#
Greenfoot has supplied an API called UserInfo that can store 11 ints and 5 string of up to 50 characters for each user on each scenario. The user must be a signed on member for the storage area to available accessible. Please refer to the Documentation on the UserInfo API.
Gevater_Tod4711 Gevater_Tod4711

2013/4/13

#
I know the UserInfo class and it's funktions. But that's not what I need in this case. What I need is something like a UserInfo object that is always avaliable and always the same for each user. Something like a file where the relevant data of every player is saved. I want my code to improve itslevel and thats much more effective when many people play the game and so help to improve the code. So a 'normal' UserInfo will not help me in this case. Is there anything else what could help me here? (Except something like a JDBC - Database connection)
danpost danpost

2013/4/13

#
For local systems and networks, you can read and write whatever files you want. However, on the site, you cannot write to any files for security reasons; the only way to store info there is by use of what storage is available through the use of the UserInfo class.
MatheMagician MatheMagician

2013/4/13

#
Since your game does not currently use highscores, you could store your information in the top users. For example, your code would use the getTopUsers(how many ints you need divided by 10); and store the information in those. Because you are not messing with the users, the order will stay the same, and thus the information will not be jumbled.
danpost danpost

2013/4/13

#
MatheMagician, there is no way for him to write to those UserInfo blocks that belong to other users. The program will have to write each users own situation in the space that is provided for that user.
Gevater_Tod4711 Gevater_Tod4711

2013/4/14

#
Ok so there is no way to do this. I'll try to use the adaptive code somehow else. Thanks guys.
You need to login to post a reply.