Dynadot

Seeking Help

Spaceship Spaceship
Watch
Forgive me for bombarding you with this but i am going brain dead here and I am seeking enlightenment :)

What im working on is an idea propogated by users on my forum at www.TruSpirit.net . On one of the main pages i have an image (currently a simple ball) that roves around the screen. Easy little java script with a few adjustable variables.

Now the image is linkable so i had the idea to make a game out of it. Catch the roving ball and you get sent to the next "level" of play where the image is harder to catch by adjusting the speed and or size of the image.
So far so good and easy to set up. Now on each "level of play" page we add a little quit link so those who have givin up on the insanity of trying to catch it can bail out. This link would take you to a scoring type page where by use of a simple form the player could input his/her name and a hidden score would also be sent dependent on the level they reached. Still easy.

My problem is im not quite sure what to do with it after that.
What id like to do is have that form sent to be compiled with any previous scores the person had and the results posted to a score page with all the other players scores listed as well. Ive been reading through cgi tutorials but it hasnt been helping and i cant get what i want to click in my head. Im not even sure if what i need is related to cgi, database, or what. Im assuming of course ill need to "grab" the results from wherever with a SSI but im stuck on the handling portion.
Anyone can point me in the right direction or give me a leg up here? All help Apreciated!

SW
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Use PHP.

I haven't used php in months though.. and i wasn't so good at it back when i did use it.... so i wouldn't be able to tell you exactly what to do.. But i know it can do it... btw, where isn't a cgi language... Perl is what is most often found in .cgi files.
 
0
•••
My problem is im not quite sure what to do with it after that.
What id like to do is have that form sent to be compiled with any previous scores the person had and the results posted to a score page with all the other players scores listed as well.
I'm not quite sure what you're wanting to do right here.

What I'm wondering is do you want all the users current high scores (only) listed or do you want each users score from each game listed?

And if you're wanting to add each users scores up for each game they played?
 
0
•••
Im thinking of a high score sheet yes. With the total for each persons score added to any previous score they may have earned. Not each individual game listed.
 
0
•••
Alright I think I know what you're saying now, but let me double check. :D

So you want to have each users score stored somewhere, so that you'll be able to go back and retrieve the data when they play again, and then add their new score to their old score, and that will be their current score?

Also, if their new score was less than their old score would you still want to add the newscore to their old score, or would you just want to leave it as is?

It just seems kind of pointless to me, to add the new score to the previous scores, because all someone would have to do is a play the game alot more than anyone else and they could have the high score. So it wouldn't really reflect who has made it to the furthest level. :)

Wow it's amazing the questions that can come up when thinking about writing a program huh? LOL :webdev:
 
0
•••
Yes Exactly!

And your right about the scoring system but it cant be helped because this will be based towards a reward system where the person with the highest total score at the end of each week will recieve a prize. And the levels will be progressive enough where someone who does very well will have an extreme advantage over say someone who does poorly but plays a lot. Besides which that ball is DARN hard to catch lol. Frustration will kill it for many peeps. Also i suppose i could restrict it to once per day but UG! dont even want to get into that lol. That would prob be best done in php and i am WAY to noob at php yet to go that route.
Or cookies, ug! Im making something simple harder than it needs to be lol.
Best game score could work ok too though and i can see where that would hafta be easier to setup and control.
Ok you may be right there, best score could work very well also.
OOOoooo and i just got to thinking about a few of the users who hit my site a LOT. Can we say bandwidth use? EEEk! Especialy since im expecting up to 5000 more users in the next month or two. Ok, best score list wins :p
 
0
•••
Cool, sounds like a fun little bit of code to write. I'm no programmer, but when I get some free time I'll see if I can come up with some code that may work for you or atleast get you going in the right direction. :D
 
0
•••
Again i say, use php. Except now that i know what you want to do, store the scores in a dat file or something.. and keep track of your players using IP's or make them signup for a login
 
0
•••
Hey SpiritWolf, I came up with a little code that may work for your little game idea. I used Perl and a little PHP. The files are attached below if you want to give it a try.

I noticed you were using phpBB so I took advantage of your current member system. This same code could probalby work with similar games that have levels.

What it does is automatically have the username and the score in a hidden field in the form, so when they are done playing they just click submit score and it logs it. If they aren't logged in they'll get an error. I think it covers most of what you wanted to do. Of course you change the form code and move it around or what ever you want to do.

To just view the results without playing you can create a link to the game.cgi file and when it's clicked it will show the current scores.



INSTRUCTIONS:

1. You need to open up the game.cgi file located in the scores directory, make sure the path to Perl is correct, and edit these variables below accordingly.

########################################################################
#Domains that are allowed to run the script.
my @valid_domains=("http://www.domain.com", "http://domain.com");

#The server path to the directory with the cgi files with trailing /.
my $dirpath = "/home/public_html/cgi-bin/scores/";

#The name of the main score file
my $scorefile = "scorefile.txt";

#The max number of lines printed to the score file to prevent it from growing to big
my $maxlines = 15;
########################################################################

2. Upload the scores folder and all files inside it to your cgi-bin directory in ASCII mode.

3. CHMOD game.cgi to 755

That should be it for the cgi files.


There's also some PHP files attached in the post below.
You need to open them and change the variables below accordingly.

You can put your game code inside these PHP files in the places it needs to go.

<?php

//################################################################
//The server path to your phpbb directory without the trailing /
$fullpath = "/home/public_html/phpBB2";

//The score for this level
$score = 20;
//################################################################

Also in these PHP files you can change this part in bold to prevent people from cheating.

if ($_SERVER['HTTP_REFERER'] != '/phpBB2/level1.php') {
echo 'Sorry you have to start from the beginning';
exit;
}

This would make it so that you can't get to this page unless you get to it from the /phpBB2/level1.php page. So in the level three page you could change that to /phpBB2/level2.php, but of course with the correct paths.

If you want to make more levels just copy the code into a text file, change the variables accordingly, add in your game code, save it as a .php file and upload to your phpBB directory.

I included a few examples attached in the post below.

Well let us know if you give it a try and if it works or not and if you have any questions, comments, suggestions etc. :D
 
0
•••
PHP files

Here's the example PHP files that you would add your game code to.

You'll probably need to upload these into your phpBB root directory in order for them to work.
 
0
•••
thanx ill give it a try when i get a chance this week and let you know how it works out.
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back