Report as inappropriate.
Beta: A reusable utility for onsite user 2-player games. Provides user online status, opponent selection, client communication, etc.
This demo scenario features the Tic-Tac-Toe game with an instant messenger.
Please feel free to reuse this utility to make your own onsite user 2-player games (just include in the description the appropriate credit).
And same for the GUI Components.
Needless to say, likes/votes are always appreciated.
Note, my utility replaces UserInfo (in that UserInfo should not be used on the side)
The classes that are required for using TwoPlayerUserInfo are:
- TwoPlayerUserInfo
- BitStringUtil
- MessageContents
** NO live-action multiplayer **
Live-action is not feasible! It is not possible to get updated information to clients fast enough using UserInfo!
Turn-based and similar styles are what this utility was meant for.
** TwoPlayerUserInfo’s EFFICIENCY using UserInfo **
- While paired with opponent - getNearby(3) is called to retrieve list of user data containing data for opponent.
- While in the lobby (opponent selection) and during the pairing process with opponent - getTop is called to retrieve full list of user data.
** Overhead **
TwoPlayerUserInfo reserves the score field and the last int field for its operations. As well as the last String field but only during the pairing process with opponents (meaning it still can be carefully used to store data, and of course to be included for a message).
A score can be stored in another int, and a full list retrieved through TwoPlayerUserInfo can be sorted by it (to create a highscore table etc.)
** Opponent Selection / Lobby **
Only users that are online appear in list (should always give a few moments as it listens for user activity).
Use help button for more info.
** TO-DO **
- More documentation.
- Ironing out things.
For a collection of onsite user multiplayer games, visit:
http://www.greenfoot.org/collections/404
For reusable GUI Components, visit:
http://www.greenfoot.org/scenarios/7578
5489 views / 27 in the last 7 days
4 votes | 0 in the last 7 days
This scenario is a member of: Reusable actors & support classes, UserInfo Shares, UserInfo Multiplayer
There is no HTML 5 translation of this scenario available.
View legacy version (requires Java plugin)
This scenarios uses Java features that are not available for use after conversion to HTML 5. Please try the legacy version, which requires the Java plugin to be installed.
Want to leave a comment? You must first log in.
2014/1/9
2014/1/11
2014/1/11
2014/1/13
2014/1/13