New PHP Game site

sclewin

New Member
Messages
88
Reaction score
0
Points
0
Hi,

I recently learned about PHP, Javascript, and MySQL and put together a test PHP/MySQL game. I am now all hyped up and want to write a online PHP strategy game and, if possible, would love any suggestions or warnings.

First, is that allowed on the x10hosting. I went through the commandments and could not see any problems, but want to make sure. I know I need an advertisement on every page.

Second, I will be using a MySQL database to save the player information. Any suggestions in keeping down SQL traffic would be of GREAT help. Also, how much MySQL traffic is considered not bad and how much are we allowed? Is this part of hour web page bandwidth? Or is Databases treated differently? X10Hosting haves been so great, I want to make sure I am as good to them as they have been with me.

I am also thinking about putting some of my ads on the page, if allowed, if the game becomes popular. I will probably start with a link to x10Hosting and try to gain referrals, but, possibly adds Google ads or similar later. Is this allowed? Are there any good advertisements plans that are recommended? Also, how many adds are considered uncomfortable? I don't want too many ads, the page after all is to be a good game, not for ads.

Any advice/help will be greatly appreciated.

Your friend,
Scott
 

legendphil

New Member
Messages
152
Reaction score
0
Points
0
hao!

you must be some kind of a genius! what type of game will it be? are you working with a team? if you can afford you can sign-up for a development package in x10hosting. I don't know the features of that package but that seems well for your endeavor (the limited offer thingy makes me think its really awesome).

I think you can save bandwidth by compressing php I saw it from a manual before I kinda forgot the details <again>. Anyways there's always http://php.net for studying php deeper.

SQL traffic... hmm... I wonder.

regardless of the type of account, your ads are allowed (for me this is an eye-catching feature I saw before I signed up)
 
Last edited:

sclewin

New Member
Messages
88
Reaction score
0
Points
0
hao!

you must be some kind of a genius! what type of game will it be? are you working with a team?



You must be thinking of a much bigger game than I am :) I am thinking of a simple text based game that is fun to play. I have no team, just any advice I can find from good helpful people.

Your friend,
Scott
 

flinx

New Member
Messages
68
Reaction score
0
Points
0
I think you can save bandwidth by compressing php

Compressing PHP or not has nothing to do with bandwith, but with how much space the scripts occupy. But usually it's not the scripts that occupy a lot of space. It's the DB, and files (images, music, that kind of stuff).

Bandwith also isn't consumed so much by the HTML code (a result from the PHP script) the server sends to the client, but by the size and quantity of the images present in the page, and by the size and quantity of the files your users can download.
 

sclewin

New Member
Messages
88
Reaction score
0
Points
0
Compressing PHP or not has nothing to do with bandwidth, but with how much space the scripts occupy. But usually it's not the scripts that occupy a lot of space. It's the DB, and files (images, music, that kind of stuff).

Okay, I'm not worried about space. I'm not going to have any videos or music on the site and only enough pictures to make the site look good, but not too many. The amount of space x10 gives is overkill for what I want :).

I'm just worried about too much MySQL DB activity. For instance, I am going to need a page that displays all the players in the game and some public statistics about those players. The only way I can think about doing this is having a loop that goes through the list of players and take the information. The big problem with that is that there will be one Query per player every time someone enters that page. So, if I have 100 players that would be 100 Queries every time that page is loaded. That sounds like a lot of traffic to me, but I don't know for sure as it is all only text.

Your friend,
Scott
 

flinx

New Member
Messages
68
Reaction score
0
Points
0
Don't know about the max DB load or max queries per minute or whatever.
But if you want to show info about all users you only need 1 query, that returns a result set with multiple rows (1 for each user). Your loop will go through the result set.

Read the PHP manual for more info
 

sclewin

New Member
Messages
88
Reaction score
0
Points
0
Don't know about the max DB load or max queries per minute or whatever.
But if you want to show info about all users you only need 1 query, that returns a result set with multiple rows (1 for each user). Your loop will go through the result set.

I see, stupid me :). I was thinking a was doing a query when I was using mysqli_fetch_array. I'm learning :)

Thank you for your help, I made sure to give you some reputation.
 

mattura

Member
Messages
570
Reaction score
2
Points
18
I would warn that you are letting yourself in for a LOT of work, even for a simple game!
I tried this a while ago, a very simple pirate/sailing game, with stats in database, fighting various sea creatures, collecting gold and upgrading your ship.
It took me a week (at home) just to program the registration, log in and security php (plus a mini dice game that saves the position of the player's counter in the db). And now I have that bit working, I'm not so motivated to write the actual game, so it exists as I left it. You can fight a hell of a lot of jellyfish and seahorses, but you never improve your stats!!
Some day I might carry on!

Edit:
I too was worried about database traffic, but it seems to be fine (although it hasn't been tested with lots of players at once). However it seems to need more than 1 query per person, depending on where they are in the game. Don't tell me I can do it with just one, I have spent a lot of time thinking about it and I believe in my situation, I have done the best thing.
 
Last edited:

sclewin

New Member
Messages
88
Reaction score
0
Points
0
I would warn that you are letting yourself in for a LOT of work, even for a simple game!

Thank you for the warning :). I have put together and run several PBEM games in the past, so I have gone through similar work before. What I have learned is to start extreamly simple and then add a little at a time. This helps you get overworked slower and if I do becomes boared of the project I will have a complete game; it just won't have all the features I originally planned on.

You can fight a hell of a lot of jellyfish and seahorses, but you never improve your stats!!
Some day I might carry on!
Hopefully you will some day.


However it seems to need more than 1 query per person, depending on where they are in the game. Don't tell me I can do it with just one, I have spent a lot of time thinking about it and I believe in my situation, I have done the best thing.

I'm pretty sure he meant you only needed one query to display a list of players, not to run the game. I know I will need a query for every action the player takes as I will check the players login/password.
 

mattura

Member
Messages
570
Reaction score
2
Points
18
Well for the user database, you might consider using some (or all) of the following fields:
id
username
password (md5 hash thereof)
email (you can verify the account)
dob (you can check they are >13 or >18, whatever)
blurb (some profile text they can edit themselves)
joined (timestamp)
banned (boolean)
loggedin (bool)
logins (number of logins)
lastsixlogins (timestamps, to sus out any odd behaviour)
ip (from which the user registered, so you can ban multis)
rights (if you want moderators,admins etc)
lastaction (timestamp, so you can have a cronjob log them out)

You probably won't need all of those!

Well, you can have a look if you like:
http://www.pepperandsalt.co.uk/matt/
I wouldn't advise sailing anywhere though, it's very frustrating!
Just check out the island, and the tavern game, and click on your username. Basically no 'game' functions are there, just the registration/login/sessions etc. I don't make any promises!
 

sclewin

New Member
Messages
88
Reaction score
0
Points
0
Well for the user database, you might consider using some (or all) of the following fields:...
Okay, thanks for the advice. I checked out your game, I can tell you put a considerable amount of work into it.
 

mattura

Member
Messages
570
Reaction score
2
Points
18
Thanks!
If I didn't have so many other projects on, I'd continue. Maybe when I have a quiet moment...
 

mattura

Member
Messages
570
Reaction score
2
Points
18
Thanks!
Whoops, looks like I made some style edits and didn't check them. Thanks for pointing that out, it's fixed now.
 
Top