Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 06 Aug 2008
Offline Last Active Oct 15 2014 08:21 PM

#5167097 Is c++ good

Posted by kunos on 16 July 2014 - 01:43 AM

One thing I find "difficult" dealing with C++ is that it is a big big monster with different heads. You say "C++" but which one? Every C++ codebase I have come across uses a different subset of the language, completely different coding styles and guidelines.. and the more they add to the language the more this become evident.

More modern languages seem to have a better appreciation about coding standards and the importance to promote a clear style that identifies a language. Java comes with a style both "visually" (where the braces go, how you name things, which case you use) and logically.. with the standard library promoting that style. C# is even more on the same line.. Go is forcing the idea of "the one true way to Go". I have been writing C++ for almost 20 years.. I look at Unreal Engine 4 and my eyes hurt... it;s not nice and it wouldn't happen in a more modern language.

#5166707 Game doesn't crash if currently printing

Posted by kunos on 14 July 2014 - 05:22 AM

I agree with LennyLen.. you HAVE a bug, and you are lucky enough to have found a way to reproduce it reliably. Moving things around will just hide the bug..it'll be back, on some of your users' PC and you will have no way to fix it. Fix it NOW that you can see it.

#5164212 In need on some guidance.

Posted by kunos on 01 July 2014 - 09:06 PM

they are all irrelevant.

Just choose whatever you want and get going.. these are not "issues", they are just excuses to faff around.

#5164209 Problems passing an XMFLOAT4 to a shader

Posted by kunos on 01 July 2014 - 08:54 PM

Oh maybe you have missed my edit.

You need to bind the CB to the PS with PSSetConstantBuffers because that is where you are using image_alpha.

#5164202 Problems passing an XMFLOAT4 to a shader

Posted by kunos on 01 July 2014 - 08:41 PM

This is one of the few areas in DX11 where the same operation can be performed in 2 ways:



You need these flags:

cbDesc.Usage = D3D11_USAGE_DEFAULT;
cbDesc.CPUAccessFlags = 0;
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
I have benchmarked these 2 and got no substantial difference.. so in my code I am using Map/Unmap simply because it looks more clear to me, especially the buffer creation flags.
The code is something like:
context->Map(buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource);
memcpy(MappedResource.pData, bdata, bsize);
context->Unmap(buffer, 0);
Instead of a single call to UpdateSubresource.
I think your problem might be that you are binding the CB for the VS, if you are using it in your PS, you need PSSetConstantBuffers.

#5163539 I've got problems with interviews

Posted by kunos on 28 June 2014 - 06:41 PM

if you really detect a pattern in your interviews you should treat it just as you treat any other programming problem you have solved: work on it.

Sadly you cannot make the rules, even if you think the rules are stupid, you either play by the rules or stay in KFC.

I can assure you that once you get hired the first time everything becomes easier.

It should be quite easy to find these kind of interview-like tests on the internet.. force yourself to work on these 1 hour a day and eventually you will get better and land your software dev job... I am sure it'll also widen your horizons and give you different perspectives on things in the process.

#5163417 An good game engines for 3rd person shooter

Posted by kunos on 28 June 2014 - 04:54 AM

The answer is: all of them.

The real bottleneck is you.

#5163221 Vector Efficiency question

Posted by kunos on 27 June 2014 - 06:25 AM

The reason to put object in a list is to allow fast iterations of common operations.

If you need operation on a "player".. then you should have a Object* player; Object* ground; and so on.. having to go through a list to find a object EVERY TIME makes no sense, and having a list without performing common operations on that list doesn't make sense.


Unless it's a VERY rare occurrence, it should never be necessary to retrieve an element from a list, by name, in the game loop.


In other words.. if you are retrieving an object by name "hundreds" of time in a frame, you are doing it wrong, map or no map.

#5163144 Help Engine

Posted by kunos on 26 June 2014 - 09:26 PM

In general people seem to agree that Unity is the easiest engine to work with... I agree with that too.

#5162339 Jumping over to DirectX?

Posted by kunos on 23 June 2014 - 09:02 AM

my comments to your points:



1. True.. it's not easier and I don't think it'll make your code much more clean. But it has the advantage of having ONE way to do things, no more wondering where the fast path is. Using C++ also means slightly better error checking. No more glClear(GL_DEPTH).. oops.. i mean GL_DEPTH_BUFFER_BIT or whatever.

2. Sadly they killed PIX that was awesome. Visual Studio graphics debugger is a pain but still miles better than anything on OpenGL. Intel GPA is not bad too.



1. You dont need GLEW and GLFW.. that is why you don't find a "replacement".. that is a good thing in my book, to open a window, just open it the Win32 way. Also check out the new "modern C++" DirectX toolkit libraries on codeplex.. they replace the old D3DX11 libraries.. although some things are still very messy and unclear..ie. handling fullscreen. You can keep using GLM... although DirectXMath is way faster but much uglier.

2. I dont have the link but there are some good DX11 tutorials... official documentation and it also contains some tutorials.


All in all.. DX11 is a very good graphics API.. very well supported, great docs, good design, great drivers and stability, consistent shader compiler.. a big step forward if you are coming from OpenGL... it feels like it's actually 2014 and not 1999.

#5159182 I hate my code....How do you structure your code for a game?

Posted by kunos on 08 June 2014 - 10:45 PM

My code uses classes. Should I have classes with the same variables? Is this simple?


this sentence doesn't make sense at all... and that means you are simply still a beginner and your knowledge of programming is not yet at a level where you can actually discuss about these things.


Concentrate to make things work, no matter how ugly they are, you'll make them prettier and reusable later. Keep studying and making games, have a look at some other people's code.. you'll start to see patterns emerging... that's all that it is: just experience.

#5159017 OpenGL quaternions

Posted by kunos on 07 June 2014 - 11:14 PM

just want to add that to solve your problem you do not necessarily need quaternions. You can work with 4x4 matrices as well.. just, as suggested, never store angles, always work on the underlying matrix.

So if you want to "pitch" your spaceship, do not change the "pitch angle".. create a rotation matrix around the X axis and multiply that by your current matrix.. you have now pitched your ship.

#5157865 will make help me?

Posted by kunos on 03 June 2014 - 10:50 AM

An IDE will do it all automatically for you - no work certainly seems simpler than the amount of work you've put in so far.


at last.. some sanity

#5157123 DirectX

Posted by kunos on 31 May 2014 - 04:39 AM

Sadly 3D graphics is a huge topic and things change so quickly that's hard to keep up.

IMO the best way is the proper way: buy a book and read it. I don't think it's a subject that can be understood with internet tutorials.

Try to find the most recent book on DX11 (or OpenGL) on amazon and study it.


The DirectX App wizard is your "hello world" for DX, it doesn't get any simpler than that.

Also make sure your knowledge of C++ and basic operations in Visual Studio is up to the challenge... if you have problems linking and compiling with libraries it means your level of C++ is simply not high enough to adventure into 3D graphics.

#5156704 DirectX

Posted by kunos on 29 May 2014 - 07:33 AM

Xaml is a way to define GUI in Windows Store Apps. The Xaml application will create you a template application with a Xaml controls in which you will write with DirectX. It might be useful if you need buttons or any other Windows Store GUI element while you play.

The DirectX app will just give you a blank app and you'll be responsible to draw into it completely with no GUI support from Xaml.