Co-Operative Base (Mod)

From Valve Developer Community
Revision as of 05:26, 17 July 2010 by Vektorx4 (talk | contribs) (Added fix for low vehicle eye position)
Jump to navigation Jump to search

OrangeBox Co-Operative Base

Formerly known as Shadow Source

FINAL VERSION released 27th June 2010 - See Features list for new content.

Description.

OrangeBox Co-Operative Base is a patch file containing useful code fixes for the Source SDK Base 2007 (OrangeBox) for use in multiplayer modifications/total conversions requiring such things as working online AI.

There are some minimum system specifications required for using OBCO (OrangeBox Co-Operative) and these are as follows:

  • Half-Life 2 or Half-Life 2: Episode 1.
  • Source SDK Base 2007 (free download).
  • Half-Life 2: Deathmatch, which can be found at one of the three following locations:


http://www.steampowered.com/ati_offer1a/ (ATI users).

http://www.steampowered.com/nvidia/ (NVidia users).

http://store.steampowered.com/app/320/ (Everyone else).


Additionally you can use content from any of the following games (as long as you own them):

  • Half-Life 2: Episode 2
  • Portal


Warning.pngWarning:The currently compiled version mounts all the games above. Edit GameInfo.txt and InstalledSourceGames.txt to remove any games from mounting which you do not own (as they will crash the exe).


Untested (but should work):

  • Half-Life 2: Lost Coast
  • Counter Strike Source
  • Team Fortress 2
  • Content from Valve supported Modifications (must have their own unique AppID).

Features.

Developers can easily enable and disable individual features to suit their needs.

Here is a list of the features available to mod developers:

  • NEW in the FINAL Version.
    • Portal Gun, player only.
    • Super Gravity Gun (some graphic effects missing- most of code done by .Kave).
    • Restart level on critical ally/object/time limit failing.
    • View Cameras now take control of all players on a server (Gordons KO Wakeup scene etc).
    • Save/Restore transitions now work even if you disable playerclasses from the code.
    • Each player class player now has their own unique filter name, meaning only a certain playerclass can trigger an event (for example). Thanks Alters for the fix!
    • Called it a day on development. It's all in the hands of the community now.


  • AI Patch Modifications:
    • Enable/Disable an enhanced version of Winstons' AI Multiplayer patch.
    • Valve Game Mounting:
    • Dynamically mount various official Valve games to get the most for your mod.
    • or use Static Mounts when you're sure you don't need Dynamic mounting.
  • Episode 2 Support:
    • Including support for Alyx Darkness Mode


  • Player Abilities:
    • Non-HEV wearers can still be allowed to sprint, have the geiger counter etc. This is on a per-item basis, so players could have the geiger, but no sprint if you wanted.
    • Players can pickup objects with their hands.


  • Player Class System With:
    • Four (or more, or less) Player Classes.
    • Per Player Class Object Pickup Strengths.
    • Customise Class Health/Maximum Health Values.
    • Customise Class Armour/Maximum Armour Values.
    • Customise Class Walk/Sprint/Normal movement speeds.
    • Customise Class Jump Heights.
    • Each Class Can Have Its Own HUD Layout/Colour scheme.
    • Define how many players can be in each Player Class.


  • Teamplay Support:
    • Fixes for enemy NPCs and teamplay games.


  • Weapon Enhancments:
    • Development teams can now enable Iron Sight.
    • A known hl2dm Shotgun fast-switch bug - fixed thanks to Community input!.


  • NPC Abilities:
    • Striders can be set to always impale players who get too close.
    • Barnacles can now be set to swallow the player.


  • Vehicles:
    • The multiplayer camera judder is no more!
    • Thirdperson model in-vehicle animations can now be used.
    • Old-Style passenger seats can now be used to provide extra seats in vehicles.
    • Jeeps and Jalopys' can now have their headlights switched on.


  • Cool Stuff:
    • Firstperson Ragdoll Views on player deaths.
    • Camera bob on player movement (incl. strafe).
    • Use CounterStrike: Sources' ladders code instead of the Half-Life 2 ladders.


  • Game Settings:
    • Friendly Fire (Replaces players can collide from v1.5).
    • Dynamic Respawn Code. Don't spawn back at the start of the map anymore, respawn back where you left off in your killing spree.
    • Multiplayer Level Transitions.On ALL players entering the transition area the server is forced to changelevel to the next map (percentage can be changed).
    • Save/Restore. A basic working transition system which saves/restores your loadouts.
    • Valve approved cheating. Now even if sv_cheats 1 is enabled, players can't cheat unless you define it as acceptable in the code.
    • Map briefings. Provide storylines on a per-map basis.
    • Map specific model overrides. Changes all players to a specified player model on a particular map (set by the mapper). Check out our defector map for an in-game example!


Credits.

  • The Development Team:
    • Ariae -- Composer.
    • Chief -- Modeller/Reluctant Coder.
    • MontyPython -- Foley Artist.
    • Sneaky[ToB] -- Coder.
    • SpamSlayer -- Voice Artist/Coder.
  • Occasional Team Members:
    • Apocrypha Roxy -- Voice Actress
    • MasterThief3 -- Voice Artist


  • And thanks to the following non-OBCO team members:
    • Winston
    • Tony Sergi
    • Biohazard_90
    • Sub-Zero
    • DutchMega
    • The Last 7 Hours Spanish Mod
    • Skidz
    • Alters
    • .Kave
    • KuRouZu
    • Jorg
    • z33ky
    • JordanN
    • TheRJMan
    • HalfWit2

Getting the Current Release.

Our ModDB page download:

ModDB


You will need 7zip 9.13 or greater or an archive program capable of extracting .7z files.


For Advanced users, Vektorx4 created the following .patch file.

Link

Patch File.

Extract out the patch file (SDK_to_OBCO_Final_Patch.exe)from the .7z file to somewhere handy (such as your Desktop).

Run the patch tool, at the point of folder selection make sure to select the 'Src' folder of your exported SDK Base 2007 code.

Once it's done - you've patched your source code.

Easy, huh?


obcoop_shareddefs.h

To allow flexibility for mod makers, every change that was made to the SDK can be enabled or disabled by the mod team.

Known Bugs

Super Grav Gun - ::DoMega fuunctions not implemented and ::Do functions missing some single player additions (these ::Do functions enable the fancy effects you can see are missing)

weapon_hl2mpbase.cpp line 133 null pointer crash with super gun enabled. However only ever happened on d3_breen_01 map.

weapon strip/dissolve zones (as used to make the super grav gun in hl2/ep1) don't work properly, nor do they work for all players.

Armour not working on non-playerclass save/restore transitions.

Pre-Criminal mode remains active after map change leading to invulnerable players.

null pointer crashes, fixed with work arounds but possibly not the best fixes out there.

chatbubbles angle towards the players view, so can appear embedded in walls etc. Fix on forums didn't work.

jalopy driver eyes are much too low, you barely see where you're driving.

passengers in the obco passenger seat take no damage from AI hitting the car the seat is parented to.

Reset of level on mission critical failure - failure to preserve objects only shows for server host. Messages such as ally lost show to all players.

AI bend their legs when going up in lifts (elevators), but are okay going down.

portal gun- player only (no entities, physics props, projectiles etc - Kleiner's lab mini-port can do physics props). Co-Op, portals all linked to each weapon. No fancy cameras like real portal gun.

Also the portals bounding boxes for the players to touch them for portaling through are solid, and thus cause the player damage if they hit at too high a velocity. Because of this, they lose velocity each time they enter a portal when falling through from ceiling to floor, and thus don't pick up the momentum associated with Portal. The code for velocity through portals does function, except for this bug causing it to appear not to be working - when it is.

If there are two players in a server, and both are killed in a portal, they constantly kill each other in a respawn/telefrag loop.

Code Fixes

Double ragdolls on death

If you're getting issues with double ragdolls spawning on death (one client-side and one server-side), open up game/server/basecombatcharacter.cpp and change the line:

//	if ( m_bForceServerRagdoll == true || ( CHL2MPRules()->MegaPhyscannonActive() == true ) && !IsPlayer() && Classify() != CLASS_PLAYER_ALLY_VITAL && Classify() != CLASS_PLAYER_ALLY )

to

	if ( m_bForceServerRagdoll == true || ( HL2MPRules()->MegaPhyscannonActive() == true ) && !IsPlayer() && Classify() != CLASS_PLAYER_ALLY_VITAL && Classify() != CLASS_PLAYER_ALLY )

(basically removing the 'C' in front of 'CHL2MPRules()->MegaPhyscannonActive()' and re-enabling that line)

Crash in vstdlib.dll on mod exit

This crash is caused by an unnecessary line in one of the OBCO_SAVERESTORE blocks. To fix it, open game/server/gameinterface.cpp and search for this block:

//TDT - Clear the transition file.
#ifdef OBCO_SAVERESTORE
	FileHandle_t hFile = g_pFullFileSystem->Open( "cfg/transition.cfg", "w" );

	CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER );
	g_pFullFileSystem->WriteFile( "cfg/transition.cfg", "MOD", buf );
	g_pFullFileSystem->Close( hFile );
	return;
#endif //OBCO_SAVERESTORE

Now, delete the line return; so that it becomes:

//TDT - Clear the transition file.
#ifdef OBCO_SAVERESTORE
	FileHandle_t hFile = g_pFullFileSystem->Open( "cfg/transition.cfg", "w" );

	CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER );
	g_pFullFileSystem->WriteFile( "cfg/transition.cfg", "MOD", buf );
	g_pFullFileSystem->Close( hFile );
#endif //OBCO_SAVERESTORE

Recompile the code and the crash will be gone.

Low eye position when driving the Jalopy

This issue actually affects the HL2 jeep as well, but isn't as noticable. Open game/client/c_prop_vehicle.cpp and search for

m_ViewSmoothingData.bDampenEyePosition = false;

Change it to

m_ViewSmoothingData.bDampenEyePosition = true;

It's actually already fixed at this point, but players with high latencies will now notice stuttering of the vehicle. To fix that (at the cost of the forward/backward view dampening), for these two files:

game/client/c_vehicle_jeep.cpp (affects both the HL2 jeep and the jalopy)
game/client/hl2/c_vehicle_airboat.cpp (if you want to fix it for the airboat as well)

comment out this line:

DampenForwardMotion( vecVehicleEyePos, vecVehicleEyeAngles, flFrameTime );

If you wish to see the stuttering to evaluate whether you want to sacrifice this, perform the first step above (changing the false to true), then compile and load up the game, flip on sv_cheats and spawn a vehicle and execute the command net_fakelag <latency to simulate>. At higher latencies, the stutter will be more noticable.

Compiled Version.

The information below is important for understanding how the modification operates, even if all you will be using is the patch file. You may find it more useful to use the Compiled mod folder as your mods folder and edit it as required, then you're assured that all the files are there and everything is setup correctly (unless you mess something up).

The compiled version has a handy to use installer (OBCO_Final_Compiled_Release.exe found in the .7z archive) to make life easier for everyone using it.

GameInfo.txt

This file is extremely important, it can't be stressed enough because without it being properly setup most of the content will fail to work (if not crash hl2.exe) if using Static Mounting, and not load important sounds, animations etc if Dynamic Mounting.

GameInfo.txt is also where you define such things as your developers team name, website and the icon to display in the steam menu.

The most important section, and the section that we're going to describe here are the 'Search Paths'.


Search paths are the modifications way of mounting the GCFs which come with each Half-Life 2 game. In the current compiled version the search paths in our gameinfo.txt look like this:

  
    SearchPaths
    {
        Game				|all_source_engine_paths|ep2
	Game				|all_source_engine_paths|episodic
	Game				|all_source_engine_paths|hl2mp
	Game				|all_source_engine_paths|hl2
    }

Notice how we do not have Portal in the search paths. This is because Portal should never be defined here (Unless you use Static Mounting, in which case it should be put BELOW hl2).

If you create a map and notice animations or scripted sequences failing to load, this is usually a sign of Static Mounting being used, or of some specific game content being used in an incorrect Dynamic Content map type. An example is the Alyx "Dr Freeman I Presume" scene in d1_trainstation_04, this sort of concussion scene will *NOT* work if your map type were ss_ep1_ or ss_ep2_ and would not work in Static Mounting if half-life 2 wasn't mounted last in the list.

This leads us nicely on to the:

InstalledSourceGames.txt

Additional code in cdll_client_init.cpp and gameinterface.cpp has added the ability to mount additional GCF files. This is always enabled whether you are using Static or Dynamic content mounting.

The InstalledSourceGames file (previously AddMount.txt in older mod versions) helps the game find models, textures and maps that it wouldn't otherwise do through the gameinfo.txt's searchpaths. The gameinfo.txt searchpaths allow mounting sounds and particles which the AddMount.txt fails to do.

Only games listed within the text file will be displayed, and as such in most cases you will either wish to delete the code from the .cpp files, or blank out the contents of the file.

Notice how the order partially mimics the GameInfo.txt search paths, except that we put Half-life 2: Deathmatch at the top and we ALWAYS - if being used - put Portal as the LAST thing (bottom of) the file.

  
"Half-Life 2: Deathmatch"
{
   "SearchPath"   "hl2mp"
   "AppID"        "-320"
}

"Half-Life 2"
{
   "SearchPath"   "hl2"
   "AppID"        "-220"
}

"Half-Life 2: Episode 1"
{
   "SearchPath"   "episodic"
   "AppID"        "-380"
}

"Half-Life 2: Episode 2"
{
   "SearchPath"   "ep2"
   "AppID"        "-420"
}

"Portal: The cake is a lie!"
{
   "SearchPath"   "portal"
   "AppID"        "-400"
}

Skill.cfg

The skill file is important as it allows you to define such things as NPC health, NPC damage (to others such as the player), number of rockets a Strider may have and even how much charge a Vortigaunt can give to the players suit. It is worth reading through the file and editing it to suit your needs as it does define alot of features of modifications. It can be found in the cfg folder.

obcoop_english.txt

This is the modifications language definition file. Here you can find such settings as the titles for Chapters, the messages displayed on a vital ally being killed (for example) and other things such as server connection messages etc. It's found in the resource folder.

ChapterBackgrounds.txt

This file defines which of your modifications maps are background maps to display on the main menu. If you choose to use background maps with your modification, be sure to define the 'ss_bg_motd_fix' in the c++ code so as not to display the motd on the main menu.

Valve.rc

This file defines whether background maps are displayed on the main menu. It's found in the cfg folder.

Classmenu.res

This is the file which tells the game where to place the Join buttons etc for the Player Class System. I'm mentioning this in passing as in your own modification if you use the default Classmenu.res which comes with the SDK all you'll see is a window with a cancel button.

ClientScheme.res

This is the HUD colour file. Seperate versions can be used per player class as needed. Currently all classes are set to use the one same file.

Map Briefings

This is a folder in the maps folder. Each map that requires a briefing has a text file for that specific map. This loads in a similar fashion to the MOTD panel. It allows a quick map storyline for people loading the map. See our example maps in-game to see this concept in action.

StartupVids.txt

Create this for custom Startup Videos, or if you create a blank version of this file then there will be no startup movies at all in your mod.

Obcoop_Information

This folder contains information for mappers (including such things as an FGD file and useful prefabs) and also information for Dedicated Server hosts.