Level Loading

Started by
10 comments, last by hexman 20 years, 11 months ago
After creating a level using Maya, Studio Max, or some type of program to make a level, how do I go about writing a piece of code that displays that level (or world) on the screen? If someone could point me in the direction of an article or wesite that shows how to do this, that''d be great. Thank you. Hexman
Advertisement
Its a little more complicated than just putting it on the screen. Have you worked with DirectX/OpenGL ?

If not, you prolly want to grab and SDK (Software Development Kit ) on which ever one you would like to.


NeFrUgLe
-- NeFrUgLe
Not to be rude or anything why don’t ppl give a straight answer to a question. Like to tell him were he can find info on were you can load maps. I mean if some one asked how to make a simple windows program and load a map nobody seams to know the answer or were some else can get the answer. What gives? Just asking not trying to be mean or anything.
quote:Original post by kingpinzs
Not to be rude or anything why don’t ppl give a straight answer to a question. Like to tell him were he can find info on were you can load maps. I mean if some one asked how to make a simple windows program and load a map nobody seams to know the answer or were some else can get the answer. What gives? Just asking not trying to be mean or anything.

umm, you need to know how to draw stuff on the screen before you can load a level and *draw it on the screen*.
Kingpin, the reason that he didn''t get a straight answeris most likely because of how he presented his question. If he would have said that he had setup Direct3d/OpenGL and could draw polygons/textured quads etc and that now now he wanted to display a whole level, it would have been an entirely different post.

We would have understood his ability. From what he posted we have no way of gauging it. And from his terminology of "a piece of code" for simply drawing a level to the screen, it would seem he has not done alot with 3D programing in general and thus is not ready to "draw his level to the screen."

We could be wrong in this assumption, but given the content of his post and the fact this on the beginners board makes us think he needs to know the basics, not just point him to a tutorial with a bunch of code for him to copy and paste. If he wanted that he could find it on his own by searching google, or looking around on gamedev/gamesutra/gameturoials/etc.

I generally feel people post on message boards when they want people with expierience to give them some guidance. Not just to copy and paste code. This could be another bad assumption of course.
I just want to konw if you load a file that conatins the level or you load a bunch of images. I know How to put a single image on the screnn but not a bunch of immages on the screen. it would be easer if it was 2d. I made a game in visual basic .All I had to do was do the direc x stuff then not worry about that and just put images backgrounds ect to the screen then move it around. I never got a level editor/map editor/ or something of the like to work becuase I can''t think of a way to make every thing usable if it is 1 big image and not a millon small images put togther some how or other.

so could you point me in the right derction on that.
thanks for your understanding. It just gets frustrating once in a while
I think that all of your opinions are equally valid. Yet I know how frustrating it can be to have to teach yourself from scratch how to do game programming (believe me you take whatever help you can get).

loading a level from Maya or any other 3d animation program on to any graphics API (application programming interface) such as OpenGL or Direct3D is accomplished with (blood,sweat,tears) and the use of some kind of file type. You could create your own file type (of course if you know how to do that you wouldn''t be asking this question would you) or you can use those from other developers.

Check out the tutorials section of www.gametutorials.com and work your way up. The final tutorials examine how to use Quake 3 .bsp files.
just bear in mind that following is raw unedited text with few typos...

If loading a level was just in a "piece of code", each one of us would have done at least 10 games. You can`t just load whole level and push it through pipeline to render it. You have to deal with dispalying only the necessary stuff that is visible to player, i.e. if you`re looking at one wall in front of you and can`t see anything else, you can`t simply transform and render whole level consisting of millions of polygons. That`s ineffective.

What I`d recommend is that you start more simple. Start loading simple objects from 3dsmax (write a simple ASE parser - search the web for it) and then placing them in your world and saving a yur own data file with the objectr type/position in your world (simple level editor built into your engine). That way you can start building levels from building blocks and later use that information for rendering of the visible parts.

Actually, today it`s a bit harder than that, since today`s and yesterday`s card are good at pushing thousands of polygons and especially they`re effective in rendering huge batches of polygons, so you need to check whether you should spend some time in your code deciding what to draw, or just to push whole bunch of triangles that are ready to be rendered on screen. But that`s somethin that you have to measure yourself.

Then there is issue of texture switching - i.e. setting every used texture in scene just once and rendering whatever is visible with that texture. After that comes state changes sorting, and so on, and so on.

Of course let`s not forget frustum culling and LOD methods - all of this needs to be measured by yourself whether it`s better to just draw it, or spend time calculating lower detail levels, or switching index/vertex buffers. Naturally you`re better off here if you have decent knowledge of 3d geometry. You should tell by heart how to calculate the distance between two points in 3d space, how to extract view frustum planes from your world/view matrix. As for LOD methods, after few hours of web searching you`ll be left with so many methods to try that this alone shall kepp you busy for weeks.

After this you need to take care of how many textures can you blend at once - so you need to split your rendering code into few rendering paths regarding whether one hardware is capable of multitexturing of just 2 texturs, other can do 8 textures at once.

Oh, and all of this has to be done in cooperation with your collision detection code so that you don`t need to tear your hair.

Yes, I know I just scratched the surface of all this and didn`t mention many other important issues (what data structure shall i use ? Will octree serve me better or is quadtree enough ? Or should I go with BSP since it worked well for quake ?), but that`s just to illustrate the most basic issues that you`ll face when "loading the whole level"

You _can_ literally load whole level but please don`t flood these forums with questions that your fps is <0.

EDIT : I forgot the most important issue VERY relevant to this subject: How to actually laod the data fastest ? How should your data be organized and preprocessed so that you don`t need to seek back in any file and just take use of the cache so that level loading times are down to 10 seconds from 50 seconds ? That is a separate issue well worth spending a month of tries just on it.

Avenger game project


[edited by - VladR on May 6, 2003 3:23:00 PM]

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

This site:

http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg4.htm

Has information on how to load 3ds, obj, md2, and md3 files. Max and Maya can both export objects into some or all of those formats.
So you are saying loading a level is what makes a game so once you get this acomplished then you can make any game you want.

step 1: make window
step 2: load direct x
step 3: What next? Load an iamge or what ?

This topic is closed to new replies.

Advertisement