CS:GO game_text newline fixer

May 17, 2017

It’s been a little under 2 months since I rediscovered Valve had fixed game_text in CS:GO. At the time I mentioned how even newline would work with a little hex editing replacing a placeholder for newlines.

Of course while hex editing is easy, it is of course a very slow and manual process. When working with a very large binary file, there’s a high chance your placeholder character may appear at random inside the other BSP lump datas, so a replace all occurrence is NOT a very smart idea.

I finally got to a point where I was tired of manually hex editing my map each compile (91 replacements each time!), so I’ve written a small tool that can be integrated into Hammer as a compile step to automatically perform the replacements.

Available on github here

How does it work?

While you can’t add a newline to the vmf, you can add a placeholder character to replace later, and that is how this tool works. Say I want text to display:



In older source engine games, I could just specify Hello\nWorld in a text editor and reload hammer. In CS:GO that will crash hammer, but with my tool, I could do the following: Hello+World, and when used as a compile step, will produce the same Hello\nWorld result in the resultant BSP.

How do I use it?

Its really simple, grab (or compile) the executable (vs2017 project included) and place the .exe wherever you want

  • Create a build step inside Hammers compile configuration, immediately before the Copy File step. This build step you be an Executable; point it to this tool.
  • Set the Build Parameters to: $path\$file.bsp + (where + is your placeholder character.
  • Compile!

Here is a sample of what the tool produces. The entire text is a single gametext entity: ![sample gametext with multiple newlines](./gametextnewline_sample.jpg)