Online Stats

Started by Mightylink, October 14, 2008, 06:52:54 am

Previous topic - Next topic

Mightylink

October 14, 2008, 06:52:54 am Last Edit: October 14, 2008, 06:54:53 am by Mightylink
First off let me say I am not asking for online multiplayer, just a little something to make the game more interactive with the members on my site.

Is it possible through sql or just ini or txt files to record the stats of your party and characters to be later uploaded to a website. I would like to use that data to generate player lists on my websites and signature generators to show off in my forums peoples parties and stuff.

Now I know people can make their own sigs but this way it is much more integraded with my website.

What I wish is the option to record and upload data from the game to my website to be later displayed in like a top 100 list or a signature generator. But it needs to be easy for players to use, if this can be done just to text or ini files then that would be ok too, I can create my own uploader in vb or something.

What I want to show is from peoples save files, their current party, level and stats online. This can be a simple "Generate Stats" or "Upload Stats" from the main menu  of the game.

Sorry I cant explain this any easier... an example would be to have the game create a data file, then that can be uploaded to my website, then people can show off their progress and see other peoples characters on a web page.

Maby a little encryption in the data files would be needed so people cant open them in notepad and change level=999 to cheat the system. Only problem with that though is I wouldnt know how to get my site to decrypt the files for display.

Blizzard

You can use different encryption algorithms to prevent hacks. One of them is MD5, it's used to encrypt passwords when sending over the internet.

But I have a better idea. You would need a script that collects the data from the game directly without any intermediate files. You run the external uploader app and let the app send the collected data over the internet. A script like that is fairly simple as all you need to do is to collect the data, run your uploader app and send the data to the app.
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Mightylink

any chance this can all be put into 1 script, i know there are multiplayer scripts out there but for what I want it should be much simpler.

if an external app is needed then im not sure how to go about that, i only know very basic vb and can probably create something to upload files, but i wouldnt know how to upload the data directly

however I am good with html, php and sql, i can easily do all the website work to read the data and display it in a page

Blizzard

October 14, 2008, 09:30:18 am #3 Last Edit: October 14, 2008, 09:36:22 am by Blizzard
Depends on how you want it. I haven't worked with Ruby-SQL connections or Ruby-FTP connections, but I think your best bet would be SQL. That way it's better organized. As I said, I haven't worked with SQL connections in Ruby, but I suppose that all you need would be to create a simple connection with a predefined user and simply executing a few queries. Those queries would include checking if the user is already in the database and either adding a new user with his data or updating already existing data.

dbc = SQLConnection.new('admin', 'mypassword')
actor = $game_party.actors[0]
...
query = ''
dbc.open
if !dbc.callproc('userExists', [$game_system.user_id])
  query += "INSERT INTO Players (UserID, Nick) VALUES #{$game_system.user_id}, "#{actor.name}"; "
end
query += "UPDATE Players SET level = #{actor.level}, ... WHERE UserID = #{$game_system.user_id};"
dbc.execute(query)
dbc.close


Of course this code lacks the implementation of SQLConnection and some other details, but it's basically what you need to do. You might be able to find a .dll that has a class which implements this functionality.

EDIT: OMG, you're making me want to get back into making MMOs already. D:
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Mightylink

October 14, 2008, 05:31:21 pm #4 Last Edit: October 14, 2008, 05:46:51 pm by Mightylink
you know, i was fooling around and i opened up one of my save files in notepad and right there all the info was in plain english, there must be a way to read or translate information from save files to be displayed on a page

not the entire save file, just the current party and their levels, something like that


your way sounds good though, i would prefer using an sql database, i am well familure with it, just have no clue how to use it in the ruby script like you where pointing out.

idk if the game can connect directly to my sql database though nor any of my sql editors like navicat, web hosts usually block outside access, web hosts usually force you to use the built in sql editors like phpmyadmin,

this is complicated but something i want really badly, it would make the game so much more fun to upload your stats and compare it to others, more motivation to have the best characters possible

theres gata be a way to read the save files and convert the needed values to xml or something, either that or the sql way but i dont think my web host will let anything connect to it

i been looking for an sql script and all i can find is the netplay plus, which is full blown multiplayer that i dont want <_<

Blizzard

Hm, right... webhosts really don't allow external SQL access. The savefiles are not entirely in english, they are dumped objects which have variables that have usually english names. You can use my DREAM for Savefiles to encrypt that data so people won't be able to hack their characters.

I think a better way then would be that the game saves some data in to a file and uplaods that file over FTP, but that might be overcomplicating simple things. =/ But then again, there's not really another way except maybe that you have a php script (or in another language) on your site which gets the data over http and stores it into database over the server.
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Mightylink

October 15, 2008, 11:18:32 am #6 Last Edit: October 15, 2008, 11:32:12 am by Mightylink
well i guess the idea is to make this as simple as possible, can you make the game write certain data values to a txt or ini?

if so then this is the format i would like to see:

Quote[Party Member 1]
NAME=Tobia
LEVEL=5
GRAPHIC=01-fighter.png (the file doesnt need to store the image, just have the name, i can have all the images website side)
HP=62  (these would be the max hp and sp, not the current)
SP=43
STR=12
DEX=11
AGI=9
INT=10
WEAPON=4 (I guess the data file would use the item id's instead of names)
SHIELD=12
BODY_ARMOR=14
ACCESSORY=nil (when nothing is equip, show none or 0 if possible)

[Party Member 2]
NAME=nil (meaning there is no second party member)
LEVEL=nil
GRAPHIC=nil
HP=nil
SP=nil
STR=nil
DEX=nil
AGI=nil
INT=nil
WEAPON=nil
SHIELD=nil
BODY_ARMOR=nil
ACCESSORY=nil

[Party Member 3]
NAME=nil
LEVEL=nil
GRAPHIC=nil
HP=nil
SP=nil
STR=nil
DEX=nil
AGI=nil
INT=nil
WEAPON=nil
SHIELD=nil
BODY_ARMOR=nil
ACCESSORY=nil

[Party Member 4]
NAME=nil
LEVEL=nil
GRAPHIC=nil
HP=nil
SP=nil
STR=nil
DEX=nil
AGI=nil
INT=nil
WEAPON=nil
SHIELD=nil
BODY_ARMOR=nil
ACCESSORY=nil

[Other Information]
LOCATION=37 (guess it would go by map ids, to show the location in the current save)
TIME_PLAYED=00:34.62 (unsure how the game formats this, prefer hours, mins, secs)

[Variables]
0001:1
0002:0
0003:5
0004:7
0005:0
0006:0 (and so on until the max is reached)

[Switches]
0001:off
0002:off
0003:on
0004:off (uses 1's and 0's if you have to.)


the reason i want the variables and switches is because i would like to show things like arena score or game progress, and have an achivement system much like xbox live, i can also create a reward system website side where they can gain codes to unlock features in the game

for a little security i guess the file would have to be encrypted or the extension changed, i just need a way to decrypt it again on my end

the reason i say my end is cause to keep it simple and working, i think i should collect the files manually from my site and update the pages myself, i dont think theres a way for html or php to decrypt the files. the players can upload the files themselves by browsing to the directory, i will have an upload page on my site for that

then i can have the stats updated weekly or so on.

once i recieve the data file then i can do the rest of the work on my end, i just need your help to get the game to write these files.

thats one way and the easiest to do it, another way would be to have the game write the data into sql querys and i can create an auto uploader to get them to my site and exicute them.

i looked into ruby-sql, according to rubyforge the plugin hasnt even been made yet, its still in the planning stages. the only other way i know is netplay plus but dont want an mmo i just need a few values <_<

im not asking to add sql to the game, just have the game write the data files in the format of an sql query, like a text file, then save it as .sql and i'll make an auto uploader from there. that way the players can have a 1 click instant update instead of my slow manual weekly maintence.

i dont know, i dont want to take too much of your time, quite frankly i would be happy enough with just the txt or ini file, and at least saving it as another extension like .som so at least the basic players dont know how to hack it

i can take care of account managment on the site, have players log in before they can upload so i wont need any of that info in the data file

Blizzard

Hm... If you could find someone who can extract the SQL connection from NP+ 2, you would actually have what you need. All you had to do would be putting a couple of queries together (or just one) and execute it.
Also, I think that you can contact your host and ask if they could open external connections up for you. You would give them a specific username and password which would be allowed to create a remote connection. You can use that username and password in the game then.
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.