Author Topic: >> GameMode Reference <<  (Read 60088 times)

What are Game Modes?

   Game Modes are a way to package and distrubute your mods in a more user friendly fashion.
   
   You also gain more control over your mod, you can set things exactly how you need them. Which makes it easier for both you and the user who wants to run it.
   
   This post will give you a general idea on how to get a gamemode running.

Required Files
  • colorSet.txt
  • description.txt
  • gamemode.txt
  • save.bls
  • preview.jpg
  • thumb.jpg

Note: If any required files are missing the gamemode will not run and you will be notified of what's missing.

Game Modes can also contain normal Add-On files such as
  • client.cs
  • server.cs
  • models
  • sounds
  • etc

Making a gamemode

  • Naming the Game Mode
       
       The folder should named in this fashion, GameMode_Example
       
       This gamemode would show up as "Example" on the select gamemode menu.

       A gamemode entitled, GameMode_Flying_Pig_DM , would show up as "Flying Pig DM".
       
  • Enabling Add-Ons

       To enable Add-Ons for gamemodes you have to add them to the gamemode.txt file.
       
       If you wanted to add the rocket launcher for example, you would do this.
       
       ADDON Weapon_Rocket_Launcher
       
       Remember if your gamemode also contains server scripts, you have to include it as well.
       
       ADDON GameMode_Example
       
  • Enabling Music
       
       Enabling music is done in a similar way to Add-Ons.
       
       If you wanted to enable After School Special for use in your mode, you would do this.
       
       MUSIC After_School_Special
       
  • Changing Environment settings

       To change the environment you must edit the $EnvGuiServer variables.

       In simple mode you can use preset add-ons like, Sky_Sunset, and Ground_Plate to set the tone of things.
       
       $EnvGuiServer::SimpleMode 1
       $EnvGuiServer::SkyFile Add-Ons/Sky_Sunset/Sunset.dml
       $EnvGuiServer::WaterFile NONE
       $EnvGuiServer::GroundFile Add-Ons/Ground_Plate/plate.ground
       
       If you wish to do more you can refer to the list of variables here.
       
       Also read the tip relating to the saveEnvironment command, to make things easier for you.
       
  • Changing Minigame settings

       All of the normal minigame options are available to change

       Adding this
       
       $MiniGame::Enabled 1
       
       will add a default minigame to your gamemode
       
       All the MiniGame variables you can change are located here.
       
  • Changing Server settings

       Changing the server settings is done in the same way as minigames & environments.
       
       $Server::WelcomeMessage \c2Welcome to Splosion mode %1!
       
       Here \c2 is used for coloring the message, %1 is the players name.
       
       All server variable options are at the bottom of this post, here.
       
  • Preview Image

       All gamemodes require a preview image.

       All preview images must be jpeg.
       
       preview.jpg should be 256x256
       
       thumb.jpg should be 64x64
       
       Try to capture the feeling of your mode in the preview.
       
  • Packaging the GameMode
       
       Packaging a gamemode is done the same way as normal Add-On.
       
       Take all the required files and put them in a zip file.

       Do not put other Add-On zip files into your gamemode, things don't work this way.
       
       All gamemodes must have the prefix GameMode_
       

Tips

  • $DefaultMiniGame - If you ever need to access the minigame through script, you can just get it through this variable.
  • $DefaultMiniGame.reset( 0 ) - For resetting the minigame, since the default minigame has no client.
  • serverDirectSaveFileLoad(%fileName, 3, "", %ownership) - For loading bricks in scripts, %fileName is where your save is, %ownership can be 0 for load as host, or 2 load as public
  • saveEnvironment( %fileName ) - This will save your current environment settings to a text file, has to be in a folder.
    Example: saveEnvironment( "config/mySettings.txt" );
     
  • Can also be used in custom games - Gamemodes can also be used in custom games if you want them to be.
  • $GameModeArg - Used to detect what gamemode is running. You can use this to make sure your gamemode scripts only run when you want them to.
       
          Example : At the top of server.cs

             if( $GameModeArg !$= "Add-Ons/GameMode_Example/gamemode.txt" )
             {
                error( "Error: GameMode_Example cannot be used in custom games!" );
                return;
             }
     
  • MiniGameSO::onAdd( %minigame ) - If you need to access the minigame right as the server starts you can package this.


Example Game Mode
   
   This is a simple example gamemode using the Blupo save, Rocket Launchers, and Fuel Jet Player type.

   Download

   

« Last Edit: October 28, 2015, 11:03:18 AM by Badspot »

VariableTypeExample | Min : Max
             
// environment variables
$EnvGuiServer::SimpleModebool                     0 : 1
$EnvGuiServer::SkyfilefileAdd-Ons/Sky_Skylands/Skylands.dml
$EnvGuiServer::WaterfilefileAdd-Ons/Water_Default/default.water or NONE
$EnvGuiServer::GroundfilefileAdd-Ons/Ground_Plate/plate.ground
$EnvGuiServer::SunFlareTopTexturefile base/lighting/corona.png
$EnvGuiServer::SunFlareBottomTexturefile base/lighting/corona.png
$EnvGuiServer::DayOffsetfloat 0.0 : 1.0
$EnvGuiServer::DayLengthinteger 0 : 86400
$EnvGuiServer::DayCycleEnabledbool 0 : 1
$EnvGuiServer::DayCyclefile Add-Ons/DayCycle_Default/default.daycycle
$EnvGuiServer::SunAzimuthfloat -360.0 : 360.0
$EnvGuiServer::SunElevationfloat -360.0 : 360.0
$EnvGuiServer::DirectLightColorcolor0.968628 0.835294 0.796079 1.000000
$EnvGuiServer::AmbientLightColorcolor0.600000 0.500000 0.400000 1.000000
$EnvGuiServer::ShadowColorcolor0.525490 0.560784 0.682353 1.000000
$EnvGuiServer::SunFlareColorcolor0.100000 0.100000 0.100000 1.000000
$EnvGuiServer::SunFlareSizefloat 0.0 : 5.0
$EnvGuiServer::VisibleDistancefloat 20.0 : 1000.0
$EnvGuiServer::FogDistancefloat 0.0 : 1000.0
$EnvGuiServer::FogColorcolor0.580000 0.680000 0.940000 1.000000
$EnvGuiServer::WaterColorcolor255 255 255 128
$EnvGuiServer::WaterHeightfloat 1.0 : 1000.0
$EnvGuiServer::UnderWaterColorcolor51 153 153 77
$EnvGuiServer::SkyColorcolor1.0 1.0 1.0 1.0
$EnvGuiServer::WaterScrollXfloat -10.0 : 10.0
$EnvGuiServer::WaterScrollYfloat -10.0 : 10.0
$EnvGuiServer::GroundColorcolor0 128 64 255
$EnvGuiServer::GroundScrollXfloat -10.0 : 10.0
$EnvGuiServer::GroundScrollYfloat -10.0 : 10.0
$EnvGuiServer::VignetteMultiplybool 0 : 1
$EnvGuiServer::VignetteColorcolor0.000000 0.000000 0.000000 0.392157
             
// minigame variables
$MiniGame::Enabledbool 0 : 1
$MiniGame::GameColorinteger 0 : 9
$MiniGame::InviteOnlybool 0 : 1
$MiniGame::IncludeAllPlayersBricksbool 0 : 1
$MiniGame::PlayersUseOwnBricksbool 0 : 1
$MiniGame::Points_BreakBrickinteger -9999 : 9999
$MiniGame::Points_PlantBrickinteger -9999 : 9999
$MiniGame::Points_KillPlayerinteger -9999 : 9999
$MiniGame::Points_KillSelfinteger -9999 : 9999
$MiniGame::Points_Dieinteger -9999 : 9999
$MiniGame::RespawnTimeseconds 0 : 300
$MiniGame::VehicleRespawnTimeseconds 0 : 300
$MiniGame::BrickRespawnTimeseconds 0 : 300
$MiniGame::UseSpawnBricksbool 0 : 1
$MiniGame::FallingDamagebool 0 : 1
$MiniGame::WeaponDamagebool 0 : 1
$MiniGame::SelfDamagebool 0 : 1
$MiniGame::VehicleDamagebool 0 : 1
$MiniGame::BrickDamagebool 0 : 1
$MiniGame::EnableWandbool 0 : 1
$MiniGame::EnableBuildingbool 0 : 1
$MiniGame::EnablePaintingbool 0 : 1
             
// These go by ui name, 0 for none            
$MiniGame::PlayerDataBlockNamestring/ui nameNo-Jet Player
$MiniGame::StartEquipName0string/ui nameSword
$MiniGame::StartEquipName1string/ui name0
$MiniGame::StartEquipName2string/ui name0
$MiniGame::StartEquipName3string/ui name0
$MiniGame::StartEquipName4string/ui name0
       
//server config
$Server::BrickRespawnTimeinteger 1000 : 300000
$Server::ClearEventsOnClientExitbool 0 : 1
$Server::MaxBricksPerSecondinteger 1 : 1000
$Server::MaxPhysVehicles_Totalinteger 0 : 20
$Server::MaxPlayerVehicles_Totalinteger 0 : 200
$Server::Quota::Environmentinteger 20 : 5000
$Server::Quota::Iteminteger 5 : 100
$Server::Quota::Miscinteger 10 : 9999
$Server::Quota::Playerinteger 0 : 100
$Server::Quota::Projectileinteger 5 : 200
$Server::Quota::Schedulesinteger 10 : 1000
$Server::Quota::Vehicleinteger 0 : 100
$Server::QuotaLAN::Environmentinteger 20 : 5000
$Server::QuotaLAN::Iteminteger 5 : 100
$Server::QuotaLAN::Miscinteger 10 : 9999
$Server::QuotaLAN::Playerinteger 0 : 100
$Server::QuotaLAN::Projectileinteger 5 : 200
$Server::QuotaLAN::Schedulesinteger 10 : 1000
$Server::QuotaLAN::Vehicleinteger 0 : 100
$Server::WelcomeMessagestringWelcome to the server!
$Server::WrenchEventsAdminOnlybool 0 : 1
             
$GameMode::BrickOwnershipstring Host : SavedOwner *if not set will default to public
« Last Edit: August 11, 2012, 12:58:52 PM by Rotondo »

Woah this new system seems cool.


You guys are loving awesome.

Quote
serverDirectSaveFileLoad(%fileName, 3, "", %ownership) - For loading bricks in scripts, %fileName is where your save is, %ownership can be 0 for load as host, or 2 load as public
Does this mean, when loaded as ownership 2, anyone can build on the bricks? What about destroying them?

What if you put a 1 there?
« Last Edit: August 09, 2012, 11:11:55 PM by Lugnut »


1 is load original ownership, which mostly won't be used in scripts.

It looks like I have some work to do. Nice update.

Does this also mean that saves can be loaded without a client in a non-hacky way?


It looks like I have some work to do. Nice update.

Does this also mean that saves can be loaded without a client in a non-hacky way?
Seems like it.

Does this also mean that saves can be loaded without a client in a non-hacky way?

Yes.

So I'm looking through the files to see what's new and I see Gamemode_zombie. Then I remembered that's just a third-party Add-On. It seems all the other gamemodes are titles similarly. Did you always know it was going to be like this, and is this the update you were waiting for to update Left 4 Block?

Sorry if this is off-topic but it seems relevant. Just delete this if not.

Is it possible to make a vote gamemode command/mod?
like the same they use for the tf2 servers where you can nominate for a new game, and if it gets enough votes, It'll change to said gamemode, since you now can load game modes with a build, this should be possible

Is it possible to make a vote gamemode command/mod?
like the same they use for the tf2 servers where you can nominate for a new game, and if it gets enough votes, It'll change to said gamemode, since you now can load game modes with a build, this should be possible
Should be, if nothing else then it should be possible to set up a fake connection to send the servercmds as.

Should be, if nothing else then it should be possible to set up a fake connection to send the servercmds as.
Cool, so now I can make a minigame server