
-----------------------------------
ecliptical
Mon Jan 02, 2006 10:18 pm

[Tutorial] Online HighScore Module
-----------------------------------
Before we start coding you need to ask yourself if it would be better to use just local storage for scores if thats the case then follow this tutorial by hacker dan

What you'll need for this to work:
-PHP 4x on any server 
-Domain Name/WebSpace (or possibly some free hosting subdomain service haven't tried it) 
-Turing 4.04d 
-A Game (The game i've included if it isn't obvious is a pseudo code compacted game")


The Game: This is just an example of how this works.

procedure RunMyAwsomeGame
if PlayerDied then
gameServer.SendScore(playerId,finalScore,emailAddress:string)
else
 Run.TheGame
end RunMyAwsomeGame

RunMyAwsomeGame



So it's pretty simply so far, once the player dies we send his/her info to the server.

Not My Job: Create the required code to check when the player has died and store the playerID and finalScore in a variable.



module gameServer
    export SendScore
    procedure SendScore (playerID, score, emailAddress : string)
        var netStream : int
        var netLine : string (1)
        netStream := Net.OpenURLConnection ("")
        if netStream 






Ohh and the usage of course is 

gameServer.SendScore("JohnSmith","3423")

There I guess that wasn't so hard we've actually added the players score to our database (just a normal text file) and included that file so his result will be displayed. 


Turing seems to like properly formated HTML pages so the next part of this 
tutorial will include how to strip out that html and sort the results.

Also the next part of the tutorial will include how you encrypt the code. Because as if you are distributing your game with the source then someone could just easily send whatever score they wanted to your highScoreHandler.php

Currently my server just upped its security so I wasn't able to test this code but a couple of weeks ago before the upgrade it worked fine so I"m going to assume it's still working however while rewriting it I may have messed some stuff up let me know if anything looks out of place or if you have any questions in general.

Future gameServer Tutorials
gameServer.GetMove
gameServer.SendMove
gameServer.BanUser
gameServer.Login
gameServer.Logout
gameServer.GameUpdate :Does the player have the latest build of your game? If not download an update.
-this isn't working totally yet.
gameServer.getHighScore


That's pretty much all I've worked on but development has been put off until my server stuff is resolved.

Anyway this works pretty great for Turn based games...and with some AJAX hotsause you might even get some decent proformance for real time games...but thats a whole other Tutorial enjoy.

-----------------------------------
ecliptical
Mon Jan 02, 2006 10:32 pm


-----------------------------------
scratch that I just remembed AJAX includes javascript (duh!) which is executed on the client and in this case the client is Turing which does NOT have a javascript engine. 

So realistically the only "real" time game would be one where part of the game play has a time limit so you can send moves back and forth without lag.

-----------------------------------
Taur
Wed Jan 04, 2006 7:02 pm


-----------------------------------
okay but I got a bit confused with the web part.  :? Where do we put the "usage" 

could you just attach the files we have to upload to our server? and what if we want to send a string, is that aldready converted to a string and we're not sending an interger variable?

-----------------------------------
ecliptical
Thu Jan 05, 2006 12:11 pm


-----------------------------------
opps I had the in an earlier version that caugh int's must of got lost in the rewrite - anyway once my issues with my server are resolved I'll post all of the gameServer modules

-----------------------------------
Taur
Thu Jan 05, 2006 9:07 pm


-----------------------------------
k thx

-----------------------------------
ecliptical
Thu Jan 05, 2006 9:20 pm


-----------------------------------
Taur do you have a host that runs php scripts?

-----------------------------------
Taur
Fri Jan 06, 2006 9:20 am


-----------------------------------
I think so, try

www.freewebs.com

-----------------------------------
unknowngiver
Fri May 12, 2006 10:28 am


-----------------------------------
hey
now since you can submit stuff from turing to php...can you make a Program that sends stuff from turing to PHP which inputs it to a database...and then when user wants to recieve the information thats in the database..the program runs another php script which gets the stuff from the database and puts it on the turing screen?
can i do something like that in another way? i really need this! thanks
