hello all, I'm trying to create a game and basically i have like items, monsters, equipments etc etc and their info is stored in a database. like HP 10 Attack 10 and so on. however this values will hardly be modified.
and everytime i will need to retrieve these info, i had to run mysql queries. is it really much faster if i could embed all the info as a giant array into all of my pages and subsequently jus call out to that array?
will there be a lot of overhead in embedding such arrays (around 10k) into every single page even while the page may not be using them.
A DBMS is designed to manipulate large amounts of data as efficiently as possible. For some arbitrarily small amount of data it might be faster to deal with an array within your code instead, but as the amount of data increases and the complexity of the data relationships increase, a database will likely end up being more efficient.
For cases where the data will be fairly static, consider using a database but looking into the various caching techniques out there that can be used for common queries.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
You'll need the data to be stored on disk, I assume. So, a memory engine will not suffice. However, many DBMS's have query-caching options, wherein the results of a query will be cached in memory so long as the engine can safely assume that the rows behind the query have not changed.
Regardless of where you end up storing the information, you might find it a good idea to use application level caching. For instance, if you're using PHP and APC, you can load a data structure from source X and cache it in memory, reloading it from disk based on any algorithm you like.