   How many tiles was ultima online? How big was it?
  Anyone know how many tiles a single shard had in ultima online?One more question, how should my game world be represented at the server level? I am making a tile based game and I was using a 2 dimensional array to store data for each x,y tile. If I make the 2 dimensional array too big I run into problems.Luzarius   
Quote:Original post by luzariusIf I make the 2 dimensional array too big I run into problems.Don't try to hold your whole map in an array.   ;Quote:Original post by FrunyQuote:Original post by luzariusIf I make the 2 dimensional array too big I run into problems.Don't try to hold your whole map in an array.Can you recommend me another technique or point to an article that discusses this?   ;  Do not create large arrays on the stack: use dynamic allocation or a std::vector. Chop your map down in smaller chunks which can be loaded and unloaded as appropriate: it'll keep memory usage down. Take a course on data structures. Do not bother with two dimensional arrays: learn to fake it: arr[row][col] → arr[row*row_size+col]   ;Quote:Original post by FrunyDo not create large arrays on the stack: use dynamic allocation or a std::vector. Chop your map down in smaller chunks which can be loaded and unloaded as appropriate: it'll keep memory usage down. Take a course on data structures. Do not bother with two dimensional arrays: learn to fake it: arr[row][col] → arr[row*row_size+col]Thanks man that sounds good.   ;  Also - use several small maps that can be loaded / unloaded as required, rather than trying to keep the whole world in RAM at any one time. Keeping everything loaded only really has an advantage if the whole world has players constantly passing through it (where loading in and out can actually cause problems, unless you use a caching system) In practice, it's more likely that your players will congregate in hotspots (around monster spawns etc). Use this to your advantage and read up on texture management - this is actually pretty close to what you need to do with area maps.;Quote:Original post by FrunyDo not bother with two dimensional arrays: learn to fake it: arr[row][col] → arr[row*row_size+col]*cough* arr[row*col_size+col] *cough* [wink]   ;  no way on earth did ultima online use static tile allocation, and I'd bet money that the server side of things didn't even keep a listing of tiles at all, but instead a sort of optimized version of the data, meant to reduce space.  Let the player figure out that they are standing on grass, the server doesn't give any concern to it.  The server only needs to know when the player has attempted to cross a boundry they were'd supposed to, and where actual moving/movable objects are in relation to eachother.  The player can have all the bloat they need to, but you should still only load the map in chunks as was already mentioned.Personally, last way i did it was to have my map files with an offset list in the start of the file, which specified the starting point and the size of the given map blocks [blocks that were coordinate chunks X by Y in size, or in my case, 32 tiles by 32 tiles in size, which i suppose wold be X by X].  When the player moved sufficiently far away from a block, it was deleted [no reason to keep coordinate 0,0 when the player is over at 198,392], and the new block was loaded up [in my case, using the exact same memory].   ;Quote:Original post by Evil SteveQuote:Original post by FrunyDo not bother with two dimensional arrays: learn to fake it: arr[row][col] → arr[row*row_size+col]*cough* arr[row*col_size+col] *cough* [wink]*cough* *cough* *splurge* When I read row_size I interpret it as row length not number of rows and when I read col_size I think column height (length) not number or columns. Therefore *choke* *choke* I'd stick with Fruny's arr[row*row_size+col]   ;Quote:Original post by xstreme2000*cough* *cough* *splurge* When I read row_size I interpret it as row length not number of rows and when I read col_size I think column height (length) not number or columns. Therefore *choke* *choke* I'd stick with Fruny's arr[row*row_size+col]Ah, that's true. That's one reason I always refer to the number of rows or columns.Sorry for derailing the thread...   