Tips for a new modder?

Hi, everybody. I’m new in this forum but I’ve known it since almost forever. I wanted to ask you guys for any tips, good practices and things to have in mind for any new modder who’s just starting to explore Garry’s mod.

Specifically, I’m interested in creating a simple single-player game mode which will consist of a series of linear maps with some enemies and objectives that the players need to achieve -similar to games like Golden Eye for the N64. For this, I will need to code some game mechanics and scripts, create and add custom models for guns and characters, create entire levels, among other stuff.

I have basic knowledge of game programming, 3D modeling and self-teaching, so I think with some effort I can pull this off. What advice can you guys give to someone like me?

Thanks.

Welcome to Facepunch. You’ll find a lot of people unwilling to help newcomers; but then again there are those that will as long as you’re willing to put the effort in. Here’s a copy/paste of some useful resources.

===========================================================================

===========================================================================

Here are some resources which may help you:

The Lua manual, this will definitely help you get started!

The New Garry’s Mod Wiki, has a ton of information, how to use the function calls, how to integrate vgui elements, and more!

Not everything is on the new Garry’s Mod Wiki yet, if it’s not there, it’s here. There is a lot of things that has changed since Garry’s Mod 12, to Garry’s Mod 13. This is primarily for 12.
http://maurits.tv/data/garrysmod/wik...index4875.html

A place to hire coders:
http://www.coderhire.com

One of the best places to start, if by modifying TTT. Start by changing the sweps, more realistic fire-rates, balance the damage, add a feature which changes the cone based on if you’re moving, firing from the hip, aiming down the sights, crouching, holding the walk button, etc etc. Start small, start by doing simple things and work your way up!

===========================================================================

===========================================================================

I understand that you want to create an entire game-mode. I’d recommend against that until you’re more proficient. Start with what I typed above.

Understand the 2 realms, and the combined: Client, Shared, Server. This is VERY important. If code does not need to be shown to the client, don’t put it in a client file. Likewise, if identical code is run on client and server, put it in a shared file ( There sometimes can be some things that change which are minor, but if the main code is the same, with a few if / elses then you’re good to put it in shared. use if ( SERVER ) then or if ( CLIENT ) then for those small code bits )

Think recursively.

With Garry’s Mod Auto-Refresh capability, you can edit your code in real time and have the errors or effects show up right in front of you. This is like Python which is fantastic and why I’m actually pushing to get High-Schools to use Garry’s Mod as a development environment. It forces the developer / student to think recursively because of the way that files are loaded and how things stay in memory unless you restart the map / server.

Think recursively. This basically means that when you first start the server, everything loads into memory for the first time. When you update a file, all files in that realm will reload. So, if you create an error, or you didn’t put the load-order in the right spot and you need something, such as a global constant variable to access a meta-table, to be loaded before something is done, it will work on auto-refresh all day. But, if you changelevel you may have an error if the load-order isn’t correct.

I recommend loading ENUMS, Constants, etc first. Then functions, followed by game-logic or hooks that run.

Add me on steam, I tutor people all the time; if you want a full on tutoring experience I do charge. If you ask questions from time to time, that’s free but I may ask for a small contribution depending on the amount of time I spend. I have things to do too.

I used to teach classes for Google, I taught several boot-camps, programming, etc to High-School students.

Think recursively. Right, continuing on this, if you have the ability to think recursively, you’ll be ahead of the game in a lot of aspects of game-development.

Again, add me on Steam, I’ll be happy to help.

Here are a few downloadable resources to help you out, and a few code samples of mine, and load order things.

My game-mode uses a dynamic recursive loader. This means that using 4 lines of code, my entire game-mode loads properly each and every time, including on auto-refresh for the proper realms.


MAP_SCALE = 1;
function LoadGameMode( )
	local _sharedCount = LoadLuaDirectory( "gamemode/shared/", { recurse = true, client = true } );
	local _clientCount = LoadLuaDirectory( "gamemode/client/", { recurse = true, client_only = true } );
	local _serverCount = LoadLuaDirectory( "gamemode/server/", { recurse = true } );
	local _addonCount = LoadLuaDirectory( "gamemode/addons/", { recurse = true, client = true } ); // Addons are "shared" by default.

	PROPERTY_DB = { };
	local _contentCount = LoadLuaDirectory( "gamemode/content/", { recurse = true, client = true } );
	( GM or GAMEMODE ):SortVehicleTable( );
	MsgC( COLOR_GREEN, "GameMode loaded " .. ( _clientCount + _sharedCount + _serverCount + _addonCount + _contentCount ) .. " files!
" )
	
	local _loOutput = fileio:New( );
	_loOutput:Write( "file_structure", "Shared_Files", toprint( FILE_LOADER_SHARED_LUA_FILES ) );
	_loOutput:Write( "file_structure", "Client_Files", toprint( FILE_LOADER_CLIENT_LUA_FILES ) );
	_loOutput:Write( "file_structure", "Server_Files", toprint( FILE_LOADER_SERVER_LUA_FILES ) );
	_loOutput:Write( "file_structure", "File_Load_Order", toprint( FILE_LOADER_EXACT_LOAD_ORDER ) );
	
end
-- RunBenchmark( LoadGameMode );
LoadGameMode( );

From this code, it generates 4 files to show load-order. Here they are:
COMPLETE: https://dl.dropboxusercontent.com/u/26074909/tutoring/file_structure/File_Load_Order.txt
Separated by REALM, note that CLIENT will show things that are in SHARED, like SERVER will show things in SHARED. This is how it was designed.
https://dl.dropboxusercontent.com/u/26074909/tutoring/file_structure/Client_Files.txt
https://dl.dropboxusercontent.com/u/26074909/tutoring/file_structure/Server_Files.txt
https://dl.dropboxusercontent.com/u/26074909/tutoring/file_structure/Shared_Files.txt

Useful METATABLEs definitions: EASY, done SHARED
https://dl.dropboxusercontent.com/u/26074909/tutoring/__garrysmod_metatables.txt

First person death cam: EASY - done client-side
https://dl.dropboxusercontent.com/u/26074909/tutoring/cl_first_person_death_camera.lua

Registry output:
https://dl.dropboxusercontent.com/u/26074909/tutoring/debug_getregistry_virgin.txt

Coding methods - Try to encapsulate ideas and code them separately. If code is EVER shared between 2 or more ideas, create functions out of that code and reference the function. This saves time, file-size, networking bandwidth and more.
https://dl.dropboxusercontent.com/u/26074909/tutoring/drowning.lua

Understanding REALMS - Loading files across realms:
https://dl.dropboxusercontent.com/u/26074909/tutoring/loading_files_across_realms.lua

There are plenty more examples, and tutorials to offer. I’m working on a class-layout / class-structure / class for High-school students to take. This starts off from the most basic, set up the environment and tools to adding plugins to coding. As said, Add me on Steam if you want.

This is helpful beyond words. Thank you very much.

You know, for a second I was almost thinking of not doing this because it was a little overwhelming and I knew no one who knew any of this. But I feel more confident now. Now I know where to start. Thanks a lot :}