A special Source 2013 mod that helps with modding itself. It helps HL2 level designers make better maps and have a more comfortable experience designing them without changing too much of the game itself. Mapbase includes 50+ new entities (not counting filters or engine ports), hundreds of new I/O/KV (Inputs/Outputs/Keyvalues), heavily reworked FGDs, and a few big surprises. Mappers would create their maps based off of this mod and larger mods with their own unique changes would draw from Mapbase's code and assets.

RSS Mapbase v2.0 released

Mapbase's v2.0 update has been released. This update brings many new and great things, including a fix for the shader frame drops, a release of the Mapbase multi-tool, and custom compilers that support parallax corrected cubemaps (Slammin' Source is still supported). This article goes into detail about what's involved in the update and how it will affect other Mapbase developments.

Posted by on

This is Mapbase's second update since its release. The first update was v1.1, and the release version was v1.0. This update is named v2.0 instead of v1.2 because of the volume and nature of its contents.

Changelist:

- Added custom map compile tools (vbsp, vvis, vrad)
- Changed blink fix (shouldn't change anything in-game)
- Added auto-completion to ent_create, npc_create, and the main set of "npc_" debug commands
- Added ent_create_aimed, an ent_create equivalent of npc_create_aimed
- Made hunters start using the "vs. player" melee animation against smaller NPCs that look weird with the "stab" attack
- Added "explosion_sparks" convar, which fixes broken code for giving explosions sparks (disabled by default because of how different it looks)
- Made interaction code capable of being dispatched on any entity, not just combat characters
- Added npc_barnacle_ignite convar, which lets barnacles be ignited by flares
- Fixed certain NPCs getting out of the way for the player when they hate them
- Fixed auto-generated "speak" scene responses not using parameters that work on real VCDs
- Made "stop_on_nonidle" capable of being used in any mod, not just HL2 episodic mods
- Selectable color for ragdoll boogie/point_ragdollboogie
- Fixed PickupWeaponInstant not firing weapon pickup outputs
- Introduced inputs and keyvalues for "lerping" to math_counter_advanced
- Fixed ClearConsole on logic_console
- logic_convar should now detect client convars correctly
- New NormalizeAngles input on math_vector
- logic_modelinfo LookupActivity input
- math_generate fixed and expanded to be more like math_counter
- Added a WIP game logging system for playtesting maps
- Introduced logic_playerinfo, an entity that can read a player's name or ID
- Fixed some new filters not working with filter_multi
- Added radius pickup spawnflag to func_physbox
- Added "Preserve name" spawnflag to weapons
- Added cc_achievement_debug message for when an achievement doesn't exist
- Made npc_combine_s not speak while in logic_choreographed_scenes
- Fixed zombie torsos/legs/headcrabs not being serverside when zombie is forced to server ragdoll
- Expanded and cleaned up npc_zombie_custom
- Fixed func_commandredirects not cleaning up correctly and sometimes crashing the game
- Allowed player squad commands to go through +USE-held objects
- Added a bunch of I/O/KV to trigger_waterydeath for better configuration
- Changed save comment system to use the chapter title from world properties, and the ability to suppress the title popup that normally results from it
- Adjusted game_convar_mod for MP planning
- Removed the func_precipitation custom particle/splash code for now, as it was causing problems
- Fixed env_global_light not accepting lightcolor
- Added "Additional Buttons" to player_speedmod
- Added save comment to RPC
- Added env_projectedtexture attenuation
- Added scripted_sequence OnPreIdleSequence
- Added OnCrab to zombies
- Added skill_changed game event (may need further testing)
- Added a fix for viewmodels flipping under extreme FOV values
- Added code that allows mappers to change the skin on shotgunners without it usually flipping back randomly
- Fixed a very, very, very major shader performance issue
- New SetAbsOrigin/Angles inputs on all entities, analogous to SetLocalOrigin/Angles
- Code improvements for I/O involving angles
- logic_entity_position improvements/fixes, including a new OutAngles output that outputs the angles on position calls
- Alternate collision/player avoidance spawnflag obsoletion enforcement disabled
- Enable/DisableHazardLights inputs on the EP2 jalopy, equivalent to the keyvalue
- Miscellaneous shader formatting adjustments and fixes
- Fixed AlwaysDrawOff on env_projectedtexture not being a valid input
- Fixed a video playback issue related to the "playvideo" command (contributed by Avanate)

The demo VMFs and BSPs were also updated.

This update took a lot longer than the last one, but it fixes a devastating performance issue with the shaders.

I didn't talk about this issue much because of how embarrassing it was and how much it compromised my work. It reduced my motivation to work on and publicize Mapbase. Now that the issue is out of the way, you can expect a lot more on Mapbase from now on.

…although it also coincides with me getting my time management skills in order, which reduces my time to work on Mapbase. I guess that means you can expect the same, moderate amount of Mapbase, but with a lot more enthusiasm.


The shader performance issue was discovered hours before Mapbase's first release while testing Mapbase with some existing maps from other mods. Massive drops of around 100 frames were reported while comparing an optimized map running in regular Source 2013 with the same map running in Mapbase. More testing was needed, but we proceeded with the release since it didn't seem like a huge deal at the time and we couldn't push back the release any farther anyway (September 2019 was promised).

Long story short, the issue was much more serious than we thought and we only knew that it was coming from the custom shaders. We theorized the code was getting "stuck" somewhere and had nothing to do with a user's hardware, but nobody could figure out what was actually causing it. Days turned into weeks and we were worried it was something engine-side that we couldn't fix. It quickly drained my hope and motivation to work on Mapbase, especially since some modders wanted to go to the extra effort to remove the shaders. I watched one guy slowly go from "The shaders lag, but they look really nice" to "I need to get these shaders out now" over the course of a few days. Removing the shaders from Mapbase meant no projected texture fixes, no radial fog, none of the misc. fixes, and the converted materials would need to be converted back.

After several weeks of this, I thought fixing the shaders wouldn't be possible. However, someone who had been helping me with the issue directed me to a shader-savvy friend of his who was able to analyze a Mapbase frame capture through a GPA and gave me some insight into what was going on, showing that the issue was almost certainly something inside of my code.

I made some intense comparisons to Source 2013's shader code and I finally found the issue.

A convar (r_flashlight_version2) that existed in the original shaders no longer existed in Mapbase's shader code, but references to the convar were replaced with calls to *search* for the convar. The difference is that the Source 2013 code accesses the convar directly while the Mapbase code searches the list of convars. This means the shaders were searching the entire convar lookup for a non-existent convar on a per-frame basis. That's what was decimating the FPS.

This happened because I started Mapbase's shader code from the work of another modder who was basing his work on Alien Swarm's shaders. He was porting Alien Swarm code over and didn't realize he removed the convar, and his code had issues since the convar reference was missing. As a quick fix, he used the searching method instead so the code would compile while keeping the convar's functionality. He didn't realize the implications of the code and I had passed by it several times thinking it was directly from Source 2013.

I apologize for the wall of text, but fixing this has restored my faith in Mapbase and people who were suffering from the issue before deserve to know the full story.


The shaders being fixed also helped me resume work on the Mapbase Multi-Tool. It was originally intended to be a more complicated and full installer, but it was much easier to just make a simpler and all-purpose tool.

It's a basic WPF program I made through C#. It might look like something you'd find on a suspicious website, but it's extremely useful for creating SDK tool shortcuts and converting VMTs to Mapbase's new shaders.

You can download it here and find more details in README.txt.


Another problem I only discovered around release was that the vanilla compilers don't support custom shaders. Custom shaders only work correctly on certain modded map compilers, most notably Slartibarty's improved Slammin' Source compilers. Maps compiled through the vanilla compilers can only run in fullbright. This irritated me when I found out about the issue since I wanted users to use any compiler they want, especially since having a compiler requirement would be yet another step in setting up Mapbase.

Although Slammin' Source works, I wanted users to have an alternative. I began work on Mapbase-specific custom compilers right after v1.1 released.

Another reason I started working on my own compilers was because it gave me the opportunity to introduce parallax corrected cubemaps, a very extreme feature that allows cubemap reflections to move in relation to the camera.

This implementation is based off of this article on the VDC, which is itself based off of the work of Brian Charles, who made this famous video showing it off. All credit goes to Brian Charles and the people who wrote that VDC article.

The code for parallax corrected cubemaps involves changes in both the shaders and VBSP, one of the map compilers. Slammin' Source's VBSP doesn't use this code, so you'll need to use Mapbase's VBSP to use parallax corrected cubemaps. Mapbase's VVIS and VRAD don't have as much work put into them as Slammin' Source, but you can use Mapbase's VBSP in conjunction with Slammin' Source's VVIS and VRAD without losing much.


The shader fix, the multi-tool, and the map compilers are the main highlights of this article, but this update introduces many other changes and bug fixes as well. The change list above has most of the details.

Mapbase Release Build

Mapbase Release Build


Mapbase Compile Tools

Mapbase Compile Tools


Mapbase Multi-Tool

Mapbase Multi-Tool


Mapbase "Demo" Maps

Mapbase


Mapbase Mod Templates

Mapbase Mod Templates


Comments
male07.mdl
male07.mdl

Incredible work! How much performance did it cost you to get the parallax effect working?

Reply Good karma Bad karma+3 votes
Blixibon Author
Blixibon

Shader changes like that don't really much of a difference on modern hardware, so I think the cost in this case could be virtually nothing. That said, I only tested it with a couple of closed-room surfaces in a demo map, so it could be different when you're actually using it in a large, playable map.

Reply Good karma+5 votes
Cvoxalury
Cvoxalury

I can say it doesn't affect performance because it's still a static reflection. It's just produced differently, so it "knows" its geometry and bounds. Even though it's static, it still helps a lot to make a scene more believable. I work with them and they have a few quirks, for example they mostly have to be confined to rectangular spaces that aren't too stretched on one side. (though I use them sometimes on streets and plazas; again, it's a baked-in effect so there's no additional cost in rendering).

Reply Good karma Bad karma+4 votes
TheGrill
TheGrill

One small thing I've noticed while messing around with some stuff is that the metrocops no longer point out grenades. Quick look in the console gave me the error "No such sentence group METROPOLICE_GREN". Usually it calls for METROPOLICE_DANGER_GREN in the sentences.txt, so I assume something has been changed in the code without editing the sentences?

Reply Good karma Bad karma+2 votes
Blixibon Author
Blixibon

You're right! I changed how metrocops speak so they use the same system as citizens and other allies, which involved writing a response file with their sentences. It looks like I made a mistake and used "METROPOLICE_GREN" when it's supposed to be "METROPOLICE_DANGER_GREN". I'll make sure this is fixed in the next update. Thank you for pointing it out.

Reply Good karma+3 votes
TheGrill
TheGrill

I did find them and combine soldiers to be a lot more responsive to teammates going down or being last in squad, in vanilla game they often seem to just ignore it and say nothing. Is that related to the changes in their system?

Reply Good karma Bad karma+1 vote
Blixibon Author
Blixibon

I don't think my changes would do that. Are you sure there's a difference or does it just seem that way?

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Profile
Icon
Half-Life 2
Creator
Blixibon
Contact
Send Message
Release date
Mod watch
Follow
News
Browse
News
Share
Related Mods
Related Games
Half-Life 2
Half-Life 2 First Person Shooter