Jump to content

  • Log In with Google      Sign In   
  • Create Account

ApochPiQ

Member Since 17 Jul 2002
Offline Last Active Yesterday, 10:02 PM

#5307257 Unexpectedly horrible optimization. VS2015. x64 target.

Posted by on 22 August 2016 - 01:19 PM

I have no idea what it is you're looking at or why you think it's wrong, let alone an actual compiler bug.

Post a complete but minimal repro case that demonstrates this, along with the ASM output and a proper description of your reasoning as to why this "obvious" bug is really actually even a problem.


#5306789 Adequate Windows Operating System Testing

Posted by on 19 August 2016 - 04:19 PM

Again, multiple editions of Windows are rarely a genuine problem. Unless you are specifically targeting features that are NOT available in lower-level editions, you're fine.

You would be very unlikely to be using an edition-specific feature and not know it.


#5306422 C++ what is in string after std::istreambuf_iterator< char >(sourceFi...

Posted by on 17 August 2016 - 04:19 PM

Did you step through the code in your debugger?


#5306380 SSE 4x4 Matrix transpose and invert

Posted by on 17 August 2016 - 12:15 PM

Speculation is nigh-on worthless with SIMD code. Profile that sucker :-)


#5306228 Alternatives for std::heap?

Posted by on 16 August 2016 - 03:15 PM

The main thing you get from a heap structure in A* implementations is typically a priority queue of sorts; a google search for "delphi priority queue" turns up a few options for libraries that offer this functionality.


#5306041 Initialize your goddamn variables, kiddies

Posted by on 15 August 2016 - 05:24 PM

Once upon a time there was a video game.

Like many games, this one had a physics engine, and used it to reasonable effect.

Deep in the code that connected gameplay rules to the physics simulation, there was a piece of code for handling jumping.

It was a pretty tame, innocent piece of code, all in all. It set up either a controlled, normalized vector for a "launch" or a directly vertical vector for a normal jump.

For nearly two whole years, a demon lurked in this little snippet of code, waiting to come out.

One day, it spotted an opportunity. And boy did it ever seize that opportunity.

Suddenly, reports of game crashes came pouring in. By the hundreds. At its peak of devastation, that little code demon caused a random player, somewhere in the world, to crash out of the game roughly every ten minutes.

The programmers scrambled. The programmers puzzled and pondered and pored over code. And they found nothing.

For almost three entire weeks the demon ran amok, crashing innocent gamers everywhere.

In desperation, the programmers littered a private build of the game with land mines, poisoning memory and then asserting that the poisoned values never appeared at runtime.

But appear they did. In spades.

At last, the source of the mystery was uncovered. Bit by bit, the programmers whittled away at the problem, until the ultimate source of the bug was laid bare.

Once jumping was implicated in the crashes, it was relatively easy to poison the jumping physics code and wait for the assertions to fire.

From there, finding the root cause was just a matter of carefully reading a few dozen lines of code, and poof - there it was, that nasty little demon, exposed for all to see.

In one code path, the vector created by the jump logic was flawless. In another, it was partially initialized - only the Z component carried a meaningful value.

Therefore, roughly one in a billion jumps, the stack garbage that populated the X, Y, and W components of the vector would become a NaN sentinel value.

The physics engine would dutifully corrupt the state of the game, silently propagating the NaN to all kinds of arbitrary coordinates and vectors in the simulation.

And then, a few frames later, someone would query one of those corrupted vectors, and crash.

The moral, of course, is to initialize your fucking local variables, or I will eat your soul while you sleep.

The coding standard was updated, the programmers involved celebrated, and the demon was laid to rest forever.

And there was much rejoicing.


#5305526 Life as a Tools Engineer ( in game development )?

Posted by on 12 August 2016 - 12:57 PM

My general thoughts:

- Tools engineering is going to have basically the same culture as the rest of engineering within a given company, modulo having different internal clients.

- As such, moving away from gameplay to tools just for cultural reasons is likely to fail unless you find a new company with a better culture.

- By the same token, if you find a new company with better culture, why not stay in gameplay and maintain your experience level? You won't have to face going from experienced gameplay engineer to junior tools engineer, for example.


#5305137 Very Simple Parser A Bit Similar To Bbcodes

Posted by on 10 August 2016 - 11:05 AM

boost::spirit and lex/yacc are massive overkill for a simple string chunking problem. Shaarigan has the right idea.


Regular expressions, such as those supported in C++11 and newer, are probably your best bet for simple tag markup. Regexes are also super useful for other things so are worth learning as a tool if you don't already use them.

For instance, even if your code never uses a single regex, you can use them for find/replace operations in virtually every text editor out there. This is a massive time-saver for me when doing repetitive edits, for example.


#5304966 How To See A Router's Forwarding Table?

Posted by on 09 August 2016 - 02:36 PM

What are the two endpoints of the failing connection? NAT is usually set up to be one-way, ie. you don't connect to the public address and port if you're on the private side of the network.


#5304936 Adequate Windows Operating System Testing

Posted by on 09 August 2016 - 12:29 PM

Steam Surveys are generally a good place to find OS data: http://store.steampowered.com/hwsurvey


#5304927 Which Way Would Have Better Performance?

Posted by on 09 August 2016 - 11:57 AM

My opinions:

- It almost certainly doesn't matter. Kylotan has a point here; until you've profiled and proven that your bounding shapes are a substantial cost, this is a waste of energy.

- It might matter. Kylotan also has a point about the shape being important semantically. If the original problem-space early-outs more often with a sphere than a box (or vice versa), it can dramatically change the performance characteristics of the running code if not early-outing is expensive.

- The burden of proof is on OP to indicate whether or not it does matter. The above two points are only answerable with knowledge that OP has. Otherwise we are just guessing and conjecturing.

- None of this is likely to make sense to an actual beginner. The burden of explanation is on the more experienced community members to explain not just the on-the-face answer to the question, but the context and wisdom of years that leads to responses like "it doesn't matter." In this vein I think Hodgman has the right.


Ultimately? Maybe this optimization is important, maybe it isn't. But if we just talk to ourselves about it, the OP (and other, actual beginners) will learn nothing. Elevating discourse is not a simple task, but it is a noble and worthy one.


#5304915 Sfml - Missing Dlls, One Of Them : Msvcr100D.dll

Posted by on 09 August 2016 - 10:32 AM

Those libraries are Visual Studio 2010 versions. I can only speculate as to why SFML is looking for them instead of the 2015 versions that (presumably) you do have installed...


#5304900 How To See A Router's Forwarding Table?

Posted by on 09 August 2016 - 09:34 AM

Your PC does not have an external IP. That's the entire point of NAT. To everything not on your local network, your PC and your router are indistinguishable.


#5304742 Adequate Windows Operating System Testing

Posted by on 08 August 2016 - 03:05 PM

XP is dead and essentially unsupported. Vista is on its way out. 2000 is archaeology.


Testing on different editions is rarely necessary unless you specifically target a feature that is not available in some particular edition of Windows. I can't think of anything off the top of my head though.


#5304271 Limiting Cpu Usage

Posted by on 05 August 2016 - 05:49 PM

The cheap and easy thing is to vsync your renderer and not let your simulation run ahead of that.

Otherwise, you can measure how many frames you've simulated in the past second. If it's above some threshold, say, 60, then use sleep or whatnot to slow you down. Figuring out how many milliseconds to sleep based on your target framerate should just be a little algebra.

Note that you will want to slow down a tiny bit across many frames, rather than a lot on one frame. That'll smooth things out and avoid hitches on high-perf machines.




PARTNERS