Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Jul 2001
Offline Last Active Yesterday, 12:14 AM

#5256574 Do you use friend to avoid security problems ?

Posted by Promit on 10 October 2015 - 02:01 PM

Private is very important in that it lets you provide a clean API to end users that allow you to modify the internals with minimal recompilation and preserve class invariants. Protected has a few useful applications (for holding an interface's destructor for example if you don't want someone destroying an object via the interface).

Except we're talking about C++, which immediately and catastrophically fucks this up by making the private internals part of the header anyway. So then we end up with tricks ranging from vanilla polymorphic interfaces to pImpl idiom variations, rendering the whole exercise pointless.

Like others have said, access semantics, like other things in the language, are there to protect the programmer from making mistakes and to help enforce good code design

And the moment you inflict friend, we're not talking about good code design anymore, we're talking about continuing hacks where the core design has already gone awry. It's worth noting that a number of modern languages get by just fine without access semantics. My argument is they may get along better without them and that the very use of access semantics represents total failure of encapsulation in C++. Why? Because even if I can't access the internal details of a class, I can see them just fine due to other encapsulation-puncturing issues in the language. That serves to bind clients to implementation details anyway, in the absence of pImpl type techniques. Lacking the relevant semantics forces you to deal with the interface/implementation divide directly. This is not the case in Java or C#, which implement sane module systems and let you alter implementations without impacting clients.


If you consider C++ private/protected semantics relevant to your code design, it's time for a redesign.

#5256483 Do you use friend to avoid security problems ?

Posted by Promit on 09 October 2015 - 11:42 PM

I honestly think private/protected are worthless features in C++. They serve some purpose in module-based languages like Java or C#, but their basic use in C++ is just not particularly compelling.

#5256258 C# Garbage Collection and performance/stalls

Posted by Promit on 08 October 2015 - 01:07 PM

The Microsoft .NET runtime offers significant control over when and how the garbage collector runs: https://msdn.microsoft.com/en-us/library/System.GC_methods(v=vs.110).aspx

#5255937 What's the best system on which to learn ASM?

Posted by Promit on 06 October 2015 - 08:35 PM

Get yourself a Raspberry Pi2B or a BeagleBone Black.  These are ARM boards -- the ARM processor is way simpler than the x86 even though they're of the same relative vintage (ARM is RISC, x86 is Swiss Army knife).  In addition to learning ASM, you can futz with blinkenlights so you can really feel close to the metal.  Learn to love the smell of rosin-core solder, it's the smell of victory.

This is the way to go. Most of the other suggestions are useless - while Z80s, 6502s, 68ks are kinda cute to play with, they have no relevance to modern development or modern processor design. x86 is extremely useful and relevant but also complicated and psychotic. MIPS was relevant once and continues to be a popular university choice, and resources are readily available. The trouble is just that very few MIPS chips are out there and what is generally lives in highly constrained embedded systems so it's just not a very real-world skill.


ARM strikes a great balance of being a nice, modern design that is highly relevant to work today, but still fairly straightforward to learn.

#5255452 The f***ing horrible nfl madden games!

Posted by Promit on 03 October 2015 - 08:50 PM

It would not be legal under any circumstances to use real teams, real players, real mascots, etc, if that's what you're asking.

#5255367 Vulkan is Next-Gen OpenGL

Posted by Promit on 03 October 2015 - 10:56 AM

Don't get me wrong - I am ALL ABOUT the new APis from a technical standpoint. But I'm not living in AAA world these days and practical reality is that writing a render pipeline for a market that maxes out at 22% is just a bit rough. Now it's very helpful that Win10 is free and everyone wants to get the hell out of Win8. But the real key point is that it's very difficult, outside of a few select high budget things, to really design around the new APIs. Oxide's been talking about this, where you really start leveraging the added capabilities in a way that is more extensive than simply writing multiple render pipelines, and those changes feed all the way up to your game design.


FWIW I am shipping a Metal pipeline game in a few weeks - which is more about the structure of Apple's platform than anything - and that's not designed around the new rendering API either. I still have to maintain GL ES paths for a wide swath of old devices and that means the rendering changes are low hanging fruit with a lot of old assumptions and limitations still preserved.

#5255297 HDR gamma correction

Posted by Promit on 02 October 2015 - 10:37 PM

HDR images are already linear, yes. The only images that need gamma correction are sRGB images (typically 8 bpc), which are your "normal" images in common image formats. Essentially you can just tell the API that the textures are sRGB and the GPU will handle the correction for you.

#5254606 Mac to buy for app development?

Posted by Promit on 29 September 2015 - 09:39 AM

The Macbook Pro Retina is easily a solid choice if you're also going to use it as a day-to-day laptop. I ran out of memory trying to do development on the older 8 GB model MBP, but I don't know how big or heavy your stuff is. (I didn't feel like ours was big, but...)

#5254049 What is more charged?

Posted by Promit on 25 September 2015 - 03:21 PM

I agree with the above. Buuuut if we're talking about the best paid game dev jobs, it's going to be highly capable system architects well versed primarily (but not exclusively) in C++ and various low level technologies like DirectX 12, GL/Vulkan, etc. People with deep and heavily mathematical knowledge of graphics and/or physics probably do best, as they're very difficult to replace. The web and engine-specific guys just don't merit the same levels of compensation.

#5252792 DirectX高级动画制作(Jim Adams)

Posted by Promit on 17 September 2015 - 07:29 PM

Google translate: I purchased this book (DirectX Advanced Animation) when I lost this book 's CD , give me a copy?

#5250653 High Quality Light Trails

Posted by Promit on 04 September 2015 - 10:36 PM

Some background info here: http://www.fxguide.com/featured/art-directing-effects-for-infamous-second-son/

GDC slideset here: http://www.gdcvault.com/play/1020158/The-Visual-Effects-of-inFAMOUS

#5245824 PI or not to PI ?

Posted by Promit on 11 August 2015 - 02:37 PM

The PI term comes from normalizing the light response to 1 - essentially it's the product of a surface area integration over the hemisphere. If you don't have it, your surface will reflect pi times the correct amount of lumens back out. If you want to make sure your lighting is properly energy conserving, you can do the divide by pi when submitting the diffuse color to the shader instead of in the shader itself.

#5245166 OpenGL vs DirectX

Posted by Promit on 08 August 2015 - 06:06 PM

And nobody is going to with your current behavior. Thread closed.

#5245149 OpenGL vs DirectX

Posted by Promit on 08 August 2015 - 03:39 PM

If platforms outside than the Microsoft ecosystem are important to you, especially mobile, OpenGL.

If you're happy being limited to the Windows world, Direct3D.

#5241134 Md5 Password Hasher would you use this.

Posted by Promit on 17 July 2015 - 07:01 PM

You're Probably Storing Passwords Incorrectly