Java & MySQL- Rankings -


i making game , require ranking system. save stats kills, deaths, wins, innocent shots, etc mysql. clueless moment on how able rank everyone. want have on mysql updated quickly. thinking load ranks in hashmap when game starts ineffective since there thousands of players. want use of stats work out. explain me how able this? thanks!

one way use mysql events trigger stored procedure. stored procedure execute ranking , store rank in db. set event trigger time whatever wanted, 10 minutes.

mysql events: https://dev.mysql.com/doc/refman/5.7/en/events.html

create     [definer = { user | current_user }]     event     [if not exists]     event_name     on schedule schedule     [on completion [not] preserve]     [enable | disable | disable on slave]     [comment 'comment']     event_body; schedule:     @ timestamp [+ interval interval] ...   | every interval     [starts timestamp [+ interval interval] ...]     [ends timestamp [+ interval interval] ...]  interval:     quantity {year | quarter | month | day | hour | minute |               week | second | year_month | day_hour | day_minute |                 day_second | hour_minute | hour_second | minute_second} 

then setup stored procedure generate rank , set players: https://dev.mysql.com/doc/refman/5.7/en/stored-programs-views.html

an example procedure be:

create procedure simpleproc (out param1 int)     begin       select count(*) param1 t;     end 

you can make procedures complex need to.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -