Entire game in one page?

C++, C#, Java, PHP, ect...
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Entire game in one page?

Post 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.
The indelible lord of tl;dr
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: Entire game in one page?

Post by Chris »

Maybe if I rephrased that to CPU ussage it would make more sense.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Entire game in one page?

Post 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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Entire game in one page?

Post 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.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Entire game in one page?

Post 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
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Entire game in one page?

Post 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.
The indelible lord of tl;dr
User avatar
MAruz
Posts: 117
Joined: Fri Nov 20, 2009 12:31 pm

Re: Entire game in one page?

Post 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...
PHP, Java, JavaScript, HTML, CSS, XML, MySQL / Oracle
Photoshop, Illustrator
www.cuddly-zombie.com
Post Reply

Return to “Coding”