Game Idea
Game Idea
Hey guys, I have this idea in my head and wanted to ask you a few questions. Anyway the idea is to make a game almost 90% in html it will be a point and click kind of game mainly using <A href /a> links to move to the next area, attack a monster, ect. But I don't want it to be a mmo just a singleplayer browser game. I would like it to be something like this *note* this was a joke *note* http://deathstop.host-ed.net/login.php but where you could continue your game from where you where last time. Can anyone set me in the right direction?

- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Game Idea
One way to save the game would be to just to have them bookmark the page. Since it's mostly html, bookmarks would work.
If you want random events which return back to the same storyline, you could pass some variables like health and experience/level through the url via get tags and process then on each page individually.
Alternatively you could go for a 'Chose your own adventure' style using php to randomise/assign percentages for which page is shown next.
pax.
If you want random events which return back to the same storyline, you could pass some variables like health and experience/level through the url via get tags and process then on each page individually.
Alternatively you could go for a 'Chose your own adventure' style using php to randomise/assign percentages for which page is shown next.
pax.
Re: Game Idea
I was thinking about the whole choose your own adventure idea but I kinda would like the player to access shops to buy new weapons get upgrades ect... as for bookmarking, that would be fine but Is there a way to do it in php here ill give you an example of what I would like my start page to look like http://www.maxgames.com/play/feudalism-2.html this is just an example but you can kind of get what the start page I would like to have mine look like look. Thanks 

- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Game Idea
It would be much more complicated than having the player simply bookmark the page they are on, but if you wanted a more advanced save system, you could always have them login and save the page they are on to a database. If you watch through the video tutorial series (you don't have to code along with it), you should have the skills required to do it 
The indelible lord of tl;dr
Re: Game Idea
I actually do know how to do it through a database (I think I'm at video 8 in the series) but I didn't really want to get into it if possible. Here is a link to my start screen, all the links are dead atm but I'm working on there pages as we speak. http://deathstop.host-ed.net/enter.php

- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Game Idea
As long as the system wasn't too easy to crack (don't just number each choice 1, 2, 3, etc.), you could just store the page the user is on in a cookie. That way you wouldn't have to have a login or a database. You could save the page they are on in a cookie as they change pages. Then just have a PHP include file at the top of each page that reads the cookie and sends the player to the page they need to be on. You could do something like this (pseudocode):
I believe you could also use headers to do an automatic transfer, although that would be a bit more complicated.
The cookie method would be much less secure than an authentication and a database, but if the game is one-player, who cares? If someone cheats they are only hurting themselves.
Code: Select all
<? //include file to send players to their "bookmark"
$bookmark = get Page String From Cookie;
$currentPage = get Current Page String From URL;
if ($bookmark != $currentPage) {
echo "Welcome to the game! Let's go back to your last saved place!";
echo '<a href="'.$bookmark.'.php">Back to saved location</a>";
}The cookie method would be much less secure than an authentication and a database, but if the game is one-player, who cares? If someone cheats they are only hurting themselves.
The indelible lord of tl;dr
Re: Game Idea
So to do this cookie method do I just place that code at the top of each page and than add my code?

- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Game Idea
I just posted pseudocode, which doesn't actually work. It just represents the logic used to solve the problem. For more info on working with cookies, check out these:
Cookies intro at PHP manual
$_COOKIE superglobal in the PHP manual
Cookies tutorial
Cookies intro at PHP manual
$_COOKIE superglobal in the PHP manual
Cookies tutorial
The indelible lord of tl;dr
Re: Game Idea
These where helpful but I am still a little confused about how to have the cookie take you to where you where by pressing the start button, is that possible?

- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Game Idea
What do you mean "the start button"? You mean a button on your webpage? That would work. Just put the button inside a form element and have the action of the form be a processing script. Inside that script I think you could do something like this (although I have never set something like this up personally):
What that will do is save the name of the page the player chose to go to into the cookie, and then the header will automatically send them to that page. The script at the top of the page you are sending them to will also check to make sure they are on the right page in case they try to go back there directly, or go back to your site later to pick back up where they left off.
Code: Select all
<?php
//save the name of the page the player is being sent to into a cookie for future reference
header( 'Location: http://www.yourgamesite.com/next_page.html' ) ;
?>The indelible lord of tl;dr