r/Sourceengine2 • • Nov 04 '15
Since Source 2 is 64-bit, meaning that reaching the map limit is near impossible, will it be more or less practical/faster loading to make, say the entire HL2 campaign maps into a single large map?
15
Upvotes
25
u/CrystalMazda Nov 13 '15 edited Nov 13 '15
The map limit has never been the problem, it has to deal with how the source engine renders 3 Dimensional Space.
Below someone mentioned all of this seeming odd coming from a background in unreal engine. This is because Source 1 is a heavily modified version of the quake 1 engine that still uses the exact same rendering technique. Explained as simply as possible, levels in both quake and Source represent the interior of an enclosed space. This is done so 3D terrain can be drawn with limited 3D rendering capability, particularly in Quake and Goldsrc. Source has added many GPU features since then, but fundamental terrain drawing is still done via the Quake method. This is the exact opposite of how the unreal engine works. Unreal is a later engine that had access to better hardware when it was being designed. Quake and Source work on the principle of the character NEVER having infinite vision in one direction, their view ALWAYS being blocked by some wall, and the levels consisting of walls (or brushes in engine terms) that the player is enclosed inside of. If you're outside in Source, it's just a big room with "SKYBOX" set to the ceiling texture.
So still, it sounds like the only problem is that absolute distance that the walls of the map can't exceed right? Wrong. In a lot of engines, the amount of surface space you're rendering is what eats up your performance. In source, large open areas eat performance. Because of this, almost all large areas in source games are either rectangular and hallway shaped (think the beach in HL2), or completely faked by using 3D skyboxes to render tiny miniature buildings as 16 times as large as they actually are in the game (which saves on space because as someone else mentioned size in Source is absolute).
The versions of the engine used in Portal 2, L4D2, and Dota 2 show significant improvements to these things by finally adding things like real weather effects and actual multicore rendering, up to that point though it's not entirely wrong to think of almost all valve games as a series of increasingly creative quake mods with source code modification being seemingly minimal and changes being mostly based on increasing support for better models, textures, and phsyics.
Valve is known as a network infrastructure, underrated visual artist's, and level designer's company in the industry because that's what they're best at. They were (up to this point) not a studio that produced cutting edge engines, but a studio with excellent talent in other parts of development that made up for their very dated engine. The exact opposite of id games for example.
Hopefully, Source 2 has improved a lot of this a significant amount, we'll find out as more and more games use it.
Don't take these things as an indictment because of my tone either, Valve's obsession with rendering things that same original quake way is why they've always been huge in internet cafes with lower spec machines outside of America. It's a clear part of their strategy, and it works.
10
u/moonshineTheleocat Nov 23 '15 edited Nov 23 '15
From a Computer Science major with experience in low level graphics programming... 32bit never actually caused a limit in world size. Morrowind, most of GTAs, and even Skyrim were built to support large worlds on 32bit machines.
In fact, the world size thing is actually just an issue with the graphics hardware. I can't remember exactly for directx, but OpenGL is limited to 32bits. From that alone, I can assume that DX does the same thing because it's faster for the hardware to read data at natural word, than having to compensate for a double.
The way that developers get around that 32bit limit for both the cpu and the gpu, is through a trick in vector math that uses a frame of reference.
When you create a world, you do not actually have it stored in memory as one very large world with some number traveling indefinitely outwards from the origin. You instead have it broken up into smaller chunks, then laced together into multiple "View Spaces". Each chunk of the world has it's own origin, then a limited distance from the origin in every axis. For mathmatical reasons, we create a world space, but this isn't typically stored for long. It's usually just calculated back down to the chunk that it's in.
For rendering, we create a "Camera-View Space" where the origin is the camera's position before sending it to the hardware. This is how we achieve the illusion of large worlds on weaker machines.
No the deal with Source 2 being 64bit, is mostly to do with how fast we can compute larger pools of data, and how much more memory we can use.
So... lets start with memory. You have Heap, Instruction Space, and Stack. Those are your major components. With Windows 32bit, your program is technically allowed to use 4gigs. But this is unrealistic. Windows reserves a good chunk of memory for it's self, plus some video memory from your hardware. Linux and Mac OS do this too. You're now down to 3gigs. But... not really. Background programs tend to eat up another gig, or so. So... 2 gigs. This is also not entirely true. If you start hitting the limit of your ram, you run into performance problems on PC. RAM access is very finicky. When a program needs more, it does not dynamically grow. It's basically duplicated into a larger block of code, then have it's old data deleted. How it does this is dependent on the OS. But windows tries to keep everything in contiguous blocks if I remember correctly. So... while your instruction space never changes. Your Stack and Heap can actually grow. Stack is typically predicted and kept static, this is how the program runs functions it pulls from the instruction space. Your heap however, is where all your program's data is stored. That grows very rapidly. OSes used to just duplicate the Heap into a larger slot. But they stopped doing that, because it's faster to access if data is not scattered.
As for 64bit's benefits. Not a lot of games actually started using it, other than for memory reasons. Typically, when data is created in 32bit, you get a 32bit(4 bytes) piece of that item. If you create something in 64bit, you get an item that uses 64bits (8bytes), but can cover more ground, and can read larger data types faster.
In games, you don't actually see anything like this. Games are typically made to go across 32bits and 64bit machines effectively without worrying about data transition problems. So when programming... programmers typically uses hard defined 8bit, 16bit, 32bits, and 64bit data types in a single program.
When it comes to memory performance... 64bit machines are more common than 32bits now. If we run a 32bit program on a 64bit machine, you can run into a possible performance problem. Again... the two's word size is completely different. Plus how the way bits are read is completely different (not explaining that). 64bit machines are meant to read 64bit data types. Just as 32bits are meant to read 32bit data types. When you try to align data for a 32bit program on a 64bit machine, you tend to run into a lot of waste.
On a side note. The Source Engine that made Half-life 2, and Portal games COULD be used to make an open world game. But it's level and lighting system needs a complete rewrite to support such a thing. That's the MAIN reason why source engine couldn't support open world games. Most of the enviorment is built from BSP brushes.
BSPs are a very fast, but limited data structure for 3d Worlds. It's meant for halway like worlds, where the path is predictable enough to cull large pieces of the world without much effort.
The lighting system is all baked. So it's graphically more realistic than other games of it's time... but you can't move anything that was static, or you break it.
And the way levels are packed... they already take five years of sundays for simple levels. I don't know what the algorithm is... but if you put that on an open world, you're gonna have some problems.
6
u/[deleted] Nov 05 '15
Much more practical assuming source 2 also improves optimizations. Dynamic loading of areas would likely be included.
6
u/[deleted] Nov 05 '15
It seems most modern engines support level streaming so I'd be surprised if that wasn't a feature of Source 2.
3
u/AntonioHipster Mar 19 '16 edited Mar 19 '16
If Source 2 have level streaming, then it's possible to make "big" maps. It's still good idea to split them in editor, to make editing easier. It would be very hard to make a map that have 100.000+ objects in it (to find stuff in world outliner)
4
u/Jobbobbo Nov 05 '15 edited Nov 05 '15
I've never worked with Source 1, but I've actually never really understood this "max map size" thing. Knowing you can scale down any object in the map, doesn't that already make the map size nearly infinite?
Isn't "map size" a completely subjective/abstract concept in the first place? I can put a sphere in my world and give it a radius of '1' and say it's an entire planet.