/    Sign up×
Community /Pin to ProfileBookmark

Creating a Hiscores Table for RPG

Hi, I was wondering if it was possible to create a hiscore table for a RPG private server.

All the players have 24 skills that would need to be shown on a webpage, and all the players have seperate files in one folder. Each skill has a certain level and number of experiance points, and each skill is designated by a number in the file.

For an example of the type of hiscores we’d like, you can view them [URL=”http://hiscore.runescape.com/hiscores.ws”]here.[/URL] They don’t have to look anywhere near that good, though.

Also, I am fairly certain this is possible, because our rival server has them. You can view those [URL=”http://dodian.com/forums/index.php?pageid=highscore”]here.[/URL] We are aiming for something that looks more like this, anyhow.


If there is some type of tutorial aimed at something like this, can you please link me to it or tell me what to search for. If you can point me in the right direction to get started on this project, I’d love it.

Any help is [B]greatly [/B]appreciated.


Here is an example of what the character files look like:

(Everything in the [SKILLS] category is what we would want on the hiscores, as well as them all added up and posted in the hiscores.

Furthermore, in the [SKILLS] category, the columns are:

Type of Skill-Level in Skill-Experiance Points in Skill

[code]

[ACCOUNT]
character-username = Andrew
character-password = ******

[CHARACTER]
character-height = 0
character-posx = 2599
character-posy = 3167
character-rights = 3
character-ismember = 0
character-messages = 0
character-lastconnection = HUCKS-EE699DADF
character-lastlogin = 20080628
character-energy = 100
character-gametime = 0
character-gamecount = 315

[EQUIPMENT]
character-equip = 0 662 1
character-equip = 1 2414 0
character-equip = 2 1725 0
character-equip = 3 -1 0
character-equip = 4 6107 0
character-equip = 5 3842 0
character-equip = 6 -1 0
character-equip = 7 6108 0
character-equip = 8 -1 0
character-equip = 9 7461 0
character-equip = 10 2579 0
character-equip = 11 -1 0
character-equip = 12 -1 0
character-equip = 13 -1 0

[LOOK]
character-look = 0 0
character-look = 1 7
character-look = 2 8
character-look = 3 9
character-look = 4 5
character-look = 5 0

[SKILLS]
character-skill = 0 1 14313500
character-skill = 1 1 14000000
character-skill = 2 1 14000000
character-skill = 3 1 14313500
character-skill = 4 1 14000000
character-skill = 5 1 14000000
character-skill = 6 1 15000000
character-skill = 7 1 15000000
character-skill = 8 1 15000000
character-skill = 9 1 15000000
character-skill = 10 1 15000000
character-skill = 11 1 15000000
character-skill = 12 1 15000000
character-skill = 13 1 15000000
character-skill = 14 1 15000000
character-skill = 15 1 15000000
character-skill = 16 1 15000000
character-skill = 17 1 15000000
character-skill = 18 1 15000000
character-skill = 19 1 15000000
character-skill = 20 1 15000000
character-skill = 21 1 15000000
character-skill = 22 1 15000000
character-skill = 23 1 15000000
character-skill = 24 1 15000000

[ITEMS]

[BANK]

[FRIENDS]

[IGNORES]

[EOF]

[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@EckishAug 01.2008 — I don't know about a tutorial, but I can give you some hints.

The first step would be to get the files. I imagine they are all in the same folder seperately or at least have a similar nameing convention? If either of those is true, you'll want to look at the 'grep()' function to get all the filenames of all the characters. Store them for later. An array is probably best.

Once you have the filenames, you need to parse the data in them. The example you give looks pretty easy to parse. Especially if you can garuntee that every file has the same format. "file_get_contents()" may be useful here, but the better way to go might be "fopen()" combined with "fgets()". Pull out the data you are interested in and store it.

Once you have done that, it would just be a matter of determining your formulae for ranking. Calculate your rankings and store the data. At this point, you'll need to make a big decision. Whether to calculate this data on the fly everytime a user visits the page, or to calculate it at certain intervals and store the data in a DB of some type. Considering there will be a lot of file accesses, this script could be potentially very slow. You probably want to go with the latter.

The final step is to then display the data however you want to with HTML.
Copy linkTweet thisAlerts:
@Andrew_HucksauthorAug 01.2008 — Yes, each character has a seperate .txt file in one folder.

Thanks for the tips! I'm going to get to work. ?
×

Success!

Help @Andrew_Hucks spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...