Sites like Reddit and the Stack Exchange network have seen tremendous success with the up/down voting model for selecting the best of a set of posts. I wanted to apply this to a suggestions window and allow players to submit ideas and vote on those ideas. And thus, I present you my implementation of an up/down voting system for Graal.
This system is fairly minimal and is lacking some features I'd like to have. I doubt if I'll ever have time to implement them, so I encourage anyone who is interested to take the source code and run with it.
Current Features- Ability to set topic/description (hardcoded constant at the top of the script)
- Players can submit suggestions with a "title" and a "description".
- Limits on the title and description (currently hardcoded).
- Option to show or not to show the submitter's account (always shown to admins regardless of the option)
- Ability for players to vote up and vote down suggestions.
- Voting obfuscation system similar to the anti-cheating system in use on Reddit
- Simple moderation system (ability for admins to delete posts)
Future Features?
Eventually, I'd like to make some improvements.
- Create multiple voting "instances" or "topics" so that multiple voting sessions can be running at once, with different topics.
- Add a better moderation system (e.g. banning people from using the system)
About the Anti-Cheating System
There are thresholds for most upvotes per hour, most downvotes per hour, and ratio of upvotes:downvotes. Votes may be "suppressed" (visible only to the voter) if the script thinks they're cheating. In addition, the vote count is randomly changed slightly each time it is refreshed to make it harder to game the system.
The defaults are tuned to encourage upvotes more than downvotes, with a low threshold for downvotes per hour (meaning a lot of them get suppressed). Instead, it relies on players to upvote the ideas that they support.
Installation- Install at least these minimal func_sql and func_strings classes
- Copy the weapon script into a weapon on your server. Don't hit apply yet.
- Make sure you have a database configured with the name "default", or change the database used by the weapon script (todo: make this a constant).
- Change the constants at the top of the script to reflect your needs.
- Update the isAdmin function around line 240 to suit your server.
- Around line 106, adjust the manner in which messages are sent so that it matches your server.
- Add some way for openVotingWindow() to be called (e.g. by a chat command or pressing a key). Alternatively, you can un-comment the line in onCreated clientside to open the window on script add/login.
- Upload these images to your server. You might already have some of these downloaded if you use SQL explorer, but your players won't.
- Hit apply on the weapon script. Two tables should have been created: voting_votes and voting_responses. If you see errors in RC, something bad has happened.
The system should now be working
. I welcome feedback and suggestions, but again, I probably won't have time to make any big changes. I encourage anyone interested to improve the code to add new features, especially the ones I mentioned about that were lacking.