Home Creators Posts Import Register Favorites Logout

Content

CHAPTER 88: NGN

Daniel christened it the first day.

George had written "NGS 3D Engine" on the conference room whiteboard as the heading of the architecture diagram they were going to design that morning. Daniel erased "NGS 3D Engine" and wrote "NGN" in capital letters with an underline that scratched the marker.

"It's pronounced like engine," Daniel said. "But it's NG. New Game. NGN. The New Game Studios engine."

"It's a horrible pun," George said.

"The best technical names are horrible puns. MySQL. GNU. Git. If you're not a little embarrassed to say it out loud, it isn't memorable enough."

George looked at the whiteboard. NGN. It was short, it was recognizable, and it had the advantage that anyone who read it instantly understood what it was. Besides, Daniel had already written it in permanent marker instead of erasable, which meant the name was going to stay on the whiteboard until someone painted over it.

"NGN," George said, trying out the word. "All right. NGN."

Daniel nodded with the satisfaction of an engineer who has just named something he's going to build and who knows the name is going to last longer than the hardware it runs on.

*

George and Daniel spent the first three days in front of the whiteboard. Not programming. Designing. Because a game engine built without architecture is a house built without blueprints: it can work but it collapses when you add a second floor.

George had an advantage no one in the industry of 2005 had: he knew what game engines looked like in 2025. He knew what architectural decisions the successful engines had made and which ones had turned out to be mistakes that took years to fix. He knew that monolithic engines, where all the code was intertwined in a single block, were technical debt paid for with crunch and bugs. And he knew that modularity was the answer: independent systems that communicated through defined interfaces and that could be replaced, updated, or rewritten without affecting the others.

George drew the NGN architecture on the whiteboard as a block diagram. Each block was a module. Each line between blocks was an interface. And the rule was simple: a module could talk to another module only through its public interface. No direct calls to internal functions. No shared global variables. No shortcuts that saved time today and cost weeks tomorrow.

The modules were seven:

Renderer. The system that drew triangles on the screen. It received geometry, textures, and lighting parameters, and produced an image. It was the biggest module and the most critical: if the renderer didn't work, nothing worked.

Physics. The system that simulated reality: gravity, collisions, friction, forces. It received the position and velocity of each object and calculated its new position and velocity every frame. Everything that moved in NGN passed through Physics: the vehicles, the NPCs, the projectiles, the objects that fell.

Audio. The system that produced sound. Not only playing audio files but positioning sound sources in 3D space, calculating attenuation by distance, applying reverb according to the environment, and mixing hundreds of simultaneous sources into a stereo output.

AI. The artificial intelligence system that controlled the NPCs. Behavior routines, player detection, path-finding for navigation, and the wanted-level system that escalated the police response.

Streaming. The system that loaded and unloaded content from disk to memory in real time. The module that made an open world without loading screens possible.

Input. The system that read the player's controls and translated them into game actions. Keyboard and mouse on PC, PS2 and Xbox controllers, with a layer of abstraction that allowed the same gameplay code to work on all platforms.

Game. The game-logic module that connected everything: the missions, the dialogues, the scripts, the cutscenes, CJ's progression system. Game used the other six modules as tools and was the only module specific to Los Santos. The other six were generic: in theory, you could make any 3D game with them.

George finished the diagram on the whiteboard and stepped back to see it whole. Seven blocks connected by clean lines. The structure of an engine that was going to render an entire city.

"It's clean," Daniel said, evaluating the diagram with the eye of an engineer looking for circular dependencies and finding none. "There are no cycles. The dependencies flow in one direction. Physics doesn't depend on Renderer. Audio doesn't depend on Physics. Game depends on everyone but nobody depends on Game."

"That's the idea. If down the road we need to replace the Renderer because GPUs change, we replace the module without touching anything else. If we need to rewrite Physics for the next generation of consoles, we rewrite the module and the rest stays the same."

"That's design for ten years."

"It's design for twenty," George said, and it was true in a sense Daniel couldn't know: George had seen engines that followed the same principle of modularity work for two decades with incremental updates.

*

George assigned the modules. Daniel led Physics and Streaming, because both were low-level engineering problems that required the obsession with optimization Daniel had in his DNA. The four new programmers split into two pairs: one pair worked on AI under George's supervision, and the other on Audio with Lena as a requirements consultant. Alex led Input and the platform systems.

George kept Renderer.

He chose it because it was the module where his knowledge of the future was most valuable. George knew how the renderers of 2024 worked: deferred rendering, physically based rendering, ray tracing, global illumination. None of those techniques was possible on the hardware of 2005. But the principles behind them were applicable, and a renderer designed with those principles in mind could evolve toward those techniques when the hardware allowed.

NGN used OpenGL as the graphics API on PC and a proprietary wrapper that translated the OpenGL calls to the native APIs of PS2 and Xbox. The wrapper was Daniel's work: a layer of abstraction that allowed the renderer code to be the same on all platforms and that left the wrapper to handle the differences. Writing the wrapper would take months. But the result was that any improvement in the renderer automatically benefited all three platforms.

The rendering pipeline was the sequence of steps that converted a 3D scene into a 2D image on the screen. George designed it with five steps:

First: culling. Determine which objects were visible to the camera and discard the rest. Frustum culling to eliminate everything outside the field of view. Occlusion culling to eliminate what was behind other objects. The goal was to reduce the amount of geometry the renderer had to process before processing a single triangle.

Second: sorting. Organize the visible objects by material and by distance. Rendering objects with the same material together was more efficient than constantly changing material, because each material change required the GPU to reconfigure its state. Sorting reduced the state changes and improved performance.

Third: geometry. Send the vertices of each object to the GPU to transform them from model space to screen space. Each vertex passed through a transformation matrix that moved, rotated, and scaled it, and then through the projection matrix that converted it from 3D to 2D.

Fourth: lighting. Calculate how the light affected each surface. George implemented a lighting model with three components: ambient (the base light that lit everything uniformly), diffuse (the light that bounced off surfaces according to their angle with the source), and specular (the pinpoint highlight that appeared on reflective surfaces). Each light source contributed all three components, and the result was the sum of all the sources.

Fifth: output. Write the final pixels to the framebuffer for the screen to display. With optional post-processing: bloom (glow that spreads around intense light sources), fog (mist that darkened distant objects), and color grading (adjustment of the colors of the whole image to give it the visual tone Marcus wanted).

Five steps. Each one with dozens of sub-steps. Each sub-step optimizable. The complete pipeline had to run 30 times per second on the weakest platform (PS2) and 60 on the strongest (high-end PC). Every millisecond counted.

*

The first triangle of NGN appeared on screen on February 14, 2005.

It was a white equilateral triangle on a black background, rendered by the basic pipeline with no textures, no lighting, nothing except three vertices transformed from 3D space to screen space. It was the minimum the renderer could produce. And it was the proof that it worked.

George looked at the triangle on his monitor screen at eleven in the morning on a Friday in February. Daniel was beside him. The four new programmers were behind him, looking over his shoulders. The triangle was white, flat, and completely insignificant to anyone who didn't understand what it represented.

For someone who understood it, that triangle was the Big Bang of NGN. Every image the engine would produce, every building of Los Santos, every vehicle, every NPC, every leaf of every palm tree, was going to be made of triangles like that one. Millions of triangles. And this was the first.

Daniel gave it a name. Because Daniel gave everything a name.

"Triangle One," Daniel said. "The grandfather of all the polygons of Los Santos."

Marcus came over to look.

"It's ugly," Marcus said, looking at the white triangle on the black background with the expression of an artist who evaluates something and finds it doesn't measure up.

"It's a triangle, Marcus. It's three vertices."

"My first sprites were also three pixels and they were less ugly than that."

"Your first sprites didn't render in a three-dimensional space with coordinate transformation and perspective projection."

"No, but they had color."

George laughed. And then he gave the triangle color: red, green, and blue, one vertex of each color, with color interpolation between the vertices that produced a smooth gradient filling the surface of the triangle with the most basic rainbow possible. It was ugly. But it was ugly in 3D with interpolated lighting, which was more than the engines of Castlevania, Isaac, and Hollow Knight combined could do.

The first triangle of NGN stayed on George's screen for the rest of the day. The employees came by his desk, looked at the colored triangle, and the reaction was always the same: a pause of evaluation followed by the understanding that that insignificant triangle was the beginning of a city.

*

George programmed NGN with a speed that disconcerted the new programmers.

He made decisions faster than anyone, even though he wrote code at the same speed as the rest. When the programmers faced a design problem, George had the answer before they finished formulating the question. He had already seen the answer. In another life. In another engine. In a future these programmers didn't know.

The programmer from EA asked how to handle texture memory when the streaming loaded a new chunk that needed textures that were already in memory for another chunk. George described to him a reference-counting system with a pool of shared textures that kept each texture in memory as long as at least one chunk needed it and freed it when the last chunk that used it was unloaded. It was a standard solution in 2020. In 2005, the EA programmer looked at it as if George had invented something.

The programmer from LucasArts asked how to avoid the visual artifacts when two objects were at the same distance from the camera and the renderer didn't know which to draw on top of the other. George described to him a per-material depth offset that added an imperceptible bias to the Z-buffer of certain materials, resolving the z-fighting at no visual cost. It was a technique documented in the SIGGRAPH papers of 2008. In 2005, it was magic.

George didn't explain where the solutions came from. He couldn't. He said "I read it in a paper" or "I saw it in a previous project" and the programmers nodded because George was the director and because the solutions worked and because questioning where a solution that worked came from was a waste of time no engineer made twice.

Daniel was the only one who noticed the pattern. Without suspecting anything concrete, he had spent five years working with George and had developed an intuition for the moments where George knew something he shouldn't know.

"Where did you read the thing about texture reference counting?" Daniel asked him one Friday at six in the evening, when the office was emptying and the conversations became more honest.

"In a paper on memory management for streaming engines."

"From what year?"

"I don't remember."

"Because I didn't find it searching. And I searched."

George looked at Daniel. Daniel was looking at him with the curiosity of an engineer who has found a fact that doesn't add up and who wants to understand why.

"There are things I know that I can't explain where they come from," George said, with the partial honesty he had perfected over seven years of carrying a secret he couldn't reveal. "Sometimes I see a problem and the solution appears complete, as if I had implemented it before. I don't know why. I just know it works."

Daniel evaluated him for a moment. Then he nodded.

"If it works, it works. I don't need to know where it comes from."

It was the answer George needed. And it was the reason Daniel was the person George could work with for years without the distance between what he knew and what he could say becoming a problem.

*

By the end of February, NGN could render more than a triangle.

It could render a cube. With six faces, each composed of two triangles, textured with a test image that was the photo with the owl glasses that someone had taken at the Christmas party and that Daniel had turned into a debug texture because it made the office laugh every time it appeared on screen.

The cube rotated in the center of the screen with lighting from a single directional light source that cast shadows calculated by shadow map. The faces that faced the light were bright. The ones that faced the other way were dark. And the cube's shadow was cast on a plane below it, deformed by the perspective, with the edges softened by the PCF filter George had implemented.

It was a cube with a photo of Marcus spinning and casting shadows. It wasn't Los Santos. It didn't look like Los Santos. But it was the demonstration that NGN could do the three things every 3D engine needed to do: geometry, textures, and lighting. Everything else was scale.

Marcus looked at the cube that bore his face and said:

"I prefer the triangle."

*

George looked at the to-do list of NGN that he had stuck on the wall next to his monitor. Each task was a system the engine needed for Los Santos to exist:

Lighting with multiple sources. Higher-resolution shadow maps. Chunk streaming. LOD with cross-fading. Occlusion culling. Day/night cycle. Weather system. Vehicle physics. Ragdoll and skeletal animation. Orbital camera with collision. NPC AI with path-finding. 3D positional audio. Post-processing: bloom, fog, color grading.

Thirteen systems. Each one with weeks or months of work. Each one dependent on the others in ways the whiteboard diagram anticipated but that the implementation was going to reveal with the cruelty of the bugs that only appear when two systems that work on their own stop working together.

George looked at the colored triangle still open in a window on his monitor. The first polygon of NGN. The grandfather of the millions that would come.

Six years earlier, George had programmed the first sprite of Alucard in a Fulton Street apartment with a Pentium II and the certainty that he knew what he was doing. Now he programmed the first triangle of NGN in a Townsend Street office with thirty people and fifteen million dollars and the same certainty, multiplied by six years of experience and three successful games and the deep understanding that the difference between a triangle and a city was patience, not complexity.

Building Los Santos was going to require the same patience as building Castlevania, Isaac, and Hollow Knight. Only multiplied by a scale no previous NGS game had attempted. Each system of the engine was a chapter of a technical story George was going to write over the next few months, line of code by line of code, triangle by triangle, until the city existed.

The triangle looked at him from the screen. White, red, green, blue. The embryo of a world.

George closed the window. He opened the code editor. And he started programming the lighting system with multiple light sources, because a city needed more than one sun to exist.

End of Chapter 88

Comments

No comments found for this post.