Sign in to follow this  

How would I go about making my own map format.

This topic is 4034 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

Hey guys, I have been using C++ and DirectX for a while now and have decided to create a proper game. The first thing that came into my head was "Levels... hmm how am I going to do that?". My first idea was to start off with a simple struct holding 4 vectors: 3 points of a polygon and a normal vector of the polygon. I made a simple function which calculated the normal vector from the 3 points. Once this struct was made I could make an array of this struct holding a big list of polygons and then save them to a file, which I could then load again and render with simple vertex lighting. Ok, so... that was all going fine. Now I have come to textures. I know how textures work, I just have no idea how to create a system to manage them and work out the correct texture coordinates for the polygons. Any ideas guys? The thing I find suprising that no one talks about this stuff. Surely a good file format holding all the information of your game would be one of the biggest things you would need to know how to do?

Share this post


Link to post
Share on other sites
It's quite straightforward actually. Let's see, each polygon has a texture applied to it and for each of this polygons vertices, it holds uv coordinates. So, you'll have to change that polygon struct of yours a bit so you can store which texture to use, and what uv coordinates it has for each vertex.

Do some research into existing model and level file formats. I'm sure you'll get some idea's that can be usefull to you. Perhaps it's much easier to go with an existing model format. Or you could write a converter that takes a model format and changes it to a level file. Good tools are at least as important as good file formats.

Share this post


Link to post
Share on other sites
Thanks for the reply!

I have got everything sorted out and the uv coordinates are ready to be inserted. The only problem is I don't know what uv values to assign to each point. Say I had two triangles which I wanted to put together to make a quad, how would I calculate the uv coordinates so they assigned the correct values to each point? It's the only bit I am confused about now, its easy putting them in by hand, but you don't want to be doing that for every single poly in your map. Is the uv coordinate of each vector basicly the vector but normalized?

Share this post


Link to post
Share on other sites
Heh, no, not quite so. :)

Usually, a level-designer applies textures to the walls and objects in a level. I assume you've got no experience with level-design of any sort, and you're probably looking at it from a programmers point of view, so I strongly suggest taking a look at some level editors. For example, UnrealEd for Unreal or Hammer for Half-Life. Since I don't know what sort of levels you're looking for and hence, not what kind of tools you want/need, I can't give too much of a pointer here, but UV coordinates are assigned by the artists, not calculated (unless you're planning to generate your levels). Of course, they're not typed by hand either, that's what level-editors are for, to ease the creative process. :)

Share this post


Link to post
Share on other sites

This topic is 4034 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