Looking for OpenGL help

7
Birdemic #1415 0 23

I am working on a game engine (I know, I've take the road less traveled). I am using c to handle the game logic and simulation side and OpenGL to handle the rendering. I have a very textbook knowledge of OpenGL. So far, I have been able to render 2D sprites that can be textured. I have some questions about the overall place that OpenGL should take in the engine and was hoping that someone on here would know a thing or two about game engine architecture.


Here are some specific questions that I have about how and where to use OpenGL:


1. How many VOA's should I have? Should each sprite have its own? If so, how and when should I update the buffer bound to it? Should I keep that around or just update it when it needs to be? How do I render multiple VOA's with a single draw command? Is that possible?


2. With Buffer Data, when should I fill that up? Only on a change or every frame for every object that is being rendered? Should I do it right before a draw or later on?


3. Do you know any books that talk about how a rendering engine fits into a game engine? I feel like I have a million questions and most of them I don't even know how to frame...


Thats it for now. Any help anyone can offer is appreciated.

8
omNomios #1381 0 38

Hey Bird.

1. Don't optimise too early. You'll get so bogged down with the minutia that your engine will become rigid and had to work on... leading to an abandoned project. Start with each sprite having it's own VAO and then later, once you have a functioning engine have a look at how much CPU and bus time you're wasting shuffling the data to the GPU and then work on batching the buffers in a way that makes sense for your engine. The short answer is you should batch all the sprites into one buffer, but how they're batched and when will change on the application.

2. Same as point 1. Fill it up in a way that is easy to program. Worry about performance later when the engine is complete and won't change much.

3. No. I learnt through the school of hard knocks. I find books a bit distracting as they teach you things you don't really need to know sometimes.

4. It only makes sense to write your own engine when it does something that no other offering can or will. Have you considered a hybrid approach? Using an off the self engine for the mundane and then plugging in your own DLLs to do the special stuff?

7
Birdemic #1415 0 23

Thank you for the reply. I have had a functioning rendering system for sprites for a long time now, I am working to extend it the render 3D models and have gotten into OpenGL land a bit. I think your advice to just move forward with what works is good advice. I was more of just wonder what some other options are, not just looking for base functionality.

I opted to skip out of school. This engine represents my education. It's a great way to learn to program, and I have a lot of fun working on it. My overall plan right now is to try my hand at the indie thing, but if that fails I want to become an engine programmer with a bigger company. I have spent quite a bit of time in Unity, and decided that I just don't learn as much from working in that framework, it's also not an enjoyable for me to program in. I don't like all of the limitations that it offers, such as not really being able to leverage an object oriented design with inheritance. So, I guess to answer number 4, there are a lot of reasons that I have decided to go with my own engine. In my own mind the debate is over and I am just focusing on getting this done, hopefully in about 3 or 4 months. I have a lot of work done already and am just making this final push to get it ready to build a game in.

8
omNomios #1381 0 38

100%. Writing your own engine is a lot of fun if you're an engineer and the things it will teach you will serve you long into the future. If I hadn't spend many long nights as a teenager (you know, instead of going out and getting drunk with pretty girls) messing with DirectX immediate mode (showing my age) and putting together silly particle engines I wouldn't be where I am today.

You're right on the limitation of Unity. It's great if you want to just make a game, fast. It abstracts too much and does a too much behind the scenes to teach you much about the technology.

Unique experiences like Factorio and Space Engineers wouldn't exist if they just picked up Unity or UE4 and 'made a game'. The loud cry of "don't build your own engine!" you'll see on the net is a little exaggerated. Yes, it's hard and time consuming but if it's for self education or to make a unique experience then it's one of the few options you've got.

Best of luck with the engine, I'm keen to see what you come up with.

7
Birdemic #1415 0 23

Thanks for the encouragement! I'll post updates on what I made on this site. I found this site only recently, during the Pro Indie Dev conference earlier this year. Tim spoke at it and talked about his site, obviously. So far its been a really good site.

Showing 1 - 5 of 5