Praxiiz
Sorceror
Just thought I'd give a status update. I spent a lot of time trying to get the client to reliably memory map new maps into its address space. While I was moderately successful in my attempts, it wasn't where I wanted it to be in terms of reliability and stability. After many loads and switches of maps, the client memory space would eventually fragment and the client/razor would crash because of it. At that point, I realized that even if I did get it stable, once EA released another expansion or map, I would be fighting the address space again.
So I decided that a new paradigm was needed. If I couldn't reliably unload and reload big maps and their statics into the memory space over and over again, the only option was to map memory space once (which is normally how memory mapped files are handled) and then swap data out by reading it from disk and writing it to memory. The problem with this is that the client would spend a lot of time reading from a map and writing it to disk. Map0.mul and map1.mul are almost 90 MB each, and if a player swapped maps frequently, it would cause delays especially on slow systems. They would not only have to load the map files, but the statics too.
The solution that I came up with is to load a 1032 x 1032 section of the map at one time. This keeps the amount of data being read from the hard drive down to under 5 mb per map#.mul file, which I think is okay. When a player gets close to the edge of the 1032 x 1032 section, the client loads a new 1032 x 1032 region into memory centered around the player. The result is that the player will have to move close to 500 tiles on a map before it loads a region. Tiles already loaded will be cached of course, which means that the client will have to read even less data from disk. If a player changes maps frequently, the loading delay will be quite small.
Now this only affects additional maps of course. The regular EA maps will remain in memory and will work like they always have.
The other piece of good news is that since I'm not trying to load an entire map at once into the memory space, (in fact now I'm only loading close to 20 megs total), the maximum map sizes should increase to 32k x 32k. It will, however, put a restriction on the minimum map size, at least for now. The minimum map size will be 1032 x 1032.
The biggest trade off will be in terms of the development of the system. Now instead of just loading an auxiliary map and letting the client operate normally, I will have to use razor to catch each packet and translate any map coordinates into coordinates relative to the clients view of the map.
So far, switching to additional maps seems to be stable. I still need to develop some of the packet algorithms (razor takes care of most of this for me). Once I finish those, I should be able to do another release.
So I decided that a new paradigm was needed. If I couldn't reliably unload and reload big maps and their statics into the memory space over and over again, the only option was to map memory space once (which is normally how memory mapped files are handled) and then swap data out by reading it from disk and writing it to memory. The problem with this is that the client would spend a lot of time reading from a map and writing it to disk. Map0.mul and map1.mul are almost 90 MB each, and if a player swapped maps frequently, it would cause delays especially on slow systems. They would not only have to load the map files, but the statics too.
The solution that I came up with is to load a 1032 x 1032 section of the map at one time. This keeps the amount of data being read from the hard drive down to under 5 mb per map#.mul file, which I think is okay. When a player gets close to the edge of the 1032 x 1032 section, the client loads a new 1032 x 1032 region into memory centered around the player. The result is that the player will have to move close to 500 tiles on a map before it loads a region. Tiles already loaded will be cached of course, which means that the client will have to read even less data from disk. If a player changes maps frequently, the loading delay will be quite small.
Now this only affects additional maps of course. The regular EA maps will remain in memory and will work like they always have.
The other piece of good news is that since I'm not trying to load an entire map at once into the memory space, (in fact now I'm only loading close to 20 megs total), the maximum map sizes should increase to 32k x 32k. It will, however, put a restriction on the minimum map size, at least for now. The minimum map size will be 1032 x 1032.
The biggest trade off will be in terms of the development of the system. Now instead of just loading an auxiliary map and letting the client operate normally, I will have to use razor to catch each packet and translate any map coordinates into coordinates relative to the clients view of the map.
So far, switching to additional maps seems to be stable. I still need to develop some of the packet algorithms (razor takes care of most of this for me). Once I finish those, I should be able to do another release.