I've decided to learn PHP, and to this end, I'm going to make one of those simple little games that you see from time to time. Here's my concept (copy-pasta straight from my notes) (I'm looking for comments and ideas, feel free to respond!):
This is a kind of communal text-based adventure game on LSD. An adventure of the Internet's collective unconscious. There are no logons or anything required. Anyone can wander to the end of the Maze and make their own room whenever they want.
The Maze is made of individual rooms. Each Room has a text description, one picture, and a number of Doors (links to other Rooms).
- Room's maker gets to set the description, picture, and max number of doors (0 - bignum)
- At creation, maker can specify an unchangeable password, to update the room later, if desired
- New doors are added as the room is visited
- A new door is added at (currentdoors+1)^(rooms^0.125+1) room views
- That makes it self-scaling: As the site gets more popular, it gets harder to generate new doors
- It also means that rooms won't fill up on doors, then be stuck forever - even the most entrenched, popular room has a chance of a new door opening up, some day)
- Doors are made by anyone, first-come-first-serve, whenever a new door is available
- Either to a new room, or a link to an existing room
- No external links (to prevent evil)
- Able to set the link's text
- Rooms can only be removed for containing illegal content
- http://www.heliohost.org/h-terms.html
- This rule not only saves me the work of having to be net-nanny, but also is important to reflect the Internet's true nature
I'm doing something similar, though I don't have much planned out yet. I really like php, it's a really easy language and there's plenty of documentation. Also, PHP: Hypertext Preprocessor. Recursive acronyms ftw.
Development of my game-thing is delayed until I make get all this Linux-tastic bull**** working. I /think/ MySQL is what's f***ing Abyss, PHP, and phpMyAdmin, but without a single GUI application between the lot of them, it's not exactly easy to tell. Does anyone know how to install MySQL the /right/ way? Preferably a way that includes this winmysqladmin.exe app that every single tutorial revolves around, and doesn't put MySQL's config files in the C:\Windows directory like some kind of brain-dead Win95 app?
Banging my head on the wall of Linux anti-user-friendliness has made me frustrated, in case it wasn't obvious.
I /finally/ forced MySQL to work (yep, it was the problem all along). I just /love/ bashing out dozens of console commands...
Anyway, I've got a .php page, which serves up strict XHTML 1.0, which can connect to the database. Now I just need to work on successfully getting data out of it, instead of just "Warning: mysql_result() [function.mysql-result]: desc not found in MySQL result index 2 in D:\Dev\Web\oman\room.php> on line 19".
I wonder why it's looking at index 2? Especially since I tell it:
$result=mysql_query("SELECT 1 FROM rooms");
$desc=mysql_result($result,1,"desc");
echo $desc;
So it certainly should be looking at index 1 (where I've put some test data), no? Anyone know what's going wrong?
I /finally/ forced MySQL to work (yep, it was the problem all along). I just /love/ bashing out dozens of console commands...
Anyway, I've got a .php page, which serves up strict XHTML 1.0, which can connect to the database. Now I just need to work on successfully getting data out of it, instead of just "Warning: mysql_result() [function.mysql-result]: desc not found in MySQL result index 2 in D:\Dev\Web\oman\room.php> on line 19".
I wonder why it's looking at index 2? Especially since I tell it:
$result=mysql_query("SELECT 1 FROM rooms");
$desc=mysql_result($result,1,"desc");
echo $desc;
So it certainly should be looking at index 1 (where I've put some test data), no? Anyone know what's going wrong?
What's that "desc" in there for? That's the space for the field name in the result set, so if you don't have a column called "desc", it's gonna give you an error.
"desc" is a column, yes - it contains each room's text description. And that counting-from-0 thing, ah, right, I guess using Lua so much made me forget that. But it finally works!
After more hammering on the script, I've implemented the "game"'s first two features: It tracks how many times each room has been viewed, and it knows when rooms should get new doors, based on the formula (currentdoors+1)^(rooms^0.125+1). Or, should I say, pow(($numDoors+1), (pow($roomsTotal, 0.125)+1)).
Next up, showing a room's doors as links to other rooms...
Is anyone interested in this, or should I not bother putting it online?
"desc" is a column, yes - it contains each room's text description. And that counting-from-0 thing, ah, right, I guess using Lua so much made me forget that. But it finally works!
After more hammering on the script, I've implemented the "game"'s first two features: It tracks how many times each room has been viewed, and it knows when rooms should get new doors, based on the formula (currentdoors+1)^(rooms^0.125+1). Or, should I say, pow(($numDoors+1), (pow($roomsTotal, 0.125)+1)).
Next up, showing a room's doors as links to other rooms...
Is anyone interested in this, or should I not bother putting it online?
Bah, I'm tired of this bloody problem... I may just switch over to SQLite, or something...
Just so I can feel as if I've accomplished /something/, I've whipped up an ultraminimalistic, CSS-tastic theme for my site. Completely frame-free, strictly XHTML 1.0 compliant, and using less than 9kb of images. Chances are that anything that doesn't follow web standards will utterly fail to render it (*coughIEcough*), but that's a sacrifice I'm willing to make.
You can see it here. Please note that I have a lot to do, still... Most importantly, I need to make the damn doors work properly... But I guess you could critique my bizarre theme, or comment on whichever room I happen to be testing at the moment.
EDIT) I can use PHP /in CSS/?! Oh, man. Oh man! It's going to take a /lot/ of willpower to stop myself from designing a randomized automatic theme generator. But I'll let myself keep the randomized clouds.
I've dropped MySQL. And I'm so happy that I have. After some initial struggling with configuration and having to learn all the new commands, I've moved up to PHP 5.3 and SQLite 3. I'm also using PDO. Now that I can reliably get stuff from a database, I can start moving forward again! Onto doors...
EDIT) The backend of that feature is ready. $_REQUEST is pretty cool. I've also added some error-checking in case a user tries to go to a nonexistent room. It seems that SQLite doesn't have an array data type, so I'm going to have to use delimited lists and parse them with PHP. Doors should be almost ready after that.
I've also built the page in such a way that there's a shell of proper HTML and CSS, and inside that is an included PHP file which fills it with data. This means that I swap out the shell page to create different themes / graphics quality levels, without having to worry about PHP filling. Also means I can update the filling, and all the shells will instantly use it. And still all without frames .:biggrin.gif:
Doors are working! Hell yes! You can take a look here. Each room has its own door(s) (which are a link to another room, with a customizable description), which get listed after the room's description.
Next up, exciting stuff: Making the form that'll allow people to make new doors and rooms.
EDIT) *Laughs* I got distracted by the possibility of making themes, instead. Now my page is chopped into a number of replaceable pieces and my site offers a regular and a low-graphics option, easily selected from a little box at the bottom. The latter should be compatible with non-standards-compliant browsers *coughIEcough*, and will certainly run faster (no fixed-position images, no image scaling, etc.).
Banging my head on the wall of Linux anti-user-friendliness has made me frustrated, in case it wasn't obvious.
Anyway, I've got a .php page, which serves up strict XHTML 1.0, which can connect to the database. Now I just need to work on successfully getting data out of it, instead of just "Warning: mysql_result() [function.mysql-result]: desc not found in MySQL result index 2 in D:\Dev\Web\oman\room.php> on line 19".
I wonder why it's looking at index 2? Especially since I tell it:
So it certainly should be looking at index 1 (where I've put some test data), no? Anyone know what's going wrong?
What's that "desc" in there for? That's the space for the field name in the result set, so if you don't have a column called "desc", it's gonna give you an error.
Also note that computers begin counting at 0.
After more hammering on the script, I've implemented the "game"'s first two features: It tracks how many times each room has been viewed, and it knows when rooms should get new doors, based on the formula (currentdoors+1)^(rooms^0.125+1). Or, should I say, pow(($numDoors+1), (pow($roomsTotal, 0.125)+1)).
Next up, showing a room's doors as links to other rooms...
Is anyone interested in this, or should I not bother putting it online?
I'm interested.
If I deserve one, give me one.
Just so I can feel as if I've accomplished /something/, I've whipped up an ultraminimalistic, CSS-tastic theme for my site. Completely frame-free, strictly XHTML 1.0 compliant, and using less than 9kb of images. Chances are that anything that doesn't follow web standards will utterly fail to render it (*coughIEcough*), but that's a sacrifice I'm willing to make.
You can see it here. Please note that I have a lot to do, still... Most importantly, I need to make the damn doors work properly... But I guess you could critique my bizarre theme, or comment on whichever room I happen to be testing at the moment.
EDIT) I can use PHP /in CSS/?! Oh, man. Oh man! It's going to take a /lot/ of willpower to stop myself from designing a randomized automatic theme generator. But I'll let myself keep the randomized clouds.
I've dropped MySQL. And I'm so happy that I have. After some initial struggling with configuration and having to learn all the new commands, I've moved up to PHP 5.3 and SQLite 3. I'm also using PDO. Now that I can reliably get stuff from a database, I can start moving forward again! Onto doors...
EDIT) The backend of that feature is ready. $_REQUEST is pretty cool. I've also added some error-checking in case a user tries to go to a nonexistent room. It seems that SQLite doesn't have an array data type, so I'm going to have to use delimited lists and parse them with PHP. Doors should be almost ready after that.
I've also built the page in such a way that there's a shell of proper HTML and CSS, and inside that is an included PHP file which fills it with data. This means that I swap out the shell page to create different themes / graphics quality levels, without having to worry about PHP filling. Also means I can update the filling, and all the shells will instantly use it. And still all without frames .:biggrin.gif:
Next up, exciting stuff: Making the form that'll allow people to make new doors and rooms.
EDIT) *Laughs* I got distracted by the possibility of making themes, instead. Now my page is chopped into a number of replaceable pieces and my site offers a regular and a low-graphics option, easily selected from a little box at the bottom. The latter should be compatible with non-standards-compliant browsers *coughIEcough*, and will certainly run faster (no fixed-position images, no image scaling, etc.).