News for hackers. Stuff that matters.
Re:CryEngine out on GitHub by zx2c4 on Tuesday May 24, 2016 @08:27AM (#11760978)
Re:CryEngine out on GitHub by dagw on Tuesday May 24, 2016 @08:58AM (#11761152)
Carmack has some interesting comments on this sort of coding: http://number-none.com/blow/john_carmack_on_inlined_code.htm...
Re:CryEngine out on GitHub by jdcarter on Tuesday May 24, 2016 @10:59AM (#11762116)
> "However, if you are going to make a lot of state changes, having them all happen inline does have advantages; you should be made constantly aware of the full horror of what you are doing."

Nicely put. :) Thanks for the link.

Re:CryEngine out on GitHub by barrkel on Tuesday May 24, 2016 @12:55PM (#11763193)
After many years of programming, I came round to favour more inlining than I used to (I probably wouldn't go as far as some of this function, however).

Needlessly increased variable scopes - and thus increased risk of harder to follow cross-dependencies - is probably the biggest downside risk. But I've found code that executes linearly easier to read and understand when it's written linearly. When everything is factored into functions - particularly impure functions - you need to click all over the place to understand the whole.

If there are higher-level primitives that can be used - filters, maps, folds, etc. - then they can reduce the verbosity overall. Some monadic styles can flatten nested code by computing a pipeline / computation rather than having lots of nested loops. But depending on the language and the problem domain, performance may suffer.

Re:CryEngine out on GitHub by d33 on Tuesday May 24, 2016 @02:06PM (#11764026)
For me, this code looks like it was decompiled. It's pretty much this amount of insanity.
Re:CryEngine out on GitHub by partisan on Tuesday May 24, 2016 @09:15AM (#11761253)
> When it gets to be too much to take, figure out how to factor blocks out into pure functions (and don.t let them slide back into impurity!).

This is a great piece of advice and one that has worked for me in the past when refactoring code like the one referenced.

Re:CryEngine out on GitHub by gknoy on Tuesday May 24, 2016 @11:43AM (#11762470)

    I was quite surprised at how often copy-paste-modify
    operations resulted in subtle bugs that weren't
    immediately obvious.

    I now strongly encourage explicit loops for everything,
    and hope the compiler unrolls it properly.
I found this particularly interesting
Re:CryEngine out on GitHub by butabah on Tuesday May 24, 2016 @12:10PM (#11762734)
Seeing Carmack's thoughts on programming always reminds me that I have such a long way to go. When he was my age, he had already created DOOM and DOOM 2 (along with the wtf? r_sqrt trick).
Re:CryEngine out on GitHub by corysama on Tuesday May 24, 2016 @01:28PM (#11763571)
Fun story: both ID and Epic started out making 2D games. When Tim Sweeny saw Quake for the first time, he literally gave up on gamedev because he thought he wouldn't be able to keep up with game tech. But, shortly afterwards a friend of Tim wrote a Quake-like 3D renderer as a fun project. Tim figured if that guy could do it, he could do it and went on the make Unreal.
Re:CryEngine out on GitHub by damptowel on Tuesday May 24, 2016 @06:32PM (#11766065)
Is this true? There's leaked Unreal alpha stuff from 1995, which was already doing almost everything Quake's bsp renderer ended up doing.
Re:CryEngine out on GitHub by munchbunny on Tuesday May 24, 2016 @07:41PM (#11766515)
One important insight into all of this is that, while there might not have been BSP renderers until 1995, the BSP rendering algorithm was probably 10-20 years old at that point.

Another good example of this is the Phong shading model. IIRC it was invented in the mid-70s, and some software rasterizers implemented it, but it didn't really make its way into graphics cards with fixed pipeline rendering until the mid-90s.

Graphics tech in the 90s and even early 2000s involved a lot of hardware and software catching up to theory from the 70s and 80s because we were finally getting enough compute power to make it worthwhile to use "approximate" rasterization-based algorithms in order to get real-time rendering.

Re:CryEngine out on GitHub by corysama on Tuesday May 24, 2016 @08:46PM (#11766830)
I had to dig up my source for this. I did misquote. It was Wolfenstein that gave Tim a shakeup and it drove him from coding to management, not out of games.

> Did you think about doing a first-person shooter after their success with Wolfenstein 3D and Doom?

> TS: It was funny how we got to that point. When I saw Wolfenstein for the first time, that was truly shocking. I'd never envisioned that you could do 3D in a computer game; I don't know why.

> The research had indicated that you could do that for at least 15 years before that, but it was this 3D game with real-time texture mapping; you know, real-time bitmaps scaled up and displayed in 3D on the screen. It never occurred to me that you could actually write code to do that. It was just another lack of foresight there.

> But seeing that for the first time, I was like, "Wow, I'm totally not worthy. I need to get out of programming now, because I'm never going to be able to compete with this." So they just basically demoralized me into becoming a manager for a few years.

> Around 1994, James Schmalz had written this 3D texture-mapping code, and I was starting to think, "Hmm, maybe that's not so hard." So I started reading up on references there and experimenting with it, and it turns out that, yeah, it's just another piece of code that you can learn how to create.

http://www.gamasutra.com/view/feature/4035/from_the_past_to_...

Re:CryEngine out on GitHub by munchbunny on Wednesday May 25, 2016 @09:29PM (#11774582)
Yup, in hindsight it's interesting because the key innovation was realizing that real-time 3D was possible.

The algorithms themselves (like 3D texture-mapping) are college third year problem set level difficulty to actually implement, but having the curiosity, courage, and ambition to be the first to do it real-time is huge!

The algorithms used in today's 3-d game engines are definitely more complex than something I'd expect a college student to do, but the state of the art has also progressed substantially since the 90's.

Re:CryEngine out on GitHub by partisan on Tuesday May 24, 2016 @05:43PM (#11765765)
That is incredible. I think that with games in particular, it is very easy to feel like you will never bridge the gap between where you are and whatever current AAA game is doing. It's easy to forget that those games we compare to are made by huge teams. The smaller games that are created by individuals and small teams are the product of a lot of effort. One simply has to stay the course and understand that a game is not made overnight. Still, it can be discouraging.
Re:CryEngine out on GitHub by duaneb on Tuesday May 24, 2016 @02:12PM (#11764085)
I don't believe he wrote the original fast inverse square root trick; but he is no less an inspiration for it.
Re:CryEngine out on GitHub by packetslave on Tuesday May 24, 2016 @03:53PM (#11764960)
https://www.beyond3d.com/content/articles/8/ for the history of it. The original author is still unclear, but that article digs back as far as Gary Tarolli at 3dfx/SGI (by way of Carmack, Abrash, and Terje Mathison)
Re:CryEngine out on GitHub by lobster_johnson on Tuesday May 24, 2016 @08:50PM (#11766856)
Nitpick: Terje Mathisen [1].

The man is a legend. I remember using his little set of DOS utilities (things like stuffit.com [2]) back in the early 1990s, which I got from a friend whose dad was a colleague of his at Hydro. They were all written in assembly language, and were superb little extensions to DOS.

[1] https://www.linkedin.com/in/terje-mathisen-b740181

[2] http://files.mpoli.fi/unpacked/software/dos/utils/keyboard/s...

Re:CryEngine out on GitHub by packetslave on Wednesday May 25, 2016 @01:23PM (#11771458)
Heh, Terje's name is actually misspelled in the linked doc (I was like "I know I copy/pasted that")
Re:CryEngine out on GitHub by gbersac on Tuesday May 24, 2016 @10:31AM (#11761828)
Really interesting. I already began to inline code with a comment for each block. Didn't knew John Carmack agree with me.
Re:CryEngine out on GitHub by kidmenot on Tuesday May 24, 2016 @10:11AM (#11761617)
14 levels of indentation across 811 lines. Wow indeed.

I refactor as soon as my code gets past 3 levels, I don't know how one is supposed to readily understand this block of code.

The lack of comments isn't what troubles me. Comments get old and, when they do, they get completely misleading and downright dangerous. As soon as you feel the need to add a comment, it's often because that particular chunk of code should be extracted into its own function/method/whatever and given an intelligent name. Comments should be reserved for really important stuff, like when the code does something totally non-obvious.

Re:CryEngine out on GitHub by webkike on Tuesday May 24, 2016 @11:59AM (#11762606)
This code is not actually that _complex_, it is just _complicated_, and there are probably several people within the company that understand it completely. If you actually go through the code, I bet you will understand the majority of it. Step functions are annoying and complicated and need to be _fast_, less than half a frame long. And you need to do a lot in them, and all of those things are tightly coupled.
Re:CryEngine out on GitHub by damptowel on Tuesday May 24, 2016 @06:41PM (#11766144)
Re:CryEngine out on GitHub by zubspace on Wednesday May 25, 2016 @05:44AM (#11768654)
Wow.

Question regarding index access: There are tons of for loops with player[k] occurrences and similar. Personally I would create a local variable and prevent further index-retrievals.

Is this worthwhile or would a compiler optimize the array-index access away? Or maybe subsequent uses of the same index are cached by the cpu? Does someone know?

Re:CryEngine out on GitHub by tehrei on Wednesday May 25, 2016 @09:54AM (#11769747)
That's a micro-optimisation that's absolutely worthless. Even if you do pay the cost of indexing an array every single time, that's just a single instruction to fetch the address. The compiler is absolutely capable of caching the indexing for you, either in a register or on the stack, if it deems it worthwhile.

One reason you might want to use a separate variable would be to prevent indexing mistakes, like using i instead of k by mistake in a context where i is a nested loop's counter. But apart from this and other "to make it easier on the human" reasons, there's no point in caching that in a variable. Now, if you were writing Python on the other hand...

Re:CryEngine out on GitHub by ensiferum on Wednesday May 25, 2016 @06:38AM (#11768826)
Holy batman. Now this is officially the worst piece of code I've ever seen in my 15 years of programming. This has to be generated... right?? I can't believe any human wrote this.

Grabs the eye bleach

Re:CryEngine out on GitHub by webkike on Wednesday May 25, 2016 @11:37AM (#11770513)
It was written by a highschooler who made a 3D video game with decent physics and you're... criticizing him? Man, I'd like to see what YOU wrote in highschool.
Re:CryEngine out on GitHub by PeCaN on Tuesday May 24, 2016 @08:40PM (#11766800)
On top of that, in a step function you really want to see what's being modified (that's kinda the point...). I suspect that monstrosity is easier to maintain than having state updates scattered around and having to jump to definitions and back to step() to understand the thing.
Re:CryEngine out on GitHub by saiya-jin on Tuesday May 24, 2016 @10:41AM (#11761922)
i think they don't use static code analysis on this part :)

generally agree on commenting, but it's also about discipline - method-level commands are rarely updated, but if there is some particular algorithm within method, I don't see a reason to describe it beforehand on a line or two.

General rule - if method is longer than my screen, it's time to refactor. very rarely this isn't a good idea.

Re:CryEngine out on GitHub by shermanyo on Thursday May 26, 2016 @10:06PM (#11783398)
maybe the author got a 4k monitor and set it up in portrait? :P
Re:CryEngine out on GitHub by clux on Tuesday May 24, 2016 @02:22PM (#11764183)
There are also 3 gotos in that function.
Re:CryEngine out on GitHub by khedoros on Tuesday May 24, 2016 @04:37PM (#11765257)
Goto should be used in the (admittedly rare) cases where it makes program flow cleaner. The original complaint was that people weren't moving to structured programming constructs as they became available. That really isn't a problem any more.
Re:CryEngine out on GitHub by shmerl on Tuesday May 24, 2016 @12:52PM (#11763161)
Yeah, this sort of declaration[1] (inherited from C) is horrendous and prone to nasty errors.

Consder this:

    char* p1, p2;
You could erroneously think that char* is a type, and p1 and p2 are variables of that type. That's not correct however, since p1 is indeed char*, but p2 is char. Such declarations therefore should be strongly avoided for clarity.

[1]: https://github.com/CRYTEK-CRYENGINE/CRYENGINE/blob/release/C...

Re:CryEngine out on GitHub by zanny on Tuesday May 24, 2016 @04:10PM (#11765086)
I always think it is inappropriate to type declare like char* p1 in the first place. Yes, you want to be saying "I'm declaring an 8 bit integer pointer" but since in reality the pointer declaration is bound to the name in C, you should do it everywhere.

So I always do char \p1. Yes, for a non-C programmer its not as intuitive, but C isn't intuitive a lot of the time (cough, char p1[] what?). But you avoid making these mistakes altogether.

Note in function declarations I use char, because you cannot do statement expansion with a comma there, and because in headers the variable name is optional anyway.

Re:CryEngine out on GitHub by shmerl on Tuesday May 24, 2016 @04:16PM (#11765124)
You mean

    char *p;
?

I prefer to use char* p; as well as std::string& s; and etc. rather than attaching the type syntax to the name, since in essence that's part of the type. But yes, it's a mess that this inherited C logic doesn't treat it that way clearly. To avoid such mistakes, it's better not to use comma declarations altogether, you can perfectly avoid them.

It's a good feeling when working with new languages like Rust which avoid such mess.

Re:CryEngine out on GitHub by zanny on Tuesday May 24, 2016 @04:36PM (#11765248)
Yes, the banes of markdown reap their ugly head again.

The point is, though, that while in a developers mental model you attach ref or ptr to the type, the language itself does not, and writing it out like it does can easily drive newer developers who do not understand the nuance to make hard to recognize mistakes as a result of it.

Re:CryEngine out on GitHub by fitzwatermellow on Tuesday May 24, 2016 @08:57AM (#11761145)
I actually kind of find this sort of entity data oriented code easier to grok than when everything is nicely organized into object hierarchies, like they teach you to do in school ;)
Re:CryEngine out on GitHub by fla on Tuesday May 24, 2016 @12:39PM (#11763006)
The perfect example of everything I try to avoid. I'm really surprised to see this type of coding in a triple A grade engine.

What can be the rationale behind writing this [1] ?

[1] https://github.com/CRYTEK-CRYENGINE/CRYENGINE/blob/release/C...

Re:CryEngine out on GitHub by shmerl on Tuesday May 24, 2016 @01:26PM (#11763528)
Looks like they are using some raw pointers there instead of iterators, that's why they loop like that.
Re:CryEngine out on GitHub by segfaults on Wednesday May 25, 2016 @01:04AM (#11767752)
Wow, that is a hardcore function... Have no idea what is going on there... Probably some/a lot refactoring needs to be done there.
Re:CryEngine out on GitHub by tdsamardzhiev on Wednesday May 25, 2016 @10:33AM (#11770025)
There are some parts of video games, where if the thing works, nobody would dare to call your code bad :)
Re:CryEngine out on GitHub by Derpdiherp on Tuesday May 24, 2016 @08:46AM (#11761074)
My God. I would've been panned for that in university. Break it up with meaningful comments, rip some of it out into functions where possible, if you're leaving code in source which is commented out - at least leave a comment on why it's commented out.

I suppose this is the result of deadlines and lax code reviews.

Re:CryEngine out on GitHub by stuxnet79 on Tuesday May 24, 2016 @09:01AM (#11761174)
The fact that you are using university requirements as an exemplar is very telling. The moment I graduated and started hacking away in the real world is when I discovered that there was a lawless wild-wild-west of coding conventions out there.
Re:CryEngine out on GitHub by Jeema101 on Tuesday May 24, 2016 @10:24AM (#11761743)
A mish-mash of coding conventions is understandable, given the fact that coding standards may not exist in the first place, or can change over time, etc.

Long functions which have grown over time are also understandable, given the realities of changing requirements and such.

Thousands of lines of uncommented code, however, are not understandable... in the sympathetic sense, or literally.

Re:CryEngine out on GitHub by Derpdiherp on Tuesday May 24, 2016 @09:09AM (#11761218)
Seems as you've picked up on the same thing -

"I've worked in the Games industry with age old engines, I currently work in embedded development with a code base over 10 years old - I'm fully aware of what "real life" code is like. There is no excuse for not writing well commented code - or even code with well named variables and functions that reduce the need for as much commenting. If you suffer from code like this in your workplace, perhaps actively comment it as you reach an understanding of what it does."

Relatively experienced 6 year C++ dev - I mainly mentioned university because things where much stricter - but having an environment with decent code reviews and maintaining a little self discipline goes a long way with the sanity of your co-workers.

Re:CryEngine out on GitHub by sillysaurus3 on Tuesday May 24, 2016 @09:30AM (#11761338)
You're a C++ dev, not a gamedev. They use different coding conventions. You'll find a lack of refcounted pointers, for example, whereas university teaches you to use them.

6 years is significant, but it's not a long time. There's much to learn, particularly about the cultural aspects of various segments of the industry.

This is excellent code that was produced on a tight timeline.

Re:CryEngine out on GitHub by Derpdiherp on Tuesday May 24, 2016 @09:33AM (#11761353)
I was a game dev for 3 of my 6 years. I just got sick of the layoffs after project ends - and my university tuition was in fact games development specific.

*Edit - Yes though - by no means do I think I'm some big shot know it all. But I do have strong feelings about readability after having had to deal with code which is awful to grok.

Re:CryEngine out on GitHub by sillysaurus3 on Tuesday May 24, 2016 @09:37AM (#11761372)
Fair enough. It's a valid point of view. Sorry you had to deal with layoffs. It's one of the darker aspects of the industry.

To clarify, my objection was that we're criticizing this code for superfluous reasons when it's currently a delicate political climate in most game companies to even release code like this in the first place. It's probably best not to imply their reputation should be harmed by their lack of comments, since this can discourage other game companies from releasing their code in a similar manner. I've seen the argument "it might harm our reputation" be used to block endeavors like this.

Re:CryEngine out on GitHub by Derpdiherp on Tuesday May 24, 2016 @10:10AM (#11761613)
I'd argue that a company should be able to take a little criticism - style based ones like mine will likely be ignored, as you mentioned before it's down to the culture of the company - for every function like the one outlined in the OP I'm sure there's countless examples of good style in the code base, engines are huge.

I really hope that companies don't view criticism as a negative thing, it's cause for discussion and change which are most certainly positive - I hope some bugs are found and they start to feel the benefit of the community a little.

Re:CryEngine out on GitHub by shmerl on Tuesday May 24, 2016 @05:01PM (#11765451)
What's wrong with managed pointers? Rust uses them just fine. C++11 has them natively.

Using raw pointers in C++ is rarely really needed.

Re:CryEngine out on GitHub by sillysaurus3 on Wednesday May 25, 2016 @01:18AM (#11767799)
In gamedev, using raw pointers is necessary. As a rule, game engines do not use refcounted pointers. This is because whenever you decrement a refcount, you're accessing the cache line in which the refcount resides. This results in thrashing the L1 cache, which translates into at least a 10% drop in performance. This is an unacceptable margin for game engines that fight to stay ahead of the competition.

More info on performance loss due to cache thrashing:

https://lmax-exchange.github.io/disruptor/

https://lmax-exchange.github.io/disruptor/files/Disruptor-1....

http://martinfowler.com/articles/lmax.html

http://mechanical-sympathy.blogspot.com/2011/08/disruptor-20...

And http://mechanical-sympathy.blogspot.com/ is great in general.

The reason that raw pointer management works in gamedev is because gamedev is closer to crafting than traditional programming. No one will die if a game crashes, and the iteration loop is a tight feedback cycle of code-compile-run code-compile-run.

Due to the nature of the entertainment industry, the codebase also loses much of its value within a year of releasing the game, as opposed to traditional software that typically gains value with time, meaning it's more important to get code out the door than to get it right. History is littered with the skeletons of game companies that disregarded this unfortunate truth.

Re:CryEngine out on GitHub by shermanyo on Thursday May 26, 2016 @10:35PM (#11783491)
> The reason that raw pointer management works in gamedev is because gamedev is closer to crafting than traditional programming. > No one will die if a game crashes, and the iteration loop is a tight feedback cycle of code-compile-run code-compile-run.

The more time I've spent understanding and building game engines, the more I see it as an organised network of state-machines managing and working with collections of data.

More often than not, shared state has clear ownership and lifecycle management built into the relevant state-machines. By isolating creation and destruction of resources in the transitional states (load and start a level, open a menu, change to Game Over screen), most of the code can safely reference data from other subsystems without reference counting, under the assumption that references are only valid until a global, shared transition in state.

Imagine a player entity that stores a reference to a model, texture, sound effect, input state, etc... If that data is loaded at the start of the level, and destroyed when the level ends, is there really a need to inc/dec a reference count if an enemy entity shares a sound effect reference?

Re:CryEngine out on GitHub by shmerl on Wednesday May 25, 2016 @11:17AM (#11770367)
Well, shared_ptr has its costs. What about unique_ptr though? It's not a raw pointer, but it's for transferring ownership, so it shouldn't have problems of the reference counting.
Re:CryEngine out on GitHub by sillysaurus3 on Wednesday May 25, 2016 @03:22PM (#11772375)
Ownership typically isn't transferred in a game engine, but sure.
Re:CryEngine out on GitHub by shmerl on Wednesday May 25, 2016 @04:06PM (#11772675)
Cases when different threads work on some objects passing them around aren't common?
Re:CryEngine out on GitHub by sillysaurus3 on Wednesday May 25, 2016 @04:39PM (#11772888)
They are, but in that case you'd use raw pointers.

The reason this works is because of discipline. Generally, there is a FooManager class which owns Foos. The FooManager is responsible for both allocating and deallocating Foos, regardless of where they're used. And in a game, "When should something be deallocated?" usually has a clear answer: When the level loads, for example, or when you move from one part of the continuous world to another part.

Then there are Subsystems (singletons) for each division of the engine: GraphicsSubsystem, InputSubsystem, etc.

Between those two patterns, there aren't a lot of ways to lose track of a pointer.

Re:CryEngine out on GitHub by shermanyo on Thursday May 26, 2016 @10:47PM (#11783545)
Great post, related to my thoughts above: https://news.ycombinator.com/item?id=11783491

I think another important factor is the pseudo-realtime update loop that synchronization is tied to.

Unless there is some garbage collection between game state changes (unloading unused resources during a level, etc...), its rare that references are invalidated unexpectedly, or accessed in parallel to the cleanup step between game state changes.

eg. a global state change from RUN to CLEANUP tells the subsystems to stop using a resource, so during the CLEANUP state the subsystems can safely delete any resources they have ownership of.

Re:CryEngine out on GitHub by shmerl on Wednesday May 25, 2016 @07:13PM (#11773925)
Idea of levels or areas isn't always applicable, and in vast open space games like Star Citizen or Witcher 3 with tons of random events you might need to load / free something pretty regularly I suppose, and it should happen seamlessly (i.e. if some event is triggered or passed).

So limiting lifetime of the object by some scope should work pretty well for it, and if you can pass raw pointers to transfer ownership, you can as well pass managed ones. At least it's safer.

Anyway, by using something like Rust a lot of such problems are solved by the language itself.

Re:CryEngine out on GitHub by sillysaurus3 on Wednesday May 25, 2016 @08:49PM (#11774383)
The idea of levels or areas is always applicable. A vast open game like Star Citizen is partitioned into area spaces, usually in a cubic array. When you move out of range of one of the cubes, past the point where you can see it, then all resources in that cube can be safely freed.

I don't know where Rust came from, since the discussion was about C++. But feel free to write an engine in Rust. It seems like a promising approach.

Re:CryEngine out on GitHub by shmerl on Wednesday May 25, 2016 @09:18PM (#11774520)
I hope it will happen eventually, especially with projects like this: https://github.com/tomaka/vulkano
Re:CryEngine out on GitHub by steveklabnik on Tuesday May 24, 2016 @05:37PM (#11765715)
To be clear, Rust does support refcounted pointers, but they're used very sparingly, and also have the advantage of allowing regular old pointers to their interior while remaining safe, which reduces refcount twiddling.
Re:CryEngine out on GitHub by shmerl on Tuesday May 24, 2016 @05:53PM (#11765839)
I didn't just mean refcounting, but simply managed ones (i.e. "smart" pointers), in contrast to raw pointers which require manual management.

Shared pointers (as in ref counting) is just an example of that, so I understood the above comment as implying that game development somehow encourages manual pointers management. May be I just understood the intention wrong, and it didn't mean to exclude other types.

Re:CryEngine out on GitHub by whatever_dude on Tuesday May 24, 2016 @09:57AM (#11761508)
Colleges normally stress perfect code against some theoretical metric.

Real-world work stresses getting stuff done. And in this case parts of the code can also take a life of their own.

Ideally both ideologies meet somewhere in between and you get code that works and is maintainable. But sometimes you can get bad code that is shipped... or an unhealthy obsession with polished code that never ships. One is infuriating, the other makes businesses slowly unfeasible.

Re:CryEngine out on GitHub by AlexeyBrin on Tuesday May 24, 2016 @08:59AM (#11761156)
> I suppose this is the result of deadlines and lax code reviews.

This is usually the result of years of changing/updating the code. Any living code base tends to grow and accumulates cruft over time. Just because it doesn't fit the ideal you learned in university doesn't mean it is bad code, this is real life code.

Re:CryEngine out on GitHub by Derpdiherp on Tuesday May 24, 2016 @09:04AM (#11761198)
I've worked in the Games industry with age old engines, I currently work in embedded development with a code base over 10 years old - I'm fully aware of what "real life" code is like.

There is no excuse for not writing well commented code - or even code with well named variables and functions that reduce the need for as much commenting.

If you suffer from code like this in your workplace, perhaps actively comment it as you reach an understanding of what it does.

Re:CryEngine out on GitHub by bryondowd on Tuesday May 24, 2016 @01:19PM (#11763457)
This reminded me of my last place of employment. We didn't use any form of version control system. Instead, every time we changed a piece of code, we commented out the existing code and left it there, next to our revised code, along with a START and END comment including the coder's initials, date, and the ticket or project the change related to.

Frequently changed parts of the code were a hideous mess of 90% comments to 10% code. And then occasionally we'd just rename an entire file by prepending 'old' to it and starting fresh with a new file.

That place was such a learning experience on the concept of technical debt. But at least I got a fun talking point for my resume. "x++, is that a typo?" "No, sir..."

Re:CryEngine out on GitHub by georgiev on Tuesday May 24, 2016 @08:45AM (#11761072)
That could totally fit on my screen
Re:CryEngine out on GitHub by imaginenore on Tuesday May 24, 2016 @10:05AM (#11761580)
What a wall of code without comments. Not acceptable.