Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Feb 2012
Offline Last Active Today, 07:25 AM

#5315909 c++, passing std::container without template

Posted by on 20 October 2016 - 01:33 AM

They are not polymorphic, so no.


For sure, they even are not (complete) types.


So if you know which container to use, one solution would be something like this:


template <class T>
void func(std::vector<T>& vec)
void another_func()
   std::vector<int> vec1;
   std::vector<double> vec2;

#5315784 Alternative book(s) to Introduction to Game Development

Posted by on 19 October 2016 - 02:23 AM

2009 is not that late. Of courses things changed: PBR is now common, so artists will tend to move to a more scientific way to work. Graphic cards can display a bit more triangles, and graphic developer can now use more high-end technologies.

But since that date, the game development should not have changed that much.

#5315679 An alternative to "namespaces"

Posted by on 18 October 2016 - 07:31 AM

I personally believe that there is nothing fanciful in C++. So I tend to use all what is provided to me. I find namespaces as valuable as having classes, enum structs or templates. This allows to confine things and to prevent them to pollute another namespace or the global one.

And under a good IDE, namespaces are more helpful and lead to a good completion help.


Prefix can be good, but this was prior to C++ 98. We have namespaces since then. After all, a string is a string. So why naming it MyGameNameString ? It's also the same for vectors and many other types.


This was just my two cents...

#5315646 Sunlight theory

Posted by on 18 October 2016 - 02:50 AM

So basically the distance of the "sun" makes the need to calculate a directional light for all vertices? unnecessary. I can just say that the light is aiming at position 0, 0, 0?
Or shoult I choose a position way behind the planet?



Basically, directional lights do not have any positions. In (old) OpenGL, when you set the 4th component of the light position to 0, it is interpreted as its direction.

#5314947 Changing texture

Posted by on 13 October 2016 - 12:20 AM

Is there a better way/technique to process all on GPU?


You might be able to do it on the fragment shader, depending on your requirements.

Compute shaders are also able to generate images.

You can also do it with OpenCL or any other computation languages.

#5314944 Running into some octree problem

Posted by on 13 October 2016 - 12:15 AM

So How do I get rid of the lower part of the root octree?


Just put the origin at a higher value (y=world.size.y/2).

#5314234 develop mode

Posted by on 07 October 2016 - 05:32 AM

Use the f****** dlopen or LoadLibrary.

#5313672 Are games with large worlds compiled with fp:/fast?

Posted by on 03 October 2016 - 01:14 AM

so sure, for anything smaller than that, "just use double" will work just fine


This is for precision. But what about quickness ? I highly suppose that CPUs can still compute 32-bits floating point calculations faster than with 64-bits floating points. Even on 64-bits architectures. Am I wrong ?


Also, as far as I remember, floats ruled on the GPU some years ago. Do you think that nowadays GPUs can operate on 64-bits float as fast as 32-bits floats ?

#5311763 correct modeling for game developement (poly count)

Posted by on 21 September 2016 - 05:11 AM

What I answered before is still valid for your clarification.


Sometimes, some engines require to know each part of a thing, let's say, as you talked about it, a building. Doing so, will allow to easily tell to the game editor that this is a wall, this is not a wall, this is a room, this is a door. Each of them will be recognized as different things in the engine: the walls will allow to split the building into different areas, or to tell that all what is behind cannot be seen (major occluder), the doors will allow to create portals in between these areas, and so on...


All of this is generally done so that to improve the performance of the rendering engine. Nowadays, this is less true, but some engines still require to tell that this geometry is a major occluder, this area is a portal, this set of walls is considered as a portal area...


And even if the engine does not require to know all of this, or if the engine editor allows to select sub-pieces of the geometry, people will tend to have different manners to work. For example, when you dispatch a building into many pieces, some pieces might be easily reused. For example, you can reuse the doors in several locations, so this will allow to save the amount of geometry, thus allowing to require less memory to the graphic card, thus allowing the engine to do some instancing...


Hope I went on your direction this time :)

#5311754 correct modeling for game developement (poly count)

Posted by on 21 September 2016 - 03:02 AM

That's it. We can do so in order to avoid artifacts for example, z-fighting issues, aliasing with textures...


Game editors (or engine editors) are not modelers. They might most of them provide tools to work on or create the models, but they are not meant to modelize.

For things like walls, first because this is easy to model, and also because walls could help the engine having better performances (occluders and such), one would generally model them directly in the editor. But they could also be imported from a model (for example if the wall has a lot of geometry details, like holes, hills and other discontinuities).

But for more complex things (characters, cars, trees and so on), people will tend to model them in a modeler, create different levels of details, and different normal maps, then import them in the editor.


This is my knowledge about this. Real game developers will give more exact answers :)

#5311749 correct modeling for game developement (poly count)

Posted by on 21 September 2016 - 01:49 AM

Normal-mapping is an imagery-effect to move the details from the geometry (triangles) into the texture. This fakes the geometry detail on the image and since you provide extra normal values which are (generally) non-linear between each vertex of a face, then you lit the geometry as if it was not flat (but it is). This works well as long as the faces do not cover a too-big region in the screen.


This is why you need both the explanations mentioned above: put a higher-detailed normal-map into a lower-poly geometry, and have different levels of details of the geometry (and the normal-map) and choose accordingly, depending on the screen coverage.

#5311359 Why do most people recommend Python

Posted by on 19 September 2016 - 02:41 AM

In the end, all programming languages are the same, in logic...


Not really. Functional and imperative language have a different logic. You can also see this.


Otherwise, I really tend to avoid using languages made by a company, with real economic or users-join-our-new-religion purposes. And even if afterward this language will enter an ISO process (like C#). And mostly if this language had become well-known after a lot of marketing things.


So my two cents are: don't use a language because there's a lot of ads about it. If you really want to study what language should be best for you, then




Since the day I wanted to start programming.....Python....Python everywhere. Yes, it could be easy and close to our spoken language but...isn't time to stop recommending python, and recommend something as easy but modern??? Yes, I am talking about Swift...


is too small...


Don't forget that a language is a toolbox, not a tool. New languages will tend to change a lot, will lack support of many things at the early ages.

#5311036 Getting started with OpenGL development in linux

Posted by on 16 September 2016 - 12:10 AM

Some links that might be useful:


https://www.opengl.org/wiki/Platform_specifics:_Linux (don't use the code at the end)


https://www.opengl.org/wiki/Programming_OpenGL_in_Linux:_GLX_and_Xlib (you can use this code to create a window). But you can also use glut (check for freeglut in your distro packages).




On nVidia at least and as far as I know, you're not obliged to get the GL functions/extensions pointers. But it seems that every one does this since it is more portable.


Only nVidia now (and probably the latest drivers for the latest graphic cards on AMD) allow to do OpenGL without requiring Mesa. You will then need to install the official drivers, just like under Windows. Sometimes (even often) they can be provided with your distribution as different packages.

#5310877 Edge smoothing

Posted by on 15 September 2016 - 12:56 AM

It also seems that your solution ended up showing some artifacts on some edges (see your bottom left cube, the one with the yellow ball).


Or is it due to something else (slight motion in the camera, difference in lighting maybe) ?


Also, I really love your images. Some people have very nice imagination, and it's needless to say (but I'll tell it anyway) that it helps a lot when wanting to show what you do. Congrats.


PS: sorry for the out of topic...

#5310747 C++ Going Beyond Basics

Posted by on 14 September 2016 - 07:25 AM

I started with the Hello World code, then learned more and created a program on my own where the program asks questions and you answer (input, output). I have difficulties going beyond that. What I mean is, I do not have any ideas of what I should code next...


One of the first C++ program I started to develop when I thought I became comfortable enough was a very little physics simulator, implementing most the concepts I learned in school (law of motion, gravity, force exchanges...). That naturally brought me to having to represent this in 3D. But the fact that it cannot look humble, this was of course modest, and this allowed me to learn a lot many aspects of programming that I misunderstood or so.


I believe that once you have made many little programs, start with something that can be very big. This allows you to learn and as important too, to discover what you are interesting with the most. I guess this is with that project (which at the end included physics, GUI, 3D and so on) that I realized that I prefer to focus on rendering and having good design in my code.


Then I switch to make little 2D and 3D games which made me realize that even if I prefer to do the rendering and design, I feel more comfortable on doing the background (here all the rendering internals).


So my two cents are, if you still think you're a beginner, then spread as much as you can. Don't hesitate to make mistakes, to go to the wrong direction. You will progressively discover where you feel more comfortable, where you are better (this can be different), and this will also allow you to improve your coding. Because having good skills in programming is very important when starting or entering a real project, as important as knowing which portion of the game, the engine, the editor... you want to work with.