Page 2 of 2

Re: Entire game in one page?

Posted: Mon Jan 18, 2010 5:09 pm
by Jackolantern
Chris wrote:If you are planning to make a game that will actually do well, where a page will be loaded atleast 5000 times a day. Now calcualate how much bandwidth will be eaten when including two scripts that are only 4kb or constantly loading a file which is 50-60kb.
Bandwidth has nothing to do with it. PHP is server-side, so the scripts are not transferred over the internet.

EDIT: Also, I don't think the whole game should be one page. If you have pages which are radically different, say, a shop screen vs. a field map screen, it should probably be different pages. If you did it this way, you would likely have huge switch statements, or other nested conditionals, which, if hit thousands of times a day, would begin to have some unnecessary performance issues.

Re: Entire game in one page?

Posted: Mon Jan 18, 2010 5:38 pm
by Chris
Maybe if I rephrased that to CPU ussage it would make more sense.

Re: Entire game in one page?

Posted: Mon Jan 18, 2010 5:44 pm
by hallsofvallhalla
i agree to all that was said, it can effect cpu usage and no you should not make it one entire page. break it up some.

Re: Entire game in one page?

Posted: Mon Jan 18, 2010 10:13 pm
by Jackolantern
What I was trying to clear up in the edit of the my last post is that if there is no difference between two pages except for what it is pulling from the database, it should be one page. For example, if you have a MUD-like game, it would make sense to have all areas of the map be on the same page and just use a coordinate system to pull the correct values out of the database. However, shops, inventory screens, and other non-map screens really have no benefit from being on the same page that I can think of.

Re: Entire game in one page?

Posted: Mon Jan 18, 2010 10:23 pm
by hallsofvallhalla
well they dont mean printed on one page, simply that the code is there.

Lets say I want to go to a shop, I reload the page but send a post variable shop=1

then on index I have a if(issset$_POST[shop]){do shop code; bypass =1;}

if bypass = 1 then by pass all map code and other stuff. This way all code is located on the same page but only what you are using is displayed

Re: Entire game in one page?

Posted: Mon Jan 18, 2010 10:43 pm
by Jackolantern
Yes, that is what I meant :) Why I was saying maybe it isn't a good idea to add shops, inventory screens, etc. onto the same page as the map is that it would incur unnecessary branching statements. You would basically have many different webpages nested inside ifs and switches in the same script. While it is true that a conditional branching statement is a drop in the bucket of CPU power, they shouldn't be necessary. However, it makes a lot of sense to have different map rooms on the same page of code.

Re: Entire game in one page?

Posted: Wed Jan 20, 2010 9:10 am
by MAruz
ZeroComp wrote:I really dislike ogame a lot. I hate just the overall playing style :evil:
I'm starting to agree, though I haven't seen much game play yet. Only building resources... It does the tutorial part pretty well, introducing players to the game concepts, but the actual game itself hasn't offered me much yet. Several days into the game, trying to build up resources so I can actually start. Should have been able to start from where I'm at now to cut away the long, uninteresting buildup.

Anyway, I'll continue with separated page loads for different content :P It's interesting to see how others do their games too. And I noticed that ogame uses allot of javascript. I'll probably cut down on javascript, and do more in php...