Creating large world in openGL

Started by
4 comments, last by nhatkthanh1 8 years ago

Hello ,

I am moderate experienced programmer in OpenGL with well versed of programmable as well as fixed function pipeline.

I am creating new project which needs me to create huge world with scene of some part of city.

There should be buildings,cars,trees people walking and so on. In that city I want to simulate flying camera view.

I have following questions (Please pardon me if they sound naive)

1. I want to load multiple objects

I am currently using assetImp library for loading model.

for building I load on model and I do instancing for creating multiple objects and apply different texture to them.

But How can I reduce initial loading time?

2. How can I create FPS flying camera .

What I have thought is manually moving camera from path I want using key board and dump coordinated in file.

Use those as predefined path to move camera.

Still It would be great if another approach could be there with some pseudo code.

Thanks

Advertisement

I might derail the thread, so ignore my answer if it is not what you are looking for....

You are talking about creating a large world. Yet on the other hand you seem to struggle on some pretty low level stuff (no offense meant, really)...

On the other hand you seem to have a pretty concrete project in mind.

Thus my question: what is important to you, getting ahead with that project of yours, or learnong how to do these kind of things on your own, the low level way? Do you want to create a game, or do you want to learn how to low level plumb an engine so it could cope with a larger world?

In the first case, think about starting to use a game engine to get away from re-inventing the wheels here, and get into creating your game/world faster. While it is certainly a good learning exercise to be able to do everything yourself, it is extremly inefficient for any larger/more complex project (don't know how complex yours is, really).

That is why almost none of the big studios nowadays creates an new engine for a new game, and why most actually buy an engine to build their game upon.

Question one you have up there would be already solved by the engine for 99% of use cases... you might still have a special case (needing to load millions of objects fast, or something like that), but then you would still have a better chance to solve this problem in an existing engine (Either by issuing a feature request, or by modifying the engine code, if available).

The second question is also already solved in most engines as others have done this before. Most engines come actually with tools for creating cutscenes nowadays, which seems exactly what you want to do there.

If you are interested in a 3D Engine, I would recommend Unity 5 or Unreal Engine 4. IMO Unity is a little better for a beginner, and Unreal Engine gives you more options and power at the high end. Both have large communities and documentations, and are pretty up to date.

Of course, if you are trying to learn the low level plumbing, nothing beats the DIY approach. In this case, please disregard my comment.


But How can I reduce initial loading time?

with more efficient file formats and/or loading code. either third party or roll you own.

bottom line - if load times suck, your file formats and/or loading code sucks. or its just a really big game, and you might consider demand load paging of assets.


How can I create FPS flying camera .

its just like any other camera, but its off the ground. unless you want it to move like an aircraft (IE local rotations).

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php


1. I want to load multiple objects
I am currently using assetImp library for loading model.
for building I load on model and I do instancing for creating multiple objects and apply different texture to them.
But How can I reduce initial loading time?

Assimp was never intended for real time use. It's a tool to load other file formats, and then convert them into your own. Most of the formats you try to read from are designed as exchange formats. Which means that they are very verbose and have a lot of useless metadata in it.

You'll most likely end up building your own binary format in which your engine will have absolutely no problem in reading. Be sure to choose your endianess however... I personally use big endians are just 64bit.

Also packing your files into one big blob will help out too. It helps if the hard disk has to seek less.


2. How can I create FPS flying camera .
What I have thought is manually moving camera from path I want using key board and dump coordinated in file.
Use those as predefined path to move camera.
Still It would be great if another approach could be there with some pseudo code.


You'll want to look up algorithms for curves, and "Look at". What you're basically doing is providing the camera a very basic steering behavior that will follow a curve through space. The curve implementation is up to you.


How can I create FPS flying camera .

so you want canned animation flyby motion for the camera? not player controlled?

use code to make it move along the desired path. it can be a straight line (easy), or curves as Tangletail says (somewhat more work), or whatever you want. or a combo thereof.

lookat() type functions can be used to aim the camera at a particular location reguardless of the camera's location. or you can keep the orientation fixed, and just watch the scene roll by, or stop the camera and change orientation to look around, then start moving again. with canned animations, the possible camera angles and moves are endless, just like filming a movie.

when it comes to camera location, orientation, and motion, look to the techniques of the masters like Kubrick for best results.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

1. You can optimize the format and loading code as suggested, you can implement some sort of LOD and partition your world up and load "active" portion as needed and unload those that you no longer need. This will give also reduce some memory usage.

2. Not sure if I understand what you want to do, but if I interpret it right, then one way is to have a spline. Lay out your spline path and have the camera follow that, you can deviate from the spline somewhat with input if you want, like an on rails shooter.

This topic is closed to new replies.

Advertisement