High scores on website?
Blitz3D Forums/Blitz3D Beginners Area/High scores on website?
| ||
Is it hard to get a high score table on your website that high scores from games I have made can go to? Would I have to learn PHP or something? Could I do it with b3D? |
| ||
I think (in theory) you would need some sort of cgi or java script involving post code. I've never tried this before so, I don't know but, there are a lot of good java/applet depositories you can get free pre-configured code from. Then you would have to send post data from the game to your website. If you can't google anything useful try looking up hi-scores on google, then check out sites that do have hiscore tables and maybe use view page source or email them with q's on how they implemented it. |
| ||
Well, would it be easier to show the high scores in the game? Would I need a website for that? I would want to save the high score on the net somehow and display it in the game. |
| ||
o umm I think thers something in the code archives to save a file to a net place and then there's one to donwnload it if you get my drift |
| ||
You'll need a server-side application to compare different scores though and generate a list from them. You'll probably also want to limit the scores to one per account/copy. So basically you'll need this: - Send score to server, including account/copy information (client) - Overwrite previous highest score in the list for this account with the new one (server) - Request highscore table (client) - Generate highscore table by sorting scores (server). You could add functionality like scores just above/below the user or just a ranking for the top 10. - Return highscore table to user (server) - Dsplay highscore table (client) Make sure you're very careful with passing values from your program to a serverside application; you don't want it to get hacked! So you'll probably need some encryption too. |
| ||
I do this all the time with my new games. I have both a high score table (Sparks 3!) and Halls of Fame tables. Your web site (to use my system) must support PHP and have a database (like MySQL). Visit wsims.com and look at the "Sparks 3 High Scores" and the two "Hall Of Fame" tables. All of these are automatically generated by PHP and the results are uploaded through web pages (specifically PHP scripts). If you go to "Download my free games and applications", you can get the source code to Sparks 3! and the code for the PHP scripts from the source, also. Specifically look at the .php files and the gnet_score.bb file. (I based the code of the gnet code, thus the name.) You also have to create the database tables, but you can figure out the columns from the .php files. |
| ||
I have a website, but it doesn't accept anything but HTML and Javascript. *Sigh* This seems pretty complicated. :( |
| ||
I'm not proficient at Javascript, but it seems like you might be able to still have a high score table. The key to my system is that I make "junk" web pages that BlitzBasic then just reads as a text file off of a stream (see the gnet_score.bb file). The second key to my system is that I send a request for a web page that includes parameters (like gnetscore.php?name=Bill&score=500). If you could write one web page/Javascript that writes to a plain text file and another web page which just displays that plain text file, it would be simple to manipulate my gnet_score.bb file to handle your system. Of course, unless you can create a lock on the plain text file, you might have problems updating the file without clobbering each update to it. I wish I knew just a little more on Javascript so that I could help you. |
| ||
i have a giant book on javascript but i havent got past chapter 3 :P i'll take a browse through it to see if it has any answers |
| ||
JavaScript can't write to a file, at least not that I'm aware of. Done loads of JavaScript programming. It's designed to be a secure means of adding stuff to html. Writing to files automatically means security issues. |
| ||
i asked on a scripting forum (wrox - make great books!) and by using ASP server side scripts, i think it would be possible, your host may not support it though, but there are hosts that do support it. As soon as i get my details through for the one i signed up with ill test what i was told. |