Page 1 of 1

Random Thought: displaying stats on a website?

PostPosted: Mon Feb 27, 2012 22:55
by RAPHAEL
Well a random thought just came to me. I've noticed with a lot of multiplayer games they have stats of the server listed on a website.

Examples would be how many players online, how many player total, server loads, generated map overviews and such. Would be interesting for Minetest to support such eventually or someone with enough skill come along and make it work and show others how to do it.

PostPosted: Mon Feb 27, 2012 23:22
by IPushButton2653
+1

PostPosted: Tue Feb 28, 2012 03:05
by XCalibur54
+1

It would be really cool to show live stats like how many people are currently logged in, but that would require a central server which is a bad idea.

PostPosted: Tue Feb 28, 2012 03:34
by Roflo
Maybe not..

For example, your server could generate a small image in which it "writes down" the number of active users.

Any webpage can just link to that dynamic image.

PostPosted: Tue Feb 28, 2012 04:04
by RAPHAEL
Roflo wrote:Maybe not..

For example, your server could generate a small image in which it "writes down" the number of active users.

Any webpage can just link to that dynamic image.

+1 except needs to show active players, total players and maybe explored world size?

PostPosted: Tue Feb 28, 2012 16:22
by tinoesroho
Hmm...k...

I was think of writing a mod that utilizes Python and Twitter's API to have a live feed of notable events ("Johann destroyed 100 blocks in the past 120 seconds!") ("Ralph clobbered 5 players in 10 seconds!") for those who either can't log in (too many players) or just want t o have an overview of the action.

PostPosted: Tue Feb 28, 2012 17:24
by Jordach
tinoesroho wrote:Hmm...k...

I was think of writing a mod that utilizes Python and Twitter's API to have a live feed of notable events ("Johann destroyed 100 blocks in the past 120 seconds!") ("Ralph clobbered 5 players in 10 seconds!") for those who either can't log in (too many players) or just want t o have an overview of the action.


yes please!

PostPosted: Tue Feb 28, 2012 22:54
by randomproof
I could be possible to have a mod catch some of these types of info and write it to a file and you could up PHP of parse the file and output it on a webserver. It is also possible for a mod to run an external command which could post to Twitter(https://launchpad.net/twitter-cmdline/)

If you post a list of the kind of stats you want I can help write some of the mod code and some of the PHP code, if you need.

For example, here is a function that will output a sorted list of the currently connected players to a file every 60 seconds:
(Only flaw I see here is that dead players will not show up.)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
timer = 0
filename = "connected_players.txt"
minetest.register_globalstep(function(dtime)
    timer = timer + dtime
    if timer >= 60 then
        timer = 0
    else
        return
    end
   
    all_connected_players = {}
   
    for k, v in pairs(minetest.object_refs) do
        if v:get_player_name() ~= nil then
            table.insert(all_connected_players, v:get_player_name())
        end
    end
   
    table.sort(all_connected_players)
   
    file,err = io.open( filename, "w" )
    if err then return end
   
    for k, v in pairs(all_connected_players) do
        file:write(v .. "\n")
    end
   
    file:close()
end)

Re: Random Thought: displaying stats on a website?

PostPosted: Sat Oct 01, 2016 15:10
by Milan*
Lets necrobump this thread because i found this on the web and others may this too.
I am using a munin script based on this.
An example is here.

Re: Random Thought: displaying stats on a website?

PostPosted: Sat Oct 01, 2016 15:20
by rubenwardy
already possible using external tools - such as appending player numbers to a file, minetestmapper