GoldSrc Map2Prop

Half-Life HL
GoldSrc Map2Prop by Erty
Posted 1 year ago2023-07-13 01:54:11 UTC • Completed • Half-Life
Loading...
Screenshot Thumbnail
Name
GoldSrc Map2Prop
By
Erty Erty
Type
Application
Engine
Goldsource
Game
Half-Life
Category
Completed
Included
EXE
Created
1 year ago2023-07-13 01:54:11 UTC
Updated
3 months ago2024-08-16 22:19:51 UTC
Views
4346
Downloads
520
Comments
29
Rating
5.00 (5)

v1.0.1

GoldSrc Map2Prop is a tool for converting .map, .rmf and .jmf files, as well as .obj files exported from J.A.C.K, to GoldSrc .smd file that can then be compiled into a GoldSrc format studio model without the hassle of using an 3D editor.

It can also be seamlessly integrated with the map compilation process, essentially running as its own compilation tool that'll convert, compile, and replace the brushwork with model props automatically.

Github.io documentation page for the project

Github repository


Windows Defender False Positive

Unfortunately Windows Defender (and potentially other antiviruses) might flag Map2Prop.exe as a trojan. This is a consequence of using the PyInstaller to package the application.
I am trying out self-signing the application to see if it makes a difference, but it might take a while before I become a trusted source. You can help out in the meantime by reporting it as a false positive.

You may add an exception for Map2Prop.exe in your antivirus, or if you still don't trust it you're welcome to clone the project, check the files, and building it yourself.

Requirements

To use the auto-compile feature one must add a valid reference to a Sven Co-op studiomdl.exe either in config.ini (recommended) or using the commandline option (-m, --studiomdl).

Why is the Sven Co-op studiomdl.exe required for compilation?

The reason for requiring the Sven Co-op studiomdl.exe for compiling these models is because of how map textures work, i.e. they may tile or otherwise extend beyond the UV bounds. Legacy studiomdl.exe compilers will clamp UV coordinates which is no good for this. Additionally, legacy compilers cannot handle CHROME textures that aren't 64x64. Don't worry, the compiled model will still work perfectly fine in vanilla Half-Life.

How To Use

Simply download the archive and extract it to a directory of your choosing (or build it).
After that open config.ini and ensure the paths to the Steam installation and studiomdl.exe are set up correctly.

Textures

Map2Prop needs the texture files that are used in the prop to create the models. It will look for the raw BMP textures in both the input file's directory and the output directory, as well as in WAD archives in these directories and the configured game config's mod folder and automatically extract these.<br />
Additionally one can feed a text file containing paths to WAD archives (one per line) to the commandline argument (-w, --wad_list) or fill out a wad list in config.ini.

In other words, set the steam directory and the relevant game and mod in config.ini and Map2Prop will take care of extracting the textures for you.

Drag & Drop

A simple way to use Map2Prop is to place the prop(s) to be converted in their own map and drag that map onto the executable.

All brushes will be merged with the worldspawn model unless part of a func_map2prop entity with the own_model key set to 1, which will be placed in their own models.

Map Compile

By adding the map2prop.fgd to the map editor's game configuration one can tie brushes to the func_map2prop entity and add the Map2Prop executable to the compilation process (for example Hammer/J.A.C.K's Run Map Expert mode) before/above the CSG compiler and in arguments put "$path/$file" --mapcompile.

Important: Ensure Use Process Window or Wait for Termination (or similar) is checked to make sure Map2Prop finishes before the rest of the process continues.

Commandline Interface

For advanced usage one might run Map2Prop through a shell or command prompt.

To get started with the CLI one can either run Map2Prop with no arguments or call it with --help to get a list of available arguments.

config.ini

The config file config.ini allows one to adjust various defaults and set up paths to the model compiler and game directories. Each separate game configuration section (preceeded by the section's name in square brackets, e.g. `[halflife]`) will override the default settings when that configuration is active. The active game configuration can either be set in the default's game config key, or by using the commandline option (-g, --game_config).

For example, when using the map compile feature one can add the --game_config my_mod to ensure the models end up in /Half-Life/my_mod/models/

Bug Reports and Feature Suggestions

Take a look at the Issues page for the repository and make sure the bug/feature hasn't been already been posted.

If the bug/feature is new, feel free to open a new issue, or comment it here or send me a private message. Be as detailed and specific as you can be.
If it's a bug report, please include the steps for reproducing the issue. Any log files (from /logs) or input map files will be very helpful in investigating the bug.

Special Thanks

Thanks to Captain P for all the help and advice, as well as showing me the .rmf/.jmf parsing code from MESS (and of course many thanks to MESS for being an excellent resource).
Thanks to Penguinboy for the tips and being very helpful with any questions I've had.
Thanks to Kimilil for help with testing the release candidate and providing excellent feedback and ideas.

Alpha Testers

Many thanks goes out to the kind people who helped me test this program and provide useful feedback and suggestions during its alpha stage:
  • SV BOY
  • TheMadCarrot
  • Descen
  • Kimilil

29 Comments

Commented 1 year ago2023-07-14 20:21:54 UTC Comment #105397
Earlier today I was thinking about trying the maps to models process and low and behold I see this.
I haven't had a chance to try the tool out yet, but I am endlessly grateful that you're working on it! :heart:
Commented 1 year ago2023-07-15 08:34:33 UTC Comment #105400
I'm glad to hear that ^^
Commented 1 year ago2023-07-15 15:37:26 UTC Comment #105401
我最近很有可能有体验的机会,十分感谢您的工作和爱。爱来自中国。
I am very likely to have a chance to experience it soon, thank you very much for your work and love. Love comes from China.
Commented 1 year ago2023-07-15 19:34:25 UTC Comment #105402
Thank you too, I hope you find it useful! 😊
Commented 1 year ago2023-07-17 17:41:59 UTC Comment #105405
This is a very cool tool, thanks for sharing!
Commented 1 year ago2023-07-17 21:44:17 UTC Comment #105407
Looks very good! Theoretically you could use this for 3D modelling?
Commented 1 year ago2023-07-18 07:39:47 UTC Comment #105408
Definitely! It basically lets you use your level editor to create models.
I hope it's useful to those that don't want to learn to use a 3D editor but still want to make model props for their maps. ^^
Commented 1 year ago2023-07-19 06:26:15 UTC Comment #105413
System Error

The program can't start because api-ms-win-core-path-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.

That's on Windows 7. Why is the executable so massive?
Commented 1 year ago2023-07-19 17:10:33 UTC Comment #105417
It was compiled on Win10 so it's possible it might not work on Win7 (it not being supported and all that).

The size is mostly due to a library I used for a lot of the math functions, and I agree it's unnecessarily large. Been working on refactoring out that bloated library since last week and should have a new version ready pretty soon. 🙂
Commented 1 year ago2023-07-19 21:45:37 UTC Comment #105418
(Oh right, that new version mentioned above is out now)
Commented 1 year ago2023-07-20 16:08:57 UTC Comment #105421
What's new?
Commented 1 year ago2023-07-20 16:43:17 UTC Comment #105422
On the outside it's mostly just a smaller filesize for the executable. A bloated library was refactored out to make that happen, and a lot of the math functions it provided were replaced with standard library ones or rewritten by myself.
Also found and fixed a bug related to reading .obj files with ORIGIN brushes.
Commented 1 year ago2023-07-21 07:54:37 UTC Comment #105423
After trying it I gotta say it is incredibly simple to set-up and use.
The models look indistinguishable from their brush counterparts.

Amazing job with the program <3
Commented 1 year ago2023-07-21 15:25:35 UTC Comment #105427
Good program, haven't experienced any issues so far.
Commented 1 year ago2023-07-22 13:29:59 UTC Comment #105434
Thanks both of you. I'm glad to hear it's working well for you ^^
Commented 1 year ago2023-07-22 18:36:50 UTC Comment #105435
Haven't tried this yet as I've been out of my mapping streak.

This program is a step forward to make goldsrc propmaking workflow better, for sure. For one, it eliminates the need to use Blender+plugin for the obj to smd conversion.

I really hope you explore the possibility of extracting compiled .bsp models as .objs, which you can feed into the toolchain, as the lightmaps can then be baked into the textures of the props, suitable for larger props e.g. 3d skyboxes.
What this would make possible is a single compile workflow: csg, bsp, vis, rad, bsp2prop.
Again, this tool being at the end means it has rad's lighting information to work with.

I know unrealkaraulov's newbspguy fork has this exact feature, but it's not accessible in the CLI (in fact his fork's CLI is completely broken) and he's been on radio silence as of late.
Crafty can export .bsp as .objs as well but only the whole .bsp. Again, UK's newbspguy comes in a clutch with its ability to export individual brush model as a standalone .bsp, which you feed into Crafty. But again, the problem with these programs are that they have no command line interfaces.
Commented 1 year ago2023-07-23 02:09:35 UTC Comment #105436
Wow, nice tool! thanks for sharing.
Months ago I had the desire to create a script/tool that would allow me to do that, but I abandoned it. It's good that you made it possible.
The idea i had in mind was basically converting the brush in an entity called "brush_model" with some keyvalues. Then during the compiling process (before zhlt tools process) the script/tool would convert the "brush_model" entity to mdl (using external tools) and then automatically inserting it into the map as a cycler_sprite. I never got around to implementing it, i just coded a few lines to parse the .map file in a basic way.
Here concept map of the idea:
User posted image
I was planning to use many external tools as possible to make the code easier and avoid having to code complex tasks like extracting wad textures or converting to smd, since my knowledge of programming is very basic.
Commented 1 year ago2023-07-23 10:49:32 UTC Comment #105437
@kimilil I will consider that for the future. Even after I finish v1.0 of Map2Prop I still have two mapping projects I'm working on I want to finish first before starting a new project.

@cindor That sounds similar to the concept Kimilil was talking about.

Someone in the Discord came up with the idea to use custom entities that would be turned into models and put back in the map. I guess one could call a program at the start of the compile process that'd extract these entities from the .map file and run Map2Prop on those (once I finish the .map format support) and then replace these entities with cycler_sprite or whatnot (possibly give it a CLI argument) before overwriting the .map and let the rest of the compile process go as usual. It wouldn't have Kimilil's baked lightmaps, but could been an alternative way of doing this.
Commented 1 year ago2023-09-15 19:11:04 UTC Comment #105560
A few more ideas:
  • Implement smoothing groups via brush entities
  • Implement mesh tying to bones via brush entities, with the origin brush as the bone position. This would open the door to animating or adding bone controllers with qc.
My end goal is to be able to turn a porta-pottie with its door into a model (you can guess where this is going...)
Commented 1 year ago2023-09-16 14:47:13 UTC Comment #105563
I wonder what happens if you feed this program a Quake II or Quake III JMF. Been meaning to try, for the lulz.
Commented 1 year ago2023-09-18 08:17:44 UTC Comment #105567
@kimilil I'm already working on using the ORIGIN brush as model origin override, besides it wouldn't have enough information to make a skeleton chain.
I'm thinking instead of using a custom point entity (info_bone) that can hold a name and parent, and have it skinned to the vertices of any brushes grouped with it (or even radius around the entity, could use a keyvalue for that as well). Might look into it after the full release.

@SirYodaJedi I think it'll work fine, unless you use any Quake III curved surfaces. Just looked at the code now and realised it doesn't handle the curved surface array in each solid, which will corrupt all other solids after the first one. Already fixing that now 🙂
Commented 10 months ago2023-12-31 08:54:09 UTC Comment #105819
这很好。这是两个世界的桥梁。
That's fine. It's a bridge between two worlds.
Commented 8 months ago2024-02-25 22:43:08 UTC Comment #106013
Awesome. This is now being used for some of the more complex brushwork in The Core. No complaints so far. You have been added to the credits. :)
Commented 8 months ago2024-02-26 09:31:06 UTC Comment #106014
That's really exciting to hear! Looking forward to seeing it! 😁
Commented 4 months ago2024-07-03 05:41:47 UTC Comment #106225
(lmao, sry my mouse is glitched and comment was sent 3 times, idk how to remove comments if it's possible for this site)
Commented 4 months ago2024-07-03 05:41:47 UTC Comment #106226
:hammer:
Commented 4 months ago2024-07-03 05:41:47 UTC Comment #106227
very useful! thanks for this tool! <3
Commented 4 months ago2024-07-12 13:09:09 UTC Comment #106243
🎉 Congrats for v1.0 release!! 🎉
Finally we have the goldsrc equivalent to source's Propper!
Commented 4 months ago2024-07-12 19:50:12 UTC Comment #106244
Thank you! 🥳

You must log in to post a comment. You can login or register a new account.