FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Responsive Form, Games
(Moderator: REAS)
   i've made a game with savable highscore
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: i've made a game with savable highscore  (Read 2758 times)
seltar


i've made a game with savable highscore
« on: Mar 6th, 2005, 2:53am »

http://space.wliia.org
 
The game saves the highscore using a phpscript which saves the persons points and initials to the highscore-file.
This way you don't need a signed applet to write to files on web using saveStrings() and such.  
 
If anybody has any questions on how to do this, i'll be happy to help out..
 
-seltar
« Last Edit: Mar 6th, 2005, 4:22pm by seltar »  
mflux

fluxhavoc WWW
Re: i've made a game with savable highscore
« Reply #1 on: Mar 6th, 2005, 3:09am »

I like the graphics a lot :] especially the planets.
I don't like the controls so much. And I don't really get the point of the game, but I know you're trying to demonstrate saving data from p5 to server.
 
Mind if we see the source? I'm interested to see how you did this
 
seltar


Re: i've made a game with savable highscore
« Reply #2 on: Mar 6th, 2005, 3:16am »

I was trying to make a small, fun game.. which happens to include saving data
 
but no, i'm sorry.. can't give the source..  
it's a product for sale, so the best i can do is give you my explanation for any questions you might have, and perhaps bits and pieces of the code..

 
-seltar
 
marcello

WWW Email
Re: i've made a game with savable highscore
« Reply #3 on: Mar 6th, 2005, 11:39am »

Hi seltar,
fun but difficult game. Have you thought to implement curvilinear trajectories?
 
I have a question for you: in order to allow exchange of data between the applet and the phpscript are you using php global variables?
 
Looking through the lifevslife sourcecode i saw how that applet saves and loads data from a server. It uses the p5 command loadStrings addressed to a phpscript. The exchange of data happens by means of php global variables. Here is an example of code:
 
Code:

String lines[] = loadStrings("http://www.someurl.com/somescript.php?somestring="+somep5string);

 
I've already implemented this very simple way to exchange data between an applet and a script. Nevertheless, in order to avoid security problems, now i'm looking for another way. I would like to avoid to use global variables.
 
Best Regards,
Marcello
 
seltar


Re: i've made a game with savable highscore
« Reply #4 on: Mar 6th, 2005, 3:50pm »

Hehe, i know the game is a bit hard..  
I'm thinking of ways to increase the playability with it.. so there will probably be new versions out at some point in time.
 
Over to your question, i believe this function might satisfy your needs:
 
Code:

void postNewItem (String S) {  
 try {  
   URL url;  
   URLConnection urlConn;  
   DataOutputStream   dos;  
   DataInputStream    dis;  
 
   url = new URL("http://" + strURL + "/simulate/statscapture.php");  
   urlConn = url.openConnection();  
   urlConn.setDoInput(true);  
   urlConn.setDoOutput(true);  
   urlConn.setUseCaches(false);  
   urlConn.setRequestProperty ("Content-Type", "application/x-www-form-urlencoded");  
 
   dos = new DataOutputStream (urlConn.getOutputStream());  
 
   String message=S;  
   dos.writeBytes(message);  
   dos.flush();  
   dos.close();  
 
   // the server responds by saying  
   // "SUCCESS" or "FAILURE"  
 
   //todo next 3 undo  
   dis = new DataInputStream(urlConn.getInputStream());  
   String s =""; // = dis.readLine();  
   dis.close();  
 
   if (s.equals("SUCCESS")) {  
     ;   } else {  
     ;  
   }  
 
 } // end of "try"  
 
 catch (MalformedURLException mue) {  
   ;  
 }  
 catch (IOException ioe) {  
   ;  
 }  
 
}  // end of postNewItem() method  

 
Found it on this forum:Processing <-> PHP <-> MySQL
 
Hope this helps..
 
In my game, i unfortunately use globals, since i didn't find this post until now..
So please let me know if you get this to work, and how to add multiple fields in the function..
 
-seltar
 
marcello

WWW Email
Re: i've made a game with savable highscore
« Reply #5 on: Mar 6th, 2005, 6:36pm »

Yes,
i already knew that thread: i started it
 
The problem is that i have very little time to work on these things and to post in this forum so my progress are usually very slow. Now I'm going to post a question in that thread.
 
Best Regards,
Marcello
 
seltar


Re: i've made a game with savable highscore
« Reply #6 on: Mar 7th, 2005, 1:08am »

Dynamic function that POSTS multiple data to a dynamic php-script, and writes info to textfile
 
http://wliia.org/projects/postit/
 
think source code speaks for itself, and if it doesn't just drop me a line..
 
-seltar
 
seltar


Re: i've made a game with savable highscore
« Reply #7 on: Mar 7th, 2005, 8:54pm »

Major updates in my game!
Mostly graphical, but still..  
It looks alot cooler now!
 
http://space.wliia.org
 

 
-seltar
 
Pages: 1 

« Previous topic | Next topic »