Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Member Since 21 Feb 2008
Offline Last Active Yesterday, 07:04 PM

#5095378 Who has implemented a licensing API/SDK

Posted by NightCreature83 on 20 September 2013 - 02:35 AM

Steams CEG solution seems to be the better direction for this stuff, as it doesn't impair the game on a functional level. It just makes it so you can't use certain features or texts are changed to other things. Which can make a game look like this: this is a pirate copy hence the Yarrrr replacement of real text smile.png, we never disabled the game other then the text. Batman Arkham made the game playable up until you had to use your cape to glide somewhere which the game didnt allow if it was a pirated copy.


These are also crackable but more subtle and make your game act like a demo for the real product, so that when users start to complain on your forums you can tell them, to buy the full version to get ride of the issues.

#5094901 VS2012 debugging DirectX

Posted by NightCreature83 on 18 September 2013 - 05:05 AM

You need to tell the HLSL compiler to include symbols in your shader code otherwise you will not be able to debug in HLSL as the runtime doesn't know how to translate the bytecode to HLSL.



Directs the compiler to insert debug file/line/type/symbol information into the output code.

(1 << 0)   


Also Pix only doesn't work when using the DX11.1 runtime or higher at the moment that is win8 and up, bear in mind that the graphics debugger has a few errors that PIX didnt have. Like telling you it killed a pixel because it failed the depth test whilst in reality it failed the stencil test, look at the device and it's state in this case to figure this out.


GPUPerfStudio 2 is the vendor specific tool for AMD/ATI cards. I believe NSight still has a few support issues but I am not completely sure about this. Also NVidia requires you to run a special driver.

#5093511 virtual destructor

Posted by NightCreature83 on 12 September 2013 - 03:26 AM

No, if a virtual function is virtual in the base class it stays virtual in all derived classes. So if IBaseClassI has a virtual destructor all the derived classes destructors are virtual too.

It still is a good idea to mark the virtual functions as virtual in the derived classes, just so you can instantly see from the header file which functions are actually virtual. As mentioned before this is not a requirement by the standard but it is a good practice to have.

#5093408 Basic C++ Help Maybe?

Posted by NightCreature83 on 11 September 2013 - 04:50 PM

Just some tips:


Please teach your self to move "using namespace <namespace_name>;" into a function call or wrapped in another namespace, preferably the first option. This is because you have just polluted the global namespace with all the names of std, which is bad and can in cases lead to compiler errors that look really strange.


Slightly better way to write the initial declaration and initialisation of the variables is like this

    int score = 0;
    double distance = 1200.76;
    char playAgain = 'y';
    bool shieldsUp = true;

    short lives = 3; //Don't define multiple variables on the same line this can create issues for you when declaring references and pointers on one line
    short aliensKilled = 10;


The reason for this is that you will not forget to initialise a variable, C++ doesn't automatically do this for you, so untill you actually assign a value to a variable it has an undefined value(usually whatever the memory is at the time the variable is declared and given a memory area to use).

#5093254 Updating a GUI

Posted by NightCreature83 on 11 September 2013 - 06:22 AM


Your problem lies in the fact that SetSize calls Update, so if you use these in each other then you have created an infinte loop and the only way to break that is to not call one of them.


It is best to not call Update from SetSize and let Update deal with these changes on the next frame, you won't notice a 1-2 frame delay on 30FPS.

That would indeed work. What would be the best way to do this? Push the object into a container to be iterated through next frame with its changes marked somehow?


Just mark the object as dirty and look for that in the update function, if it is dirty it might also need to check the children. Reset the flag after that update iteration and continue on as usual.

#5092939 IDE for C++ Programming

Posted by NightCreature83 on 10 September 2013 - 02:50 AM

You can run custom build steps from MSbuild which allow you to compile with any compiler you want. X360 and PS3 for example don't build with the visual studio compiler yet you can still launch a compile from Visual Studio.


If your all windows then VC++ should do you fine, but if you like portability and moving around, CB and other IDE's might be better since they're not coupled with Windows. I also don't like how VC++ has to have its own libraries ( "Visual C++ Redistributable Package" )

GCC has these package as well by the way, any C++ compile has some runtime package that needs to run to deal with OS interactions and memory allocations btw.

#5091287 slow speedup of cpu's ?

Posted by NightCreature83 on 03 September 2013 - 07:21 AM

Yes that has been a reality ever since intel and amd switch to producing multicore cpu's, when that happend we actaully saw a drop in processor speed back to the 2ghz mark.

Due to the fact that there are too many resistances and electircal leaks in CPUs, die shrinks no longer solve these issues without an extreme increase on power consumptions as well. This happend at the end of the P4 era, where above 3Ghz speeds where reachable but not withouth having the CPU drain 100-150 watts of power

#5090075 Updating constant buffers?

Posted by NightCreature83 on 29 August 2013 - 05:03 AM

Well that is untill you bind another shader off course or another buffer on the same slot.

#5090037 A simple window directx 10 takes 25% of the processor. Is this normal?

Posted by NightCreature83 on 29 August 2013 - 01:15 AM

Is there a sleep in your main loop? If not you have a busy loop and it will take up a full CPU core to execute on it.

#5089816 A proper way for help screen?

Posted by NightCreature83 on 28 August 2013 - 07:42 AM

Generally speaking professional UI systems don't really have position values coded out in the source code it is data for the system to act upon. This can be XML, a full scene graph or even a 3ds max or maya scene that gets loaded up.

#5089769 a map<T,T> as a default parameter...

Posted by NightCreature83 on 28 August 2013 - 03:32 AM

Just as a side note but in general strings should be passed as const reference arguments and that is very much true for the map<T,T> as well. All big objects that don't need changing in the function you are calling should be passed by const reference

#5089516 C++ Optimization week!

Posted by NightCreature83 on 27 August 2013 - 08:59 AM

A few things I keep in mind:

- use const where possible, both in member functions as parameters

- pass objects as const reference when their size is 'relatively' big

- don't let 'outsiders' get to crucial class members (make things private, make const 'Get...' functions public) 

- use VLD Always in debug mode, detect memory leaks a.s.a.p.

- use &auto when possible to make code more readable

- where possible always use std::vector instead of dynamic arrays (new/delete)

(helps in following 'the rule of 3')

You should reserve the space of vectors as well this will at least in the avarage case help the vector not resize as much.


Check your template usage if you have loads of this it will upset compile times and may even make a compiler cry once in a while.


Batch compiling will also help, look for unity builds for that subject but keep in mind that you should always have a single file compile path in the solution as well.

#5089254 Managers, which pattern should I use

Posted by NightCreature83 on 26 August 2013 - 01:33 PM


As for input, Radikalizm points out that you can have all sorts of different input devices, but in this case I think a 'manager' is okay for exactly that reason: your game can only support the device types that you code support for, and it needs a system in place to 'manage' which devices are active/connected, etc. That system can function as a means of allowing easy access to your input device interfaces, but it shouldn't implement those interfaces. I have no problem with something like


I mostly follow the mindset that there will probably be some devices which I'll want to implement later on in my game's development lifecycle without having to bloat existing systems. Some devices also require you to use an existing SDK with some of their own manager objects which need to be alive during the time you want to use the device (like the Oculus Rift for example), so that's more of a reason to maintain the code driving a certain input device separated from other devices. 


Hiding all of your device info behind an input manager also hides which input devices a certain other input requiring class need, which can become a real mess when you want to change something in your input manager class.


But you should hide all of you input devices behind an interface anyway otherwise you are going to add special code paths for certain device which lead to even worse design. Implement against and interface not an implementation, and behind that interface all kinds of nasty can go on but your game code doesn't need to know about this and that is exactly what an input system is supposed to do.


I agree with the idea that as soon as you try to create a manager object you need to rethink that part of your code to see whether this is a system or cache type situation but the example you use just doesn't work. In that case implementing against an interface will save you from a lot of trouble in the rest of the code base.

#5084895 Mathbook for dummies, any recomendation?

Posted by NightCreature83 on 11 August 2013 - 05:46 AM

I used these ones: http://www.amazon.co.uk/Primer-Graphics-Development-Wordware-Library/dp/1556229119 and http://www.amazon.co.uk/Mathematics-Programming-Computer-Graphics-Development/dp/1584502770/ref=sr_1_9?s=books&ie=UTF8&qid=1376221532&sr=1-9&keywords=math+for+game+development

#5084402 What is a tight loop?

Posted by NightCreature83 on 09 August 2013 - 08:22 AM

Tight loops are to do with performance, they don't necessarily have few instructions inside of it, they are however time critical to the application so you want to eliminate operations from them that can be dealt with elsewhere.