I'm working on a tool that lets you use instances in maps for any version of source. I just got it functional, and I'll need some testers before I release it fully. Also, feel free to suggest any features you would like.
Why should you use instances? From the [URL="https://developer.valvesoftware.com/wiki/Instances"]VDW[/URL]
[QUOTE]
They provide a more dynamic alternative to [URL="https://developer.valvesoftware.com/wiki/Prefabs"]prefabs[/URL], as any changes to the instanced map will be reflected in all instances of it.
They provide an alternative to [URL="https://developer.valvesoftware.com/wiki/Visgroups"]visgroups[/URL], as they can be used to divide a large, unwieldy map into several smaller, manageable ones (that can even be worked on by multiple authors simultaneously).
They provide a simple way to edit portions of a map that needs to be at a non-orthogonal angle. (Build the map on-grid inside a separate map, and then instance it into another map through a [URL="https://developer.valvesoftware.com/wiki/Func_instance"]func_instance[/URL] rotated at the correct angle.
[/QUOTE]
After you set up Hammer to use it (instructions on the GitHub page) you can use instances exactly as you would for l4d2 and portal2 maps.
[URL="https://github.com/Metapyziks/VMFInstanceInserter"]GitHub[/URL] [URL="https://github.com/Metapyziks/VMFInstanceInserter/releases"]Download[/URL]
I think I love you.
This is amazing, I can't thank you enough.
Thank you sooo much, this is fanastic :D
I'm going to try it right away...
I wonder when valve bothers fixing the instances natively for us :suicide:
Just added entity property replacement. New version is here:
[URL]https://github.com/Metapyziks/VMFInstanceInserter/raw/master/builds/latest.zip[/URL]
[editline]21st September 2012[/editline]
Has anyone encountered any problems yet?
Can someone please explain this better than the wiki? I do not understand what they are/do.
[QUOTE=Stiveno;37750252]Can someone please explain this better than the wiki? I do not understand what they are/do.[/QUOTE]
Instances?
The are essentially maps within maps.
You are importing one vmf into another that will be compiled together. But because you can import the same instance multiple times, you need to have special entities that relay the IO with a prefixed name.
[QUOTE=vexx21322;37750278]Instances?
The are essentially maps within maps.
You are importing one vmf into another that will be compiled together. But because you can import the same instance multiple times, you need to have special entities that relay the IO with a prefixed name.[/QUOTE]
Oh, okay thanks.
They are especially useful if you have some part of your map that is repeated. If you wanted to change that part of the map, instead of copying and pasting it again after making the changes, every copy will update automatically if they are instances.
I LOVE YOU
Is anyone using it successfully? Any problems or suggestions?
Attempted to fix a bug related to maps with displacements thanks to the help of Python1320, I'm unsure if it has completely fixed it though. The download is updated.
You sir are amazing, just testing this now but I did spot one slight bug.
If your base map and the instance you're trying to add are in different directories, it doesn't seem to work (See below compile log). I tested this log in game and my instance was missing, but the map worked.
[code]
** Executing...
** Command: "vmfii.exe"
** Parameters: "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.vmf" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.temp.vmf"
Parsing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.vmf...
Loading entities.txt
Resolving instances for f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.vmf...
Inserting instance of test/instance_2.vmf at (0 0 64)
Parsing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\instance_2.vmf...
[B]Error while parsing file!
Could not insert![/B]
Instances resolved.
Saving to f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.temp.vmf...
** Executing...
** Command: "f:\steam\steamapps\killermon4\sourcesdk\bin\source2009\bin\vbsp.exe"
** Parameters: -low -game "f:\steam\steamapps\killermon4\half-life 2 episode two\ep2" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.temp.vmf"
Valve Software - vbsp.exe (Sep 15 2011)
4 threads
materialPath: f:\steam\steamapps\killermon4\half-life 2 episode two\ep2\materials
Loading f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.temp.vmf
Can't find surfaceprop concrete for material DEV/DEV_MEASUREGENERIC01, using default
Could not locate 'GameData' key in f:\steam\steamapps\killermon4\half-life 2 episode two\ep2\gameinfo.txt
fixing up env_cubemap materials on brush sides...
ProcessBlock_Thread: 0...1...2...3...4...5...6...7...8...9...10 (0)
ProcessBlock_Thread: 0...1...2...3...4...5...6...7...8...9...10 (0)
Processing areas...done (0)
Building Faces...done (0)
FixTjuncs...
PruneNodes...
WriteBSP...
done (0)
writing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.temp.prt...Building visibility clusters...
done (0)
Creating default LDR cubemaps for env_cubemap using skybox materials:
skybox/sky_day01_01*.vmt
! Run buildcubemaps in the engine to get the correct cube maps.
Creating default HDR cubemaps for env_cubemap using skybox materials:
skybox/sky_day01_01*.vmt
! Run buildcubemaps in the engine to get the correct cube maps.
Finding displacement neighbors...
Finding lightmap sample positions...
Displacement Alpha : 0...1...2...3...4...5...6...7...8...9...10
Building Physics collision data...
done (0) (2281 bytes)
Placing detail props : 0...1...2...3...4...5...6...7...8...9...10
Compacting texture/material tables...
Reduced 3 texinfos to 3
Reduced 1 texdatas to 1 (25 bytes to 25)
Writing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.bsp
0 seconds elapsed
** Executing...
** Command: Delete File
** Parameters: "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.temp.vmf"
** Executing...
** Command: Rename File
** Parameters: "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.temp.prt" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.prt"
The command failed. Windows reported the error:
"File exists"
** Executing...
** Command: "f:\steam\steamapps\killermon4\sourcesdk\bin\source2009\bin\vvis.exe"
** Parameters: -low -fast -game "f:\steam\steamapps\killermon4\half-life 2 episode two\ep2" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance"
Valve Software - vvis.exe (Sep 15 2011)
fastvis = true
4 threads
reading f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.bsp
reading f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.prt
4 portalclusters
4 numportals
BasePortalVis: 0...1...2...3...4...5...6...7...8...9...10 (0)
Optimized: 0 visible clusters (0.00%)
Total clusters visible: 16
Average clusters visible: 4
Building PAS...
Average clusters audible: 4
visdatasize:44 compressed from 64
writing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\shell_instance.bsp
0 seconds elapsed
[/code]
But if the two co-exist in the same directory, you have no problems.
[code]
** Executing...
** Command: "vmfii.exe"
** Parameters: "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.vmf" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf"
Parsing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.vmf...
Loading entities.txt
Resolving instances for f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.vmf...
Inserting instance of test/instance_2.vmf at (0 0 64)
Parsing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\instance_2.vmf...
Resolving instances for f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\instance_2.vmf...
Instances resolved.
Instances resolved.
Saving to f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf...
** Executing...
** Command: "f:\steam\steamapps\killermon4\sourcesdk\bin\source2009\bin\vbsp.exe"
** Parameters: -low -game "f:\steam\steamapps\killermon4\half-life 2 episode two\ep2" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf"
Valve Software - vbsp.exe (Sep 15 2011)
4 threads
materialPath: f:\steam\steamapps\killermon4\half-life 2 episode two\ep2\materials
Loading f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf
Can't find surfaceprop concrete for material DEV/DEV_MEASUREGENERIC01, using default
Could not locate 'GameData' key in f:\steam\steamapps\killermon4\half-life 2 episode two\ep2\gameinfo.txt
fixing up env_cubemap materials on brush sides...
ProcessBlock_Thread: 0...1...2...3...4...5...6...7...8...9...10 (0)
ProcessBlock_Thread: 0...1...2...3...4...5...6...7...8...9...10 (0)
Processing areas...done (0)
Building Faces...done (0)
FixTjuncs...
PruneNodes...
WriteBSP...
done (0)
writing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.prt...Building visibility clusters...
done (0)
Creating default LDR cubemaps for env_cubemap using skybox materials:
skybox/sky_day01_01*.vmt
! Run buildcubemaps in the engine to get the correct cube maps.
Creating default HDR cubemaps for env_cubemap using skybox materials:
skybox/sky_day01_01*.vmt
! Run buildcubemaps in the engine to get the correct cube maps.
Finding displacement neighbors...
Finding lightmap sample positions...
Displacement Alpha : 0...1...2...3...4...5...6...7...8...9...10
Building Physics collision data...
done (0) (2673 bytes)
Placing detail props : 0...1...2...3...4...5...6...7...8...9...10
Compacting texture/material tables...
Reduced 5 texinfos to 5
Reduced 1 texdatas to 1 (25 bytes to 25)
Writing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.bsp
0 seconds elapsed
** Executing...
** Command: Delete File
** Parameters: "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf"
** Executing...
** Command: Rename File
** Parameters: "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.prt" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.prt"
The command failed. Windows reported the error:
"File exists"
** Executing...
** Command: "f:\steam\steamapps\killermon4\sourcesdk\bin\source2009\bin\vvis.exe"
** Parameters: -low -fast -game "f:\steam\steamapps\killermon4\half-life 2 episode two\ep2" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance"
Valve Software - vvis.exe (Sep 15 2011)
fastvis = true
4 threads
reading f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.bsp
reading f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.prt
12 portalclusters
20 numportals
BasePortalVis: 0...1...2...3...4...5...6...7...8...9...10 (0)
Optimized: 0 visible clusters (0.00%)
Total clusters visible: 144
Average clusters visible: 12
Building PAS...
Average clusters audible: 12
visdatasize:148 compressed from 192
writing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.bsp
0 seconds elapsed
** Executing...
** Command: Copy File
** Parameters: "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.bsp" "f:\steam\steamapps\killermon4\half-life 2 episode two\ep2\maps\shell_instance.bsp"
** Executing...
** Command: "f:\steam\steamapps\killermon4\half-life 2 episode two\hl2.exe"
** Parameters: -allowdebug -game "f:\steam\steamapps\killermon4\half-life 2 episode two\ep2" +map "shell_instance"
[/code]
Tested a map from the above log and the instance was correctly imprinted into the map. Seems to me is that although it see's my inserted instance as being /test/instance2(Where it is), it looks for the VMF instance in the same directory in which the base VMF is located. Apart from that, cracking work on this!
It was because hammer was inserting the parent folder's name in even if the instance's map was in the same directory for me so I did a dirty fix of removing the first part.
I'll correct it now.
Sorry, got sidetracked
[URL="https://github.com/Metapyziks/VMFInstanceInserter/raw/master/builds/latest.zip"]Download[/URL]
[editline]29th September 2012[/editline]
Also, it looks like you missed out the command to delete your old .prt before renaming the new one, so vvis.exe isn't getting the new version.
Looks like it now works if they're in different directories, but not if they're in the same anymore. Might just be me so I would test it yourself.
[code]
** Executing...
** Command: "vmfii.exe"
** Parameters: "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.vmf" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf"
Parsing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.vmf...
Loading entities.txt
Resolving instances for f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.vmf...
Inserting instance of test/instance_2.vmf at (0 0 64)
Parsing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\test/instance_2.vmf...
Error while parsing file!
System.IO.DirectoryNotFoundException: Could not find a part of the path 'f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\test\instance_2.vmf'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at VMFInstanceInserter.VMFFile..ctor(String path)
Could not insert!
Instances resolved.
Saving to f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf...
** Executing...
** Command: "f:\steam\steamapps\killermon4\sourcesdk\bin\source2009\bin\vbsp.exe"
** Parameters: -low -game "f:\steam\steamapps\killermon4\half-life 2 episode two\ep2" "f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf"
Valve Software - vbsp.exe (Sep 15 2011)
4 threads
materialPath: f:\steam\steamapps\killermon4\half-life 2 episode two\ep2\materials
Loading f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.vmf
Could not locate 'GameData' key in f:\steam\steamapps\killermon4\half-life 2 episode two\ep2\gameinfo.txt
fixing up env_cubemap materials on brush sides...
ProcessBlock_Thread: 0...1...2...3...4...5...6...7...8...9...10 (0)
ProcessBlock_Thread: 0...1...2...3...4...5...6...7...8...9...10 (0)
Processing areas...done (0)
Building Faces...done (0)
FixTjuncs...
PruneNodes...
WriteBSP...
done (0)
writing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.temp.prt...Building visibility clusters...
done (0)
Creating default LDR cubemaps for env_cubemap using skybox materials:
skybox/sky_day01_01*.vmt
! Run buildcubemaps in the engine to get the correct cube maps.
Creating default HDR cubemaps for env_cubemap using skybox materials:
skybox/sky_day01_01*.vmt
! Run buildcubemaps in the engine to get the correct cube maps.
Finding displacement neighbors...
Finding lightmap sample positions...
Displacement Alpha : 0...1...2...3...4...5...6...7...8...9...10
Building Physics collision data...
done (0) (2282 bytes)
Placing detail props : 0...1...2...3...4...5...6...7...8...9...10
Compacting texture/material tables...
Reduced 3 texinfos to 3
Reduced 1 texdatas to 1 (25 bytes to 25)
Writing f:\steam\steamapps\killermon4\garrysmod\garrysmod\maps\test\shell_instance.bsp
0 seconds elapsed
[/code]
This is because hammer is inserting the parent directory's name before the map name. You can temporarily fix it yourself by removing it, and hammer should still show the instances. I'll add a workaround in a minute.
[editline]29th September 2012[/editline]
Updated. I've simplified the setup too, look through the readme to see the change.
Holy shit this is great.
Updated to fix a problem with systems using the European representation of decimals. Thanks to [URL="http://facepunch.com/member.php?u=40290"]Skotty[/URL] for spotting this.
More fixes, latest version is uploaded. Is anyone actually using this? If not, I'll stop bumping the thread.
I need to use either this or hammer's collapse/undo system every time I want to compile the map so yeah don't stop bumpin :v:
Ok, I just found about about VMFII and I'm months too late, but THIS. IS. AWESOME.
Please keep working on it, Ziks.
But I guess it's not intended that the pre/postfixes are only applied to [I]targetname[/I] and not to [I]target[/I] and [I]parentname[/I], right? :/
Just edit entities.txt to fix that. Add this to the end (make sure there is a ',' separating this with all the other entries):
[code](ent) "your_ent_class" :
{
"target" : "entity"
},
(ent) "your_other_ent_class" :
{
"parentname" : "entity"
}
[/code]
Thanks a lot.
I totally missed the entities.txt.
All the known bugs are fixed now, so I do declare this to be ~version 1.0~
Very nice tool! It's really made my workflow much simpler. Two issues though:
info_overlays don't seem to have a way to pass their brush/side information over. It's a comma separated list of sides. Could you add something so that entities.txt can handle passing new side IDs along
I'm also having a case where an instance gets sent to the absolute location of the map rather than the relative location. As in, an instance gets collapsed and sent to the origin even though I positioned it far away from the origin. I don't have any guesses as to why, but I can supply example vmfs through PM or on steam.
[QUOTE=obstipator;38818158]Very nice tool! It's really made my workflow much simpler. Two issues though:
info_overlays don't seem to have a way to pass their brush/side information over. It's a comma separated list of sides. Could you add something so that entities.txt can handle passing new side IDs along
I'm also having a case where an instance gets sent to the absolute location of the map rather than the relative location. As in, an instance gets collapsed and sent to the origin even though I positioned it far away from the origin. I don't have any guesses as to why, but I can supply example vmfs through PM or on steam.[/QUOTE]
I'll have a go at fixing this tomorrow. Could you send the examples? They would help a lot.
Sweet I'm going to be using this on my projects. Thank you.
[QUOTE=Ziks;38819851]I'll have a go at fixing this tomorrow. Could you send the examples? They would help a lot.[/QUOTE]
Sorry about not getting to this yet, I've got some other work I need to catch up on first. I'll hopefully have time to do it this week.
Sorry, you need to Log In to post a reply to this thread.