Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Feb 2007
Online Last Active Today, 01:41 AM

#5312491 Why C# all of a sudden?

Posted by on Yesterday, 07:26 AM

For 20 years C++ was the recommended standard language, especially in the gaming industry. Mostly because it is fast and powerful, inheriting most programming language standards you can possibly think of.

Game and engine development have diverged for a while and the breach is only getting larger over time. Neither AAA nor indie studios build their own engines anymore, that job is now left to middleware developers. All that performance you're talking about needs to be done on the engine side of things, while game developers now instead focus on the higher level stuff - and that can be done with languages that aren't as close to the metal as C++.

It also says something about how complex the game industry has gotten now.

I'd say that most AAA companies build their own engine -- licensed engines are quite rare in AAA from what I can see.
e.g. off the top of my head, almost every AAA company that I can think of has their own internal engine(s): EA, Activision Blizzard, Ubisoft, 2K, Rockstar, Konami, Square Enix, 343, CCP, Naughty Dog, Guerrilla, Insomniac, ArenaNet, Ready At Dawn, Bethesda, CD Projekt, Valve, Codemasters, Riot, Nintendo, Wargaming... In my personal experience, 50% of my games jobs have used licenced engines, and 50% have used their own proprietary tech.
But yes, these engines are typically developed in C++ while the game itself may or may not be. All (4) of the PS4/Xbone games that I've worked on have actually used Lua for the vast majority of the gameplay codebase, and use C# for the vast majority of the tools codebase (and yep, C++ for the majority of the engine codebase)!
In the tools codebase, long term maintainability beats absolute performance, so C# is a great choice.
In the gameplay codebase, daily programmer productivity and agility to change beats absolute performance, so Lua is a great choice.
In the engine codebase, performance is king and we do a lot of data-oriented work, reinterpreting blobs of bits and streaming tightly packed bits of memory between parallel systems, so C++ is a great choice.

C has been a large standard for game development for long time, especialy in times of large impacting games and games "golden era". Wheather it was John Carmack's work, even Doom 3 , Shiny Entertainment's games, Half Life's Source engine as derived from Quake engine, etc. - simply the majority of AAA back then, as well as engines that were not designed and ment to be licensed (Unreal was c++ for that matter).
C++ can introduce performance negative impacts against C, since the inheritance was a subject of heavy missusing very often, making possibly all objects unable to interleave in immediate accessible arrays and so forth.
So if you present C++ as great solely becouse it has been the industry standard for develping video games, you have to review your data.

Doom 3 and Half-Life were mostly C++ with a tiny bit of C :)
The late 90's was when C++ got standardized and aggressively moved into C's turf a lot more.
The argument that C++ is slower because people might use it badly is... not even valid. You can't compare good code in language A with bad code in language B  :rolleyes: That's the kind of hyperbole that only Linus 'Arrogance' Torvalds can get away with.

#5312316 the dreaded "escort" quest

Posted by on 24 September 2016 - 08:43 AM

One of the most memorable COD missions is a reverse escort quest :D

#5312298 Get pixel's location

Posted by on 24 September 2016 - 06:14 AM

IIRC, any vertex after applying projection matrix, should report it pixel location at x, and y component right?

No, the projection matrix takes you to 4 dimensional pre-projective-divide NDC space, where xy>-w and xy<w. After dividing xy by w (which the GPU does for you during rasterization) you get -1<xy<1.

HOWEVER, yes, in the pixel shader, the SV_POSITION semantic implements a bit of magic and applies this divide by w and also applies the viewport matrix, resulting in xy pixel coordinates.

#5312297 Sharpen shader performance

Posted by on 24 September 2016 - 05:59 AM

A quick google turned up the fact that there's vendor specific hints in GLSL, such as #pragma optionNV (unroll all)... :(

Personally I'd recommend treating GLSL like JavaScript on the modern Web -- never directly write the files that will ship; always have them generated from some build system and potentially have the real source code in a better language altogether. That way you can have clean source code and ship ugly optimized GLSL files, such as with pre-unrolled loops.

#5312125 Gui Libraries?

Posted by on 23 September 2016 - 09:22 AM

Would be nice if someone tries to use it and give feedback, so I can improve it.

Separate the GUI library from the GUI rendering logic, and allow users of the library to replace the rendering logic -- look at other libraries such as Dear imgui, and librocket for examples.

Even if my engine is using OpenGL on a certain platform, I don't necessarily want middleware emitting GL function calls itself -- often you want the middleware to emit abstract commands that your engine can convert to GL calls itself (this can actually be more efficient in some cases!).
Also, GL definitely is not supported on all major gaming platforms.
MacOS supports GL2, but you can't mix GL2 and GL3/GL4 code together -- GL2 works in a legacy support mode. So GL2 middleware in a GL4 game is a bad idea.
Windows supports all GL versions, but there's three different implementations that you need to test against, so the vast majority of games on Windows use D3D as it has a single, stable implementation.
No game console supports GL -- so sticking with "just use GL everywhere" is saying that you don't care about people making console games (which is actually a lot of indies these days).

#5312053 Rise of the Tomb Raider cave exit effect

Posted by on 23 September 2016 - 01:27 AM

So basically using Reinhard I could achieve the same effect?
Thanks for your response.

Depending on which version, yes.
The basic version (which maps infinity to white) is:
color = color/(1+color);
And the version with an adjustable white point is:
color = (color*(1+color/(white*white)))/(1+color);
Either of these can be augmented to include an exposure modification right before tone-mapping, e.g.:

color *= exposure;                                 // Exposure
color = (color*(1+color/(white*white)))/(1+color); // Reinhard
return pow(color, 1/2.2);                          //linear -> sRGB approximation

If modelling a real physical camera system, you'd compute the exposure multiplier from the camera's ISO, F-stop/aperture and shutter time settings.
If using auto adaptation, you might use the average scene luminance to pick an exposure value that will center the image around middle grey:
e.g. exposure = 0.18/averageLuminance; or exposure = 0.18/exp2( averageLog2Luminance );
Or if manually tweaking your scenes, you can manually set the exposure variable to whatever you like.


However, Reinhard is a pretty unpopular tonemapping curve for games these days. Try some of these instead: http://filmicgames.com/archives/75


You will also need a bloom effect to get the over-exposed regions of the image to bleed into the darker surroundings.

#5312014 How to use Unit-Tests

Posted by on 22 September 2016 - 07:52 PM

When you write:

#define CATCH_CONFIG_MAIN  // This tells Catch to provide a main() - only do this in one cpp file
#include "catch.hpp"

Then this will declare a main function for your program that runs all of the "TEST_CASE" code -- therefore you should write your test cases in a completely seperate executable project than your game.
Unit tests are separate to the game and ensure that each small component works as expected. A test case should use the component in multiple ways, as many as feasible while testing every big of functionality. These unit tests should be runnable without running the actual game, to check if each small part of the code works as expected.

For testing that the state of your program is valid within the normal execution of your game, you should use an assertion library, not a unit testing one (you can/should do both though). Assertions test that everything is valid as part of normal code execution and help you catch crash bugs in the game itself -- before something goes wrong enough to cause a crash, it will/should cause an assertion failure first, which will allow you to break in a debugger and gather information on what went wrong.

#5311997 correct modeling for game developement (poly count)

Posted by on 22 September 2016 - 05:58 PM

but I heard that the animation section from maya is better.

The person who said it is a lair or a Maya user who is familiar with it's controls and not with Max.
Max is the best 3D software around, maybe over priced however it's still the best.

Isn't "best art software" a pretty subjective quality? I wouldn't call a difference in opinions to be a lie :P

#5311905 correct modeling for game developement (poly count)

Posted by on 22 September 2016 - 08:07 AM

Ideally, a triangle would cover roughly an 8x8 pixel area (or more), and at worst, around a 2x2 pixel area. Games tend to use several LODs of a model (levels of detail -- different versions of the model with more/less triangles) and the game will automatically pick the right LOD to use at the right distance to maintain a suitable triangle density.

I wonder Hodgman. Wheather this policy has any further, or even more serious, reasoning, but the redundant vertex stage processing.

You mean, is there a reason for these besides vertex processing costs? Yes, it's actually about pixel stage processing costs!!
Almost every GPU runs pixel shaders on a 2x2 "pixel quad" at a time. If your triangle cuts partially through this 2x2 pixel grid, then the edges will only partially fill those grid cells, but the pixel shader is still executed for the entire 2x2 area. For pixel-sized triangles, this means that you run the vertex shader 3 times for the pixel, plus you run the pixel shader 4 times!
Aside from the extra vertex-shading cost, small triangles can increase your pixel shader cost by 4 times!
The larger your triangles are, the better your "pixel quad efficiency" is.
As for the "should be larger than 8x8" recommendation -- the fixed-function rasterization hardware tends to operate on even larger pixel-quads, such as 16x16 or 32x32 pixels... and GPU shader cores tend to be SIMD processors that operate on 8-64 pixels at a time (or 2-16 "2x2 pixel quads" at a time).

#5311874 Rise of the Tomb Raider cave exit effect

Posted by on 22 September 2016 - 04:05 AM

If you've got a nice HDR postprocessing system, then this just requires changing the exposure value.
Many games do it automatically, like cameras do, based on how bright the scene is. Other games do it manually - by having the level designers place explicit zones, or letting animators control it throughout a cutscene.

#5311866 Is it possible (Selling/be sponsored) bad flash game even for low price

Posted by on 22 September 2016 - 01:31 AM

It wouldn't be a problem if i just gave this game some hours, but ohhhh noooo i gave it some months...

Is it possible for me to sell this game(get sponsored) for any portal for at least 500euros(560US dollars)?

Is that full time work, or just in your evenings / weekends?


If you put it on the Apple/Android app store for $0.99 you'd have to sell about 1000 copies to make the money you want, which honestly... is not likely. If you want to run a successful business, you don't just need great game development skills, but also business management/strategy and marketing skills. Even with all of that, most games are not financially successful. 

Making games as a business is hard.


Converted to my local currency, 500 euros is enough money to hire a programmer for between 1 to 5 days, depending on skill level. Most games take a lot longer than that to make, so they need to collect a lot more revenue than that. The people who are running successful games businesses -- even making simple mobile games -- often require their games to make $100k or more to pay off the expenses incurred in making it.


Honestly, if you're not ready to start a legitimate business like this, you should avoid disappointment by treating your game development as a fun hobby, not as a profit-making machine.

#5311746 correct modeling for game developement (poly count)

Posted by on 21 September 2016 - 01:08 AM

Triangle counts don't mean as much as they used to, especially now that we're drawing several million pixels (tens of thousands of triangles seems minuscule in comparison!).

If you have triangles that become smaller than a pixel when viewed from the intended distance, then you have too many triangles. Ideally, a triangle would cover roughly an 8x8 pixel area (or more), and at worst, around a 2x2 pixel area. Games tend to use several LODs of a model (levels of detail -- different versions of the model with more/less triangles) and the game will automatically pick the right LOD to use at the right distance to maintain a suitable triangle density.

#5311551 Serious Question needs serious logical feedback

Posted by on 19 September 2016 - 11:51 PM

For #1, are you talking about going to an existing game developer with an idea, and asking them to buy the idea from you (with payment as royalties on the project revenue)?

In my experience, that isn't likely to happen, unless the deal is that you pay them upfront to build the game.

There's a few reasons for this:

* Accepting ideas from the public is a risk. People who have sent them ideas might try to sue them for "stealing" those ideas. e.g. what if they're already working on a tower defense game and I show them my idea for a tower defense game? When theirs comes out, I'm going to say that they stole from me... So many companies immediately delete any game ideas that are sent to them.

* Most game developers do not have very much money. Most exist as "work for hire", where they need to be paid up-front in order to be able to build anything. If they are lucky enough to be in a financial position to be able to work from their own savings, they'll probably want to be working on their own amazing ideas.

* Everyone has their own game ideas -- so when you do end up in a position where you can afford to run your own games team, most people are excited to finally get to build their own ideas that they've been holding onto for decades.


The alternative is that you can go to a games publisher (not developer) and ask them for money. The problem with this plan is that while publishers do have money to fund projects, they do not have a development team. If you're going to go to a publisher with a pitch, asking for funding, they will want to see the resumes of the core staff members who will be building the product. They will want proof of your capability.


Option #2 is much the same as going to a publisher and asking for money, but the general public is the publisher. You still need to demonstrate that you have the capability to actually build the game (usually via a nice video of a prototype).

#5311365 DirectX 12 Multi Threading

Posted by on 19 September 2016 - 03:12 AM

Yes, ID3D12RootSignature and ID3D12PipelineState are immutable (e.g. SetGraphicsRootSignature only reads from them / doesn't modify the object), which makes them safe.

#5311322 GoldSRC to Unreal engine

Posted by on 18 September 2016 - 04:45 PM

Is it possible? How?

Yes. Port the code.