So a few days ago I decided to get back into PHP coding. My first initial project was to attempt to fix the old Starcraft Armies we used to have, but I've given up on it mainly because don't know what each variable represents and lack of PHP knowledge by my part.
So I decided to make my first project one of the "Moose style" simple PHP games that he's been doing. The game will be very simple in terms of PHP coding and there won't be much usage of MySQL by my part.
I've decided to make the user take greater part in the game, instead of just clicking a
button. Here's the general idea:
Lucky Dice
A user will test his luck and risk towards the lucky dice. He will input the amount of minerals he wishes to bet. Once he has bet his minerals, he will be prompted to roll the dice. Depending on what number has been randomly generated, different outcomes are resulted. The different outcomes I've projected are:
6 different values
1 and 2 will generate loss and user will loose all current betted minerals
3 will subtract divide minerals by 2
4 will multiply by 2
5 will multiply by 3
6 will give another free chance
New amount of minerals is generated
If 1 or 2 is rolled, generate the index.php and start code to prevent players from playing in same day twice
If 3,4,5 or 6 are rolled generate the next system, probably the "Double or nothing"
If the user wants to take a bigger risk, he may go "Double or Nothing", in which 2 possible outcomes will be randomized, one will duplicate his minerals by 2 and the other will make him loose that amount of minerals.
As I made this post, I realized that multiplying a certain amount of minerals, like 1000 by 6 will yield insane amounts of minerals. I'm now thinking of making a maximun bet limit of 100, and maybe lower the multiplications from 2 to 1.5 and from 3 to 2.
I don't really have much code right now, but progress will start to pick up now since I'm done creating "Fake testing variables" and am starting on coding the actuall dice.
Here's what I got coded so far:
- HTML Form for username (Testing purposes, this is to say like "Congratulations BeeR, you've won X minerals!")
- User mineral Randomization (Testing purposes)
- Integer Limits (This will prevent users from entering an amount equal or less than 0 or greater than their current amount of minerals)
- Error page (This will display a small error page, possibly stating that you've done something wrong)
What needs to be done:
- Array to give an error when user bets with characters other than numbers
- The actual dice randomization
- Outcomes of each number (1-6)
- Results page
- Double or Nothing
And then, modify it to fit SeN's MySQL Database. I think this step I'll leave up to IP or Moose since I have almost no knowledge of getting a value from a MySQL Database and then manipulating or editing it. If it's simple enough, I could do it though.
Comments, discussions or suggsetions?
Hmmm... I dunno. Ever play dice-a-roo on neopets? ;o
Nope, I can still modify whatever if anything else is to e different.
QUOTE(IsolatedPurity @ Apr 16 2006, 04:08 PM)
Hmmm... I dunno. Ever play dice-a-roo on neopets? ;o
[right][snapback]466920[/snapback][/right]
Omg... so addicting. Must get up to... silver... die...

I've forgotten to mention that I plan to have some sort of limit on how many times you can play per day or how much time you need to wait between plays. I'm planning on having 1 roll per day(not 24 hours).
If you're willing to write the code, I'm willing to patch it up to run on SEN.
Yes, I'll be coding the whole engine, as I've already started, you can just set it up to be compatible with the MySQL. I expect to be finished in maybe 1~2 weeks, depends on the bugs I'll encounter along the way.
ADDITION:
I'm almost done coding the entire engine. I've coded everything except the Double or Nothing scenario, which should be quite easy to code, the filter to prevent negative minerals or characters other then numbers to be bet, and the feature to prevent users from playing more than once on the same day(not 24 hours).
Then I'll start coding how it'll actually look, right now, it's just a bunch of plain text.
After this, I'll set up a test page at my site, so that more etsting can be done and final tweaks and changes could be made. Then Moose can go ahead and patch it to upload it at SeN.
Edit: I've finished the input minerals to be filter. If the minsbet are less than 0 or if the minsbet are more than your current minerals, you'll get an error page. Do you think I should also add 0 to this filter? Currently, I'm keeping 0 for the people who like to play but not risk it.
Free plays might not be so bad.
Alright, 0 has been accepted.
I need to finish the Double or Nothing code, limit play to 1 per day and content tables, and add that fancy stuff.
Here's a few screenshots of how it's coming out.



Looks spiffy. Has anyone given you the code for the 50/50 Raffle or Magic boxes? The more compatible you can make it the better.
I would prefer having the code from the 50/50 Raffle, since it looks more similar to what I have in mind, but then I'd need the code from Magic Boxes one play per day, since I can't make a MySQL database to store time, so yes, I'd like both codes.
ADDITION:
Alright, just letting you know that I've copied SeN's CSS code into the header that I'm currently using so that I can actually see how it's going to look. I haven't done much coding lately, except playing around with what I already made to make it more efficient. I also changed the table a bit, I think I already go the full result coming along.
Here's a screenshot of the fully finished rules page, it'll look exactly like this at SeN.
Here's the code.
raffle.php - Backbone of the raffle's code and functionality.
skin_m_raffle.php - The skin file for the raffle, handles most of the HTML output.
raffle_go.php - Determines the winner, pays him, etc, all the daily stuff. The same function is in the raffle code for the admin options anyway.
magicbox.php - Backbone of the Magic Boxes' code and functionality.
skin_m_boxes.php - The skin file for the raffle, handles most of the HTML output.
m_boxgo.php - Resets the boxes. Yes, I know the loop can be simplified, I've just been lazy on that.

Rather than install a while loop I'm going to see if I can remember how to do that in a single query instead of 36.
Statisically, how would it effect the economy though?
A lot. Multiplying minerals by 3 and then by 2, to bring a total of 6 minues the amount bet could bring, in esence, over 12000 minerals just like that.
That's why I have put more chances to loose minerals than to win.
I also think I should put a limit on the amount of minerals to be bet. I'm thinking somewhere around the lines of 100~250 maximun mineral limit to bet.
Here's how my code is looking like:
dice.php - Where a user inputs the amount of minerals to bet
form.php - Where the whole rolling takes place and limits of the mineral bet
dice_func.php - Functions and switches of the first dice roll, also has conditions for the second dice roll
dice_func2.php - If conditions allow, a user may choose to roll again, the second die roll is here
rules.php - Rules
data.php - Testing purposes, determines random amount of minerals for a user
header.php - Testing purposes
footer.php - Testing purposes
error.php - Testing purposes
Well, I'm going to have to combine all of your output pages into functions of the main and skin file.

Probably. That and you have to replace the variables SeN uses for usernames, minerals and I'm thinking about sticking avatars in the main page. Also, I know nothing about MySQL, not do I have one, so somehow, minerals are going to have to be edited.
I made it simple though, you have starting minerals, which my system then works with and such and then you have ending minerals, which is the new amount the user has.
At first, use the testing column "a_minerals" or whatever for testing purposes.