Twitter  YouTube  E-Mail  RSS
The One Man MMO Project
The story of a lone developer's quest to build an online world :: MMO programming, design, and industry commentary
By Robert Basler on 2018-04-12 23:45:12
Homepage: email:one at onemanmmo dot com

I was going to tweet this, but it turned out a bit long.


Programmers like the sizes of things to be powers of 2 (1,2,4,8,16,32,64,128,256...) The reason for this is that computers handle those sizes more efficiently than other sizes.

Miranda's terrain is a height map. Every 2.5 metres on a grid the game stores the height of the terrain. To render the terrain, the game draws rectangles (actually two triangles) between those points. There are lots and lots of points, so to make things manageable, the terrain is split into blocks. When I built the terrain, I decided terrain blocks should be 64 height samples across. My programmer brain was happy with that. The thing though, is that means that each terrain block is actually 63 squares across (because it needs heights on both sides to draw a piece of the terrain) or 157.5 metres.

This weird number has been a nuisance ever since. Just one example is the flowers. Flowers are placed on a one metre grid. (They are randomly shifted so you can't see they're on a grid, but they are nonetheless.) The problem was that there was a visible half metre strip at the sides of each terrain block where flowers didn't cover. So flower coordinates had to be multiplied by 157.5 / 157.0 to get rid of the gap.

This week I finally increased the block size to 65 (64 squares across) or 160 metres and it was astonishingly almost as simple as changing a single number.

The two differences players will notice is that map squares are now 320 metres instead of 315, and that the weird flat spots on the east and south sides of the map are gone.

The funny thing was, about 2 weeks after I settled on 64 as the size of the blocks, I realized that I needed one extra sample around all 4 edges in order to calculate the terrain normals so the blocks have actually always been 66 samples across.

New Comment

Cookie Warning

We were unable to retrieve our 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)
Multiply: 2 and 6 = (What's this?)

  Admin Log In

[Home] [Blog] [Video] [Shop] [Press Kit] [About]
Terms Of Use & Privacy Policy