Sign in to follow this  

Warcraft 3 Map Format and Drawing

This topic is 4819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone have any insights into the WC3 map format? I'm working on a 3D tile-based terrain engine with WC3 as my inspiration. However, I can't quite figure out the format of the map files. There's basically three different tile types that I see: standard flat (or slightly hilly) terrain, ramps, and the cliffs. It's the cliffs that are giving me problems, as after playing around with the world editor for a while it became apparent that the cliffs are not just static geometry. Each cliff tile has the same number of vertices and triangles, but the exact location of each vertex is random for that tile. So a long line of straight cliff won't repeat exactly as the vertices that make up the rock wall are never in exactly the same place. The shape of the cliff can also change based on the height of the ground that borders the cliff. So knowing this, I began to ponder how Blizzard stores the level geometry and how they draw it as fast as they do. OpenGL Profiler (a Mac OS X tool) shows that glDrawElements is used pretty much exclusively (which makes sense). Does the map editor generate the terrain and then just saves out the mesh for the game to use directly? I figure that some sort of quad/octree is used for visibility culling (as the game framerate drops substantially whenever the camera points at the horizon), so does the game generate just one vertex array every frame, or does it have multiple smaller static arrays and it just draws every one that has a portion in the current view? What's the best way to handle the texturing? I know how textures are assigned (each corner is given a texture which affects the four tiles that touch that corner), but I can't figure out how the multiple textures are handled for each tile. Each vertex in a vertex array can only have one set of UVs right? So are vertices duplicated in the array or do we go back to the multiple smaller arrays theory? So basically I'm at a near complete loss when it comes to texturing and a relative loss when it comes to storing and drawing the terrain mesh. As the first sentence asks, any insights? Thanks in advance (especially if you excuse any typographical errors that come from writing a long post at 6 AM in the morning).

Share this post


Link to post
Share on other sites
Re the texturing: With anything resembling a modern OpenGL implementation you should have multitexturing, which allows for multiple texture coordinates and "layers" per vertex. You can change the environment function for each texture unit to perform different effects, like having one layer multiply the layer beneath it, versus adding to it or replacing it or even using alpha values to "stack" layers.

Regarding the geometry, I have no idea how Blizzard does it, and most likely the format is proprietary so good luck getting any information on it. I was under the impression the terrain in WC3 was a "simple" heightmap concept but I have never looked at the actual data, nor have I played the game that much. I kinda lost interest way back during the beta, unfortunately.

I can't remember how smothly the camera pans but maybe it is a "static" vertex array in that the array itself is fixed in memory but the values are changed based on the map camera offset. Then the same pointer can be passed to OpenGL each frame but the data there will have changed. Of course this will prevent you from doing neato stuff like using ARB_VERTEX_BUFFER_OBJECT to keep the vertices on the server (even though it supports that you're still going to need to reupload data every time the camera moves) so maybe it's done another way.

I wish it was earlier then I would draw pictures with arrows and exclamation points to figure it out.

Share this post


Link to post
Share on other sites

This topic is 4819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this