Spacebuild Mapping

From GMod Wiki

Jump to: navigation, search

Back to Gamemode mapping

All credit to whoever wrote this! You can download the origional document, along with all files mentioned [at GarrysMod.org]



This is a more advanced how-to for Shanjaq's SB dev kit that I hope is more user friendly to those Hammer newbies out there. You'll still need the sky-box and planet prefabs from the dev kit though. These are just some better instructions. ;)


Creating the base of your planet

  1. Open the planet prefab for the size of planet you want.
    Generally, unless you're only going to have about 3 or 4 planets on the map, or want to make a really realistic giant planet, don't use the largest size. The smallest is pretty, well, small, and is really only good for moons you're just adding in for detail.
    I would stick with the 3 sizes above smallest. This prefab will serve as your landscape.
  2. Pick out a material (Preferably one of the 'blend' materials) and make your landscape like you would any displacement.
    Remember to use the select tool at the displacement options screen to only pick out the top 6 surface pieces.
    If you just select the whole thing and start going to town with your tools, you'll soon find the bottom side of your landscape will end up being accidentally edited a bit, which we don't want. We don't even use that side.
  3. Remember to do some alpha painting too if you used a 'blend' material, that way you don't have one bland, repeating texture all over your planet.
    I also suggest using the 'DW' button (Display Walkable) near the top of the Hammer screen to see what hills and cliffs can be, well, walked up.
    I generally tried to keep everything as steep as I could while keeping it traversal so players wouldn't have to fight just to get up a hill.
    Note: gravity will affect the ability for players to walk up on slopes.

There aren't many limitations to your terrain here. Just don't make anything super high or low so that it'll end up sticking out of the planetary sphere. When you finish your landscape, set your displacement tool to 'Raise To' and set that to 0, then edit all the edges of your landscape. If you accidentally raised the edges during landscaping, this will lower it back down to the original level so you don't have any odd terrain sticking up. Add anything else you desire here too (Water, walls, buildings, plants, ect.), and basically just try to be as elaborate and creative as you can while still giving players enough space to build a base of some sort. Func_smokevolumes and trigger_hurts can add some cool gas clouds or used to make stuff like acid water work. Just remember to texture the brushes properly (Like the trigger texture for triggers or the invisible texture for smokevolumes and such).


Ledges

  1. Make a cylinder with nodraw texture the same size of your landscape and with 12 faces (Since the prefabs have 12 too, but if you're good enough to make your own 20-sided landscapes or whatever, make a 20-sided cylinder).
  2. Make the cylinder at least 128 units high and move it out of the way for ease of use.
  3. Copy the cylinder and shrink it by 32 units on all sides in the top-down view (In other words, don't shrink it using the side views).
    You're about to commit a mortal sin of map-making: You are about to carve.
  4. Move the smaller cylinder to where the larger is (Line their centers up), select the larger cylinder (Hold Ctrl, if you somehow don't know how to select two brushes at the same time) and hit Carve.
  5. Delete the smaller cylinder, and you should have a ring 128 units high with 32 unit-sized edges.
  6. Move this to your landscape (Line up centers again) and you should then have a nice barrier to stop people from accidentally running off the edge of the planet.
    Note: Be careful if you're making a low-gravity planet or one with large hills around the edges, because then you might still be having people accidentally sprinting off the edge.
  7. Just make the cylinder a bit higher if you're worried about it, but otherwise you can ignore it and get a few laughs out of people flying off into space.
  8. Remember to make your barrier a func_detail too, that way you don't have to waste any bit of memory in the game trying to figure out if you can see past an otherwise INVISIBLE brush or not.


Making the Atmosphere

  1. At the exact center of your planet, make a logic_case entity.
    This is used by the gamemode to determine what your planet is like.
    You don't need to name it unless you're doing some really fancy trigger stuff or something, so don't bother.
    You have 16 cases in a logic_case.
  2. The first case is always "planet" (Without quotes, of course).
  3. The second case is the RADIUS of your planet. Why did I capitalize radius? Because if you happened to miss a few math classes, you might forget that radius is HALF the diameter. So, if your planet is 3000 units large, your second case should read "1500". It's basic math: take the length of your landscape, and divide by 2. That's it.
  4. The third case is gravity. "1" is standard Earth gravity. "4" makes it almost impossible to even jump. "0.2" makes it so jumping isn't really such a good idea sometimes; you might fly off the edge of the planet above the barrier.
    This does not determine if a planet will crush you or not (At least to my knowledge, a gravity of "10" might do it or something, but I doubt it); it only determines gravity on that planet.
    Note: At lower gravities, it is easier to walk up hills or mountains, such as those usually too steep to climb at "1" gravity.
  5. The fourth case is atmospheric pressure.
    In case you missed some science classes too, atmospheric pressure is the pressure of all the air pressing on your body.
    Basically, the thicker the atmosphere, the higher the pressure. "1" is standard Earth pressure. Anything above "1" will make the planet crushing, so watch out.
    The higher the pressure, the more energy wind generators gain (I think). Otherwise, this option doesn't do much. Keep note that crushing planets get really annoying after a while, so use them sparingly.
  6. The fifth case is temperature in Kelvin degrees when in open sunlight.
    Since you never hear a weather man saying it's "290 Degrees Kelvin", you might have to do some formulating to go from whatever temperature you're used to to Kelvin.
    See the Wiki article for details and stuff (http://en.wikipedia.org/wiki/Kelvin).
    "288" is the standard temperature of Earth. Generally, if you go higher than "300", players will start feeling burn damage.
    More heat, more damage. If you're trying to make a desert planet that doesn't instantly fry a player, go around "320" or so, maybe higher.
    Usually, between that and "300", you'll suffer damage, but not enough to really do anything more than shake the player's view. Below "250" does the same, except it freezes. Space has a temperature of "14".
    If you're making a planet with a burning sun, make this case really high, just to stay consistent.
  7. The sixth case is temperature in the shade. This is basically the same exact thing as above, just, well, you can guess how it's different.
    On a burning sun planet, make this value very low (Mercury uses "90"), because it's basically the same thing as night in the desert; no sun = very cold.
    Of course you can be radical and make this whatever you want, but for a Mercury type planet, make it low.
  8. All of the cases from 7 to 13 are unused (For now). Don't put anything in them.
  9. Cases 14 and 15 are special, and only used for planets with earthquakes. I'll detail their usage later along with how to make earthquakes.
  10. The 16th case is planetary flags. These tell the gamemode special stuff about the planets:
  • "1" means a planet is habitable, that is, players don't need air exchangers (Temperature determines if you need a heat exchanger though).
  • "2" is a flag for earthquakes. These do not make the quakes themselves, and again, I will detail them later.
  • "4" makes the planet a burning sun planet, where if a player is not shaded, they will suffer burn damage.
    Annoying at times, but unique enough to make it worth it.
Note:If you want to have a planet with multiple flags, simply add the numbers together. For example, a planet with both quakes and a burning sun would have a flag "6" (4 + 2). If a planet has none of these features, then it will have a flag of "0".


Night & Day Cycle

This step can be skipped only if you're making a planet without a sky that can cycle between day and night. It's a very nice addition to virtually any planet, and the cycles are just plain cool. Of course, using any dynamic light will make the sky turn completely white, so keep that in mind if you're using them on your planet, for some random reason...Normal lights don't effect the sky, however.

First things first, move your landscape, barrier, and anything else you have out of the way. For ease, group them so you can move them all back later. Make a spike with the nodraw texture with the same number sides, length, width, and a height half the length (So a 3000 unit sized landscape would need a spike 3000 long, 3000 wide, and 1500 units tall) and center it so that the bottom edges of the spike meet the top edges of where the nodraw barrier would be.

Copy the spike and center back where the original is, and shrink down its sides and top by 32 units (You can actually leave your barrier where it was originally with the sikes, and simply shrink the smaller spike so that its bottom edges meet the top, inner edge of the barrier. If for some reason your barrier's sides aren't 32 units wide, you might want to use this method). Time for another mortal sin: select the larger spike, hit carve, and delete the smaller spike. You should know have a hollowed-out spike. Had you left your landscape and such here, it may have all gotten deleted durring the carve for who know's what fucking reason. Anyways, you can move it back now.

Now browse your textures until you find that fake sky white texture, and color the inside of your spike with it (Leave all the other sides and bottom as nodraw). Copy your old nodraw barrier you made and texture the inner sides of your copy with the same fake sky white texture, and move it back to where the nodraw barrier is. Select both the hollow spike and the new barrier you made and make them both a func_illusionary. This makes them nonsolid so people won't collide into them. The sky isn't solid, fuckwits.

Just for your information, we don't make the sky spike level with the edge of the ground, because then you'd have the edges of it near the end of the landscape not entirely covering the area, and people might even be able to walk through it and see space, which isn't very realistic at all when we've got a nice blue sky there (Kinda hard to fully explain, but it's crappy nonetheless, rest assured). The copied barrier is there to stop this and raise the spike up.

Name the sky anything you can easily recognize for later, and set its render mode to Additive. "FX Amount" is how much you can see through the sky. "255" is solid color with nothing being able to be seen behind it. Earth has "254" which lets you see just the slightest bit. A planet with "250" would show you a good outline of anything in space, and the lower you go from there, the less actual sky you see. Set everything to how it'll look during the day.

"FX Color" is, well, the color of your sky. Since it's additive, it will look slightly different in-game than what you set it in Hammer, generally lighter. You can easily set it to whatever color you want with a very easy to use pallet, so there's not much trouble for you here. Disable shadows and receiving shows too, for both the spike and the barrier. And that's it for making the actual sky. Please note: do NOT move the spike, nor should you resize it later. If you want to do either, delete the spike and remake it how you want it. If you move the spike, Hammer, in all it's stupidity, will fuck it up next time you load the map again, or if you compile, usually taking off a whole side and making it look generally crappy in-game even if it doesn't slice it up. Just don't do it.

Next, make two logic_timers, named "*whatever*_night" and "*whatever*_day". Edit the night case with a "Start Disabled" option of "No", and a "Refire interval" of "300", or really, whatever you want. If you want shorter days, make it a smaller number. "300" is the refire time for Earth. Now comes the tedious part. First, give it about 12 outputs, all of them named "OnTimer" and sending outputs to whatever you named your sky spike and sky barrier, via the input "Alpha". Give the first one a "Parameter" of "230" (Or basically, take the "FX Amount" you set for your sky earlier and subtract it by 20 and round a bit. Since I'm doing this for a sky with 254...), and give it no delay. The second output should have about a "Parameter" 20 less than the first, and should activate after a delay of 0.25 seconds. The third should have 20 less than the second, and fire 0.25 seconds after the second as well. Continue this pattern until you take the alpha to about 10, which is clear night sky. On Earth, with 12 outputs, the transition to night takes 2.75 seconds.

Add two more outputs, one of them disabling the night timer (After no delay and with an output named "OnTimer", of course), and the second enabling the day timer you made earlier, similarly. Now go to your day timer and repeat the process, except, of course, change all the names, and increase the alpha back to the original state you set for your spike instead of decreasing it, all in a similar manner. Also make it so that it starts Disabled. You can even just copy your night timer and edit the alpha parameters and the names and get the same thing.

And that's it. After 300 (Or whatever) seconds, your sky should automatically cycle. Probably the most tedious step of them all.


Making a sky

Pretty easy here. Make a sphere with the same amount of sides, same length, width, and twice the height of your spike (So using our 3000 planet, it'd be 3000x3000x3000). Now, before creating it, expand the sphere on all sides by 32 units (If your spike sticks up out of your sphere after this, increase the height equally along the bottom and top until the sphere covers it). This is done so that old nodraw barrier and top of the spike don't stick out. Especially that nodraw barrier, which blocks light and will cast an odd ring of shadows all along your sphere otherwise. Very stupid to look at.

Whatever you texture your sphere with, make sure to scale the texture up to around 1.05, so that it won't be all scrunched up and fugly. Next, tie your sphere to a func_illusionary like you did your spike, and disable shadows and receiving shadows too. If you want your material to be a bit colored (Say, make a snow planet look a bit bluer) then you can use the same method you used to change the color of the spike (Keep "FX Amount" at 255!) and just set the "Render Mode" to "Color".

Like the spike, do NOT move the sphere. Again, it will degenerate, but instead of just losing sides or something, it'll end up looking like it was stretched and hacked apart. If you're not sure if your spike or sphere have degenerated or not, simply reload your map in Hammer and look. It may not be easily seen in the 2D views at first, but even minor errors with the spheres can be seen in the 3D view if you select it first. Hammer is a piece of shit at times.


Music and sounds

This is a totally optional step, but if you want some music to be played when any player reaches a planet for the first time, here's how. First, place an ambient_generic entity anywhere in your map (It'll work anywhere, but for ease, I suggest keeping it next to your logic_case). Name it something you can recognize and give it a fitting sound. A lot of sounds, especially music, can't be played in Hammer, but generally, 'stinger' songs should do well, since they're short, and definitely give a dark (Sometimes), mysterious feeling. There are plenty of other good choices too. Next, look under the Flags tab for the ambient_generic and check all the boxes, if they aren't already.

Next, make a block with the trigger texture around your landscape. It should be fairly large and tall so that players won't have to hit some small portion of your planet to trigger the music, nor should it stick out of the planetary sphere so much so that passers-by or people who are still in orbit don't trigger it. Tie the brush to an entity (Ctrl + T) and set it to a trigger_once. Give it an output named "OnTrigger" that toggles the ambient_generic you named earlier (I use ToggleSound to trigger the music, but PlaySound might do just as well, I can't remember). It doesn't have any other parameters, there's really no need to give a delay, and since it's a trigger_once, you don't even need to check that "Fire once only" box. Lastly, just go to the Flags tab of the trigger and set it to basically anything you want. If you want unmanned probes and such to activate the music, you might want to check the proper boxes.


Congratulations

And that's it. It seems like a long-winded process just to make one planet, but as with all maps, time generally equals quality. And of course, some simpler planets will let you skip some steps, too. After one or two planets, you'll get a good feel for it and be able to do more with ease and a little bit of time. Just try not to limit yourself to just making terrain for your planet; add alien artifacts, volcanos, lakes, anything you think would be awesome, because when you release, everyone will probably be thinking the same. Go wild, try something new, and don't be afraid to ask for help. I sure needed a lot of it, half the time.

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox