Q: Uhh, wait what? I think you missed the gamemode forum.
Nope, not a gamemode. This is an addon that can be run with any gamemode.
Q: Didn’t Q42 do something like this?
He did, Spacebox. Spacebox was very cluttered though and used the same system for determining gravity than Spacebuild does. SimpleSpace uses a different way, it has none of the lag, none of the FPS drops, and is altogether much easier to develop with.
Q: Yeah, that’s easy to say, but can you actually demonstrate that yours is much better?
I sure can.
Let’s start by saying that you only have to put the addon in the addons folder for it to work, and it will automatically start up on any map with SB entities. Contrary to Spacebuild, there’s not a million and one things you have to do to get to space, and you can concentrate more in doing cool stuff in space than spending an hour wiring up your contraption with all sorts of spazzy, laggy crap.
You’re free to run any addon or gamemode you want with it, so doing RP in space, for example, is as simple as throwing this nifty script in and running your preferred RP base. The code is written on simple terms, no complex math is used, and everything is properly scoped so variable names don’t clash.
Yeah, well, in a way, I’m not adding anything new on the field, Spacebuild and this addon do precisely the same thing. The true issue is just how they do it. I’m gonna go ahead and explain the difference.
-My way: Get all entities within planets, using ents.GetInSphere, apply gravity on them. Disable gravity on all others, cycle this every tenth of a second.
-Their way: Get all entities, cycle through them, get the distance between this entity and every single planet, check if the distance is smaller than the radius of the planet, if it is, apply gravity.
True, ents.GetInSphere does do something similar to getting the distance between each prop, but it’s ran on engine level, it’s a C++ function, so it’s much faster than running it on Lua. The reason why lag increases so much every time a prop is spawned using Spacebuild is because, if let’s say you got 7 planets, you are running 7 vector distance calculations ( A very computationally expensive operation, I might add), per entity, every 1/60th of a second.
In a nutshell, the amounts of math the computer has to do in Spacebuild increases as the prop count rises. In Simplespace, the amount of math remains constant. On top of that, it is very network efficient, the only networked variable there is, is a single boolean per player, which is by the way the only network variable you’ll see on the subsequent additions to the system.
Q: Wow, alright. So, what if I want to use this for my gamemode?
Well, if you’re gonna distribute it with SimpleSpace, please be kind and put some credits. If it’s private though, feel free to modify and use the hell out of it, that’s what I made it for.
ToggleSimpleSpace - Turns SimpleSpace on and off
ToggleSpaceNoclip - Is moclip while on space allowed?
ToggleAdminNoclip - Only admins can noclip while in space.
TogglePlayerGravity - Should the gravity system affect players?