Results 1 to 14 of 14

Thread: My Killer App!

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I wrote this!

    it's a "Snake" game the same as on Nokia phones but high-scores are kept in a database on an internet server

    it is written in VB5.

    when/if you go to this page you'lll be prompted for a username and password.

    This is then entered into the database and when you download the exe, your highscores will be posted back to the site.

    Yeah! it took me ages to work out how to transfer the username from the website to the pc.


    http://www6.ewebcity.com/coolsite/snake/


    I can guarentee that it will NOT format your harddrive or do anything nasty to you or your PC


    Mark
    -------------------

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696

    Cool

    Very Good Mark

    A little bit of Nostalgia for you. Snake originally came when DOS was around and a version came with QBASIC that you could tweek to make more interesting, Also A game came called Monekeys came with QBASIC and consisted of two gorillas standing on top of Buildings, chucking explosive bananas at each other. The best part of the game was that you could tweek the size of the explosions to take out half the screen at a time.

    All the Best

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb Wander how you write the games?

    Cool Man & Damn Fast... but I still get on top of you...

    Hall of Fame for Snake2
    Name Score

    Chris 165

    ian 65

    Mark Sreeves 35


    [Edited by Chris on 06-09-2000 at 02:38 PM]

  4. #4

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    I'm glad you like it!

    I forgot to mention. The game has to be downloaded on the PC you want to run it on for the high scores to work.

    If you copy it to another PC the highscores probably won't work.

    WHY?

    Then you register and download the .zip file your usename is sent to your browser as a cookie.

    Then, when you run it for the fist time the user name is read from the cookie and stored in your registry.

    When you beat your previous high score, your username is read from the registry and posted back to the website along with your new high score.

    The cookies are fisrt read by connecting to the site again

    getcookie.asp

    Normally, you would put stuff in the asp to prevent it from being cached but I didn't bother to make it easier to read the page from VB.

    The reason why I'm telling you this is that if you "register" again your new username will be stored in a cookie on your PC but when you run the program the getCookie.asp will be retrieved from the cache so the old username will be used still.

    I could fix this but I can't be bothered!



    Mark
    -------------------

  5. #5

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I was asked for some instructions

    Use your arrow keys to steer the snake to eat the food
    Mark
    -------------------

  6. #6
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    great job, I remember a game like this from back when I had a 386, and you had to eat either red or yellow apples or something, and woohoo I got the highest score (I doubt for very long but anyways)

    Hall of Fame for Snake2
    Name Score

    Crypt 195

    Chris 165

    ian 65

    Mark Sreeves 40

    Sam Finch 0

    Shabra 0

    r 0

    gfdgfd 0

    Did you write the asp yourself for the high scores? or did you get it from somewhere? just wondering because I wouldn't mind having a high scores thingy on a game (if I ever make one lol), if you didn't make the active server page yourself (I wouldn't have a clue how to make one) would you mind telling where you got it from and how to install one on a website? if not don't worry about

    thanx and great job.

    oh yeah and I like your version better than the one back from the 386 days (I always used to die lol because you couldn't go over yourself when you became a big snake).

  7. #7

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Crypt

    Yeah I wrote it all myself.
    It's trivial really stuff really
    this is basically the code to update the remote database.

    Mine is a bit more complicated because I use the same script to show the high scores as to post the updates.

    this code goes in an ASP file and I use an internet transfer control within the vb app to call it

    I've changed the names of the text fields after the line 'updating database details and anyone who knows anything about ASPs will know why!




    Code:
    <%@ Language=VBScript%>
    <HTML>
    <head>
    	<!-- Prevent the page from being cached -->
    	<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    	</head>
    <BODY>  
    <%
    
    dim strSQL
    dim rst
    dim conn
    
    
    	Set conn = Server.CreateObject("ADODB.Connection")
    	conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\Snake2.mdb")
    	
    	'updating database details
    	name = request("theNameOfYourNameField")
    	pass = request("theNameOfYourPasswordField")
    	score = request("theNameOfYourHighScorefield")
    		
    		strSQL = "UPDATE tblScores set score= '" & score & "' WHERE name= '" & name & "'AND password='" & pass & "';"
    		
    		conn.Execute(strsql)
    			
    conn.Close
    set conn = nothing
    
    %>
    
    </BODY>
    </HTML>

    I didn't realise that you could go over yourself!

    This is version 2. Version 1 which posted to a Personal webserver on my PC didn't allow you to.

    The snake is an array of shape controls. With my version 1 each time the snake moved, the every shape was moved this made it slow down as the snake got longer.

    This version uses an array of shapes but only moves the end shape to the front each time it moves.

    After I re-coded this bit I didn't bother to test it much because it seemed to work OK!

    It's to late to fix it now...



    Mark
    -------------------

  8. #8
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    thanx for that asp script, I've had little to none experience with asp before, just a couple of questions though 1. do you have to create a database file and upload it first or will it just create one if it doesn't exist? and second how do you get an asp page to read the results to print the top scores?.

    well I like that you dont loose if you go over your snake I actually stood a chance at winning the game when I found that out lol.

  9. #9

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Crypt

    You have to create a databse and then upload it

    Here's the script for reading the database

    This is for the one on PWS not the website

    Code:
    <%@ Language=VBScript%>
    <HTML>
    <head>
    	<!-- Prevent the page from being cached -->
    	<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    	</head>
    <BODY>  
    <%
    
    dim strSQL
    dim rst
    
    dim conn
    
    
    	Set conn = Server.CreateObject("ADODB.Connection")
    	
    	
    		conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\Snake2.mdb")
    
    
    		Response.Write "<TABLE border=0 cellPadding=0 cellSpacing=0 width=200 VALIGN='TOP'>"
    		Response.Write "<TR><TD COLSPAN=2><h3>Hall of Fame for Snake2</h3></TD></TR>"          
    		Response.Write("<TR><TD WIDTH=100 VALIGN='TOP'><B>Name</B></TD><TD WIDTH=100 VALIGN='TOP'><B>Score</B></TD></TR><BR>")	  
    
    		strSQL = "SELECT * FROM tblScores ORDER BY score DESC;"
    	
    		Set rst = conn.Execute(strSQL)
    		while not rst.eof
    			Response.Write("<TR><TD WIDTH=100 VALIGN='TOP'>" & rst("name") & "</TD><TD WIDTH=100 VALIGN='TOP'>" & rst("score") & "</TD></TR><BR>")
    			rst.movenext
    			
    		wend
    		Response.Write"</table>"
    		
    		set rst = nothing
    		
    	
    conn.Close
    set conn = nothing
    
    %>
    
    </BODY>
    </HTML>
    Mark
    -------------------

  10. #10
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    lol I think i will quit asp before I even get started lol, wouldn't have a clue how to set that up.

    that snake game is addictive though lol but once you get up to 400 points it starts getting hard to tell your head from your tail and where the food is lol.

  11. #11
    Addicted Member Mih_Flyer's Avatar
    Join Date
    Mar 2000
    Location
    some place there
    Posts
    241
    hey man, i tried to go to http://www6.ewebcity.com/coolsite/snake/ but i couldn't,,, what's wrong with this url,,is it right or what?

  12. #12
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    I can't try it either,

  13. #13
    Addicted Member Mih_Flyer's Avatar
    Join Date
    Mar 2000
    Location
    some place there
    Posts
    241

    Unhappy

    I want to see this game, what ever it takes i wan to see it, please e-mail it to me if you can,,Thanx

  14. #14

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    ewebcity are currently performing some upgrades to their servers so if you really want it you'll have to try again later.

    It's nothing to get excited about anyway!


    Mih_Flyer, I can't email it to you because it keeps the high scores on the server and you have to entrer your name on the website for so your highscores are accepted.

    It's all a bit shaky anyway.
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width