Help Coding Role Play Gamemode

Long Read
I have been playing DarkRP and own my own server for it, but that is not the point. Besides the fact that i got annoyed at all of the bugs i have found. So i have decided to make my own gamemode similar to DarkRP i guess you could say, but more realistic and very detailed. I’m not going to get into to much detail of what i would like to add but i need help setting the basics up, since i have some decent experience in Lua coding. I would like to know where to really begin, i like the job layout that DarkRP has and how it is extremely easy to edit and add custom things to it. I do not want to copy it exactly but i am looking for my gamemode to have some extremely realistic like applying for jobs and literal “Go to a booth and vote” type of feel. If i could get some help/links to developing a Role Play gamemode, and/or some info on how or if i could do something similar to DarkRP with the shared file from DarkRP**
Short Read**
I need help/links on how i can code a Role Play gamemode like DarkRP and easy to edit for people wishing to have special jobs/abilities on their server. And how can i make the “Jobs” file like DarkRP’s file since theirs is easy to edit. And no it is not going to be anything like DarkRP besides the fact it is going to have jobs.

Any help/Links would be great and very useful, thanks
**
NOTE::** Yeah, i know. We totally want another DarkRP type gamemode, let alone another RP gamemode.

Start from a skeleton game-mode, and code what you want. I’d recommend setting up client/shared/server directories to keep things organized, and maybe use an auto/recursive loader to load the files and automatically AddCSLua for the client/shared on the server, then include it on the client.

To me, that’s a solid start. It’s how I designed my dev-server. This isn’t everything, but it’s how I have mine laid out:

init.lua
[lua]//
//
//
AddCSLuaFile( “sh_init.lua” )
AddCSLuaFile( “cl_init.lua” )
include( “sh_init.lua” );[/lua]

cl_init.lua
[lua]//
//
//
include( “sh_init.lua” );[/lua]

sh_init.lua
[lua]//
// The guts to the auto-loader, feel free to design something based off my layout.
//
– function LoadLuaDirectory( folder, isClientFile, isClientOnlyFile ) – Not giving everything out, but you should be able to figure something like this out. My system isn’t “recursive” because I want to control load order.

//
// Shared and core functionality
//
LoadLuaDirectory( “gamemode/shared/definitions/”, true );
LoadLuaDirectory( “gamemode/shared/core/”, true );
LoadLuaDirectory( “gamemode/shared/”, true );
LoadLuaDirectory( “gamemode/shared/entity/”, true );
LoadLuaDirectory( “gamemode/shared/vehicle/”, true );
LoadLuaDirectory( “gamemode/shared/player/”, true );

//
// NET CODE
//
LoadLuaDirectory( “gamemode/shared/net/”, true );
LoadLuaDirectory( “gamemode/server/net/”, false );
LoadLuaDirectory( “gamemode/client/net/”, true, true );

//
// Client
//
LoadLuaDirectory( “gamemode/client/”, true, true );
LoadLuaDirectory( “gamemode/client/gui/”, true, true );
LoadLuaDirectory( “gamemode/client/entity/”, true, true );
LoadLuaDirectory( “gamemode/client/vehicle/”, true, true );
LoadLuaDirectory( “gamemode/client/player/”, true, true );

//
// Server stuff
//
LoadLuaDirectory( “gamemode/server/”, false );
LoadLuaDirectory( “gamemode/server/entity/”, false );
LoadLuaDirectory( “gamemode/server/vehicle/”, false );
LoadLuaDirectory( “gamemode/server/player/”, false );

//
// Content
//
LoadLuaDirectory( “gamemode/content/items/”, true );
LoadLuaDirectory( “gamemode/content/jobs/”, true );
LoadLuaDirectory( “gamemode/content/npcs/”, true );
LoadLuaDirectory( “gamemode/content/vehicle_attachments/”, true );
LoadLuaDirectory( “gamemode/content/vehicles/”, true );
( GM or GAMEMODE ):SortVehicleTable( )

//
// Addons
//
local _files, _folders = file.Find( ( GM or GAMEMODE ).FolderName … “/gamemode/addons/*”, “LUA”);
for k, v in pairs( _folders ) do
LoadLuaDirectory( “gamemode/addons/” … v … “/”, true );

LoadLuaDirectory( "gamemode/addons/" .. v .. "/client/", true, true );
LoadLuaDirectory( "gamemode/addons/" .. v .. "/client/net/", true, true );
LoadLuaDirectory( "gamemode/addons/" .. v .. "/client/gui/", true, true );

LoadLuaDirectory( "gamemode/addons/" .. v .. "/shared/", true );
LoadLuaDirectory( "gamemode/addons/" .. v .. "/shared/net/", true );
LoadLuaDirectory( "gamemode/addons/" .. v .. "/server/" );
LoadLuaDirectory( "gamemode/addons/" .. v .. "/server/net/" );

end

//
//
//
LoadLuaDirectory( “gamemode/content/maps/” … string.lower( game.GetMap( ) ) … “/”, true );
hook.Add( “InitPostEntity”, “LoadProperties”, function( )
LoadProperties( )
end )

function LoadProperties( )
PROPERTY_DB = { };
LoadLuaDirectory( “gamemode/content/maps/” … string.lower( game.GetMap( ) ) … “/properties/”, true );
end[/lua]

I’m actually considering released a skeleton game-mode fully auto-refresh capable based on this system, with a few of my core functions which are pretty useful.

Edit: Also, for the sake of being compatible with linux/windows/max I’d recommend naming all files lowercase as linux does use case sensitivity for files.

Thank you. But how about the shared? Could i use the one in DarkRP and edit the whole thing out but use the whole layout the same?

Sure, why not? You could even start with DarkRP and edit it to your hearts content, fix any bugs that bother you and improve on the gui like this guy did: http://forum.facepunch.com/showthread.php?t=1274986

That’s the beauty of being a developer. You create whatever you want, however you want.

I showed my example of how I started from scratch and built up from that to what became my dev-play-ground: http://www.twitch.tv/acecoolco ( Some of the stuff, not everything but some of it’s on display here )

Alright, thanks everyone. I really appreciate the help

[editline]17th July 2013[/editline]

One last question just to make sure. I’m starting out just editing DarkRP in general to fit my server. I will eventually make it completely(Mostly) different from DarkRP, lets say in my RP gamemode i want to have the arrest , unarrest buttons and the drug entities. Could i be able to leave those files and only hardly touch them? Or would that be pretty much plagiarism? Like if i kept the drugs, arrest files and unarrest files as well as the law boards and stuff? Such as the mayor/cop functions and some of the chat functions?

You would need to ask Falco(FPtche) about that.
I mean he just took an old version of DarkRP modified and released it as well but idk if the original creators gave him a “license”.
Anyway I doubt that, as long as you give credit, falco would start DCMAing you like pulsar effect did with “their” perp gamemode, lol.