Massively Multiplayer
Seamless Open-World
Real Time Strategy

Twitter   Facebook   Google+   YouTube   E-Mail   RSS
The One Man MMO Project: Trailer Mega-Map
By Robert Basler on 2015-11-02 19:12:40
Homepage: email:one at onemanmmo dot com

Something I discovered people are quite floored by when I demo Miranda is when I zoom out from my base, then it switches to map view and then just keeps zooming out. While I don't yet have the full 300x300KM map, even my 20x20KM test map gives a pretty good sense of how big the environment is. So that needs to be in the trailer. The map has been working for a long time, but when I took a close look at it this week, I found a few little things that needed to be addressed.

The most worrying thing I discovered was that map rendering performance was pretty terrible. The map is rendered entirely by the CPU so I was not completely shocked that it wasn't super fast, but seeing 5FPS when fully zoomed out was pretty sobering. I did a quick breakdown of the map rendering to see how much effort would be required to have the GPU do all the map compositing. I figured that would take a week, easy. I can't really afford that so I applied the game's profiler to the map rendering code to see if there were any easy wins. I was quite shocked to find that compositing the map wasn't actually what was taking all the time. Redoing the map rendering to be all hardware-based would not have improved performance much at all.

It turns out that 171.34ms was being spent every frame checking if map tiles (the areas the player can capture) were loaded by the terrain system. That was something that should have been instantaneous! Looking a little closer, the problem was obvious: looking up a terrain block takes a bit of time due to the size of the world. To speed up that lookup there is a cache in front of the terrain loader. Because the map accesses every terrain block every frame, it caused the cache to thrash and also paid the price of full-cost terrain block lookups. I added a cache to the map rendering that saves the lookup results in a big array, which cost 3MB of RAM, but brought the per-frame time to under 1ms - the map was back to rendering at 60FPS.

Next under the microscope was the speed, smoothness and style of map zooming. With the frame-rate cap removed, the zoom was suddenly very fast - the speed was based on update rate, not time. I spent an entire evening fiddling with map zooming, trying different speeds, modifying it to use float zoom values rather than integers (which were suddenly too jerky with the new silky-smooth frame rates.)

I also spent an afternoon just experimenting with different methods of positioning the map when zooming out. I settled on trying to keep the camera in the centre of the screen unless the user manually moves the map. I haven't mentioned before that you can now drag the map to move it around - an improvement over the old system where trying to drag the map caused the game to go into slow-motion.

This morning I added my first faux-feature. When the game is done it will have a shroud like Command & Conquer which hides unexplored areas of the map, but I haven't actually implemented that yet. I attended a talk by the Darkest Dungeon developers at the Full Indie Summit this weekend where they talked about how after people had been playing the game, they added some features they had always planned to have in the game, and how badly players reacted. Lesson learned, I GIMPed a shroud onto the map for use in the trailer so people won't be surprised and upset when it appears in-game.

The only real feature I added this week is a new loading screen that appears whenever you move a long distance by double-clicking on the map or pressing H to go home. It hides the second or so of unattractive partially-loaded terrain, sky and units you used to see. In the game the text is animated and you won't usually get to read the whole thing, and since I'm not saving this for the trailer, here it is in its entirety.

Super-Exciting New Loading Screen

I also fixed a minor bug that had a surprisingly large effect on the UI. When I loaded a new UI screen, I neglected to invalidate the bitmap that the UI renders into so that the video card would know it had changed. This resulted in UI screens appearing over a few frames, or sometimes lingering longer onscreen than I would have liked them to. I always thought that was just how Berkelium worked. It turns out no, that's not the case. Screen transitions are now super-crisp and I have a few little screen transition bugs to fix.

New Comment

Cookie Warning

We were unable to retrieve our session cookie from your web browser. If pressing F5 once to reload this page does not get rid of this message, please read this to learn more.

You will not be able to post until you resolve this problem.

Comment (You can use HTML, but please double-check web link URLs and HTML tags!)
Your Name
Homepage (optional, don't include http://)
Email (optional, but automatically spam protected so please do)
Type boy. (What's this?)

Admin Log In

[The Imperial Realm :: Miranda] [Blog] [Gallery] [About]
Terms Of Use & Privacy Policy