Page 1 of 1

Game locations and interaction.

Posted: Sat Jul 30, 2011 9:11 pm
by Ravinos
I want to pose a question from a design standpoint. Would it be better to have one massive script that Morphs to the information in the database or make each location it's own script? I'm asking this because as I try to add more and more advanced features to my game the script is getting bigger and bigger. Right now it's sitting around 90kb. I've recently started breaking down the script into more specialized files for each location. These files are included whenever you begin combat. These files range from 10kb to 20kb in size but there are 15 of them right now.

The plus side to breaking them down is that I can now make very specific changes to each location in regards to special features and events for each zone.

What do you guys think? Is there a better way to go about this?

Re: Game locations and interaction.

Posted: Sat Jul 30, 2011 10:56 pm
by Xaleph
Size does not matter on the server. Unless you are trying to load in >2mb every page request. ( your server will die, soon) Other then that, it`s all cool. Mostly because the file be cached soon. But its always a good idea to seperate code in to seperate files. Its better for maintaining and organising.

Re: Game locations and interaction.

Posted: Sun Jul 31, 2011 2:45 am
by Callan S.
I think if you can find similarities in various areas, you should look at how you might standardise those bits of code. If only for your own future sanity.

But for nuances and quirks of various areas, having their own code, it probably makes the game more unique and likeable! A bit of off standard is fun!

Re: Game locations and interaction.

Posted: Sun Jul 31, 2011 3:34 am
by hallsofvallhalla
Functions and classes!

Heheh i too worry about the same thing. Sometimes my ideas are bigger than the page and I worry if it is too much. Guess testing is the best way to get your answer.

Re: Game locations and interaction.

Posted: Tue Aug 02, 2011 12:15 am
by SpiritWebb
I personally would go with each location a new one...just imo

Re: Game locations and interaction.

Posted: Tue Aug 02, 2011 12:51 am
by Nexus
the way our game handles locations is a bit of both really...the index grabs the description of the location and we post it and we have if( ) statements for each location the player could be at with an include_once( ) function including say you have a location name Forest, we have a unique locations sidebar with each place you could go in to in the overall huge location and we name that sidebar forest.php. simple really but thats how we roll :)