Author Topic: [TUTORIAL]Porting/Creating Static maps using Tendons export.py [IMAGE HEAVY]  (Read 3570 times)

Ok, firstly I wanna say that this is my method of how I make my maps, I'm sure there are plenty of other and probably better and more efficient ways of making collisions with convex hulls and all of that. But this is the method I prefer and how I do things.

So, now we can start. Okay, so here are the things you will need.

-Blender
-Tendons export.py
-Vhacd (Blender Addon)
-Auto Rename (Blender Addon)
-Crafty (For porting GoldSrc maps or Source Maps)
-GCFScape (For opening .pak files to extract Texutres from goldsrc or source games)
-Ports DTS export/import
-Flexxi

-Part 0.5: Getting GoldSrc or Source maps-

This part only applies if you want to port source or GoldSrc maps to blockland, If you already have a 3d modeled map then skip this. Source maps are really high poly most of the time so do those at your own risk.. I guess.

Source Game - Map Import

Anyway, download Crafty and GCFScape from the links above.

First open GCFScape. We're gonna get and create a textures folder first.



Alright, So its blank! We're going to mount a .pak file. To do this click the folder in the top-left corner. The one with the arrow going inside it. Or Click File->Open, Or press Ctrl+O



Once you do this, navigate your source game folder. You can use either Source SDK or a source game in general. From here go into the "hl2" folder (if you chose a source game) or the "sourceengine" folder (if you chose Source SDK)



From here open "hl2_misc_dir.vpk".



Now shift or ctrl select both "models" and "materials" folder, right click and press "Extract"



Afterwards click a folder to extract it to and you're good.

After its finished extracting look for "hl2_textures_dir.vpk" and do the exact same thing.



Extract the models and materials to the same folder aswell.

Once thats done, for the final part go into your source game you want to import maps from. For me lets say CS:S



Select "cstrike_pak_dir.pak" and open it



And extract the "models" and "materials" folder to the same place as the others. And also create a "maps" folder inside your folder. So it'd be like this.

 

So now here comes the good part. The map importing. So go into your maps folder for the game you wanna import. I want to import a CSS map so I'd go into the cstrike folder.



Now click "maps" and copy and paste the map you want into your extracted textures "maps" folder



Now open Crafty, Click Setup->Profiles and click the game you wanna export from. I will Click Counter-Strike:Source because thats what i'm importing from



Now click View->File System Browser or press Ctrl+F



Now click (In the file system browser) File->Open->Folder



Now navigate to your extracted textures folder. And click OK.

Once you do.. Congratulations! You now have your map folder working!

now, click your maps folder and double-click on the map you wanna export.



BAM it worked..



Now, go into your Setup tab and click Options. And then click on "Exporting" then make sure that these are selected



Then click apply and OK. Then press Ctrl+E and select a folder to export to.

Congrats! Now you have a Map Model from Source!


GoldSrc Game - Map Import

Now, instead of Extracting and stuff, HL1 textures are already there and ready to go. So just open the file system browser and mount the Half-Life folder!

Just go back to the profiles tab and select the game you wanna export textures from!



Now click the game you wanna export maps from. I wanna export a HLDM map so i will choose the folder that says "valve"



Now press maps and select the map you wanna export!



Press CTRL+E and select the export folder!

You're finished!

-Part 1: Setup-

Ok, Start up Blender and be greeted with a blank canvas



Great, a cube. Now to get rid of it and other Stage items! Select all by pressing "A" twice and pressing delete.



Now its time to import our exported map.



Go down to import and select "Wavefront OBJ (.obj)" Now locate your exported map file



click the .obj file and wait for it to import.



You have successfully imported the map! Now Hold shift and Right-Click on an object and press CRTL+J and afterwards Press S to scale it.



Now press Shift+Ctrl+Alt+C then click "Geometry To Origin"



Now Click on the "Object Editor" and rotate it



Change it from "90" to "0" and it should flip over. Next is what I personally like to do, which is turn on Textures.



And click that little white sphere and change it to "Texture"

Now lets get to installing the 3 Addons required

Lets start with VHacd First. First download it from the Github link and then extract the folder somewhere you'll remember.

The github Description has an installation tutorial so I'll paste it here

Code: [Select]
Copy the Python script in v-hacd/add-ons/blender/object_vhacd.py to your Blender addons directory.

For Blender 2.78+ this directory will be where you installed blender. I installed it in "Program Files/Blender Foundation/Blender/2.7x/scripts/addons/".

You're at the right place if you see other scripts prefixed with object_.


The addon must be enabled before use.
After copying the script to the addons
directory, open Blender and navigate to File > User Preferences > Add-ons.
Object: V-HACD will be featured on the list, if you do not see it then search "Object: V-HACD". Check its mark to enable the addon and save user settings.

Also, you will need to keep the rest of the files included in the github package. So extract all of the folders that are inside of the addon into a folder.



Congrats you've installed VHACD!

Now for Ports DTS import/export.

Download the addon from the Github Link aswell, and open it. Then press the Windows key + R to open the Run box. And type %appdata%

Once you've done that look for a "Blender Foundation" Folder. Then click it and click the folder "Blender" Now choose your current Blender version, mine is "2.79" so I'd click "2.79". Once you've clicked your Blender version click on the "scripts" folder then "addons" folder. Now drag the "Io_scene_dts" FOLDER into the addons.



And to install the last Addon which is "Batch Rename" this is the easiest one to install So don't worry.

Download the .zip file of the addon, and go into blender and press "Install Add-On from File" then navigate to the downloaded zip and double click it to install it.



And also, when you install these make sure you click the check right beside it



Then press "Save User Preferences" and restart blender - Be sure to save your map.

Once its been restarted open your saved map file and press go back into the "Object" tab. We're going to add it into a group.



Now click the "Add to Group" button and type in "detail32".



Now your object should have a green outline on it.

Anyway, look at the bottom of the program. You should see something say "Object mode" Switch that to "Edit" mode.



Now click the "Faces" button.



Okay, now all you need to do is Press A once then press C to enable multi-select. From here select the faces you want the player to collide with.



If you've made a mistake, then use Middle-Mouse to deselect the selected face. Once you're finished then Right-Click and Press P.

Once you've press P then click on "Selection". Then switch from edit mode to object mode. Once you've done that Right-Click on the area you just cut out.



I know its selected because of its green glow. Anyway once you've selected it look on the left side of the program. You should see a tab named VHACD. If you don't you're either still in edit mode or you didn't enable it.. If you see it then click the blank field.



Once you've pressed that you will have to look for where you extracted VHacd



Now, look where it says "bin","bin-no-ocl","bin-no-ocl-comp".



Yeah, if your PC is old and a 32bit that doesn't support things like OpenCL like mine. Then choose "bin-no-ocl". If your PC is really great and is 64bit and has OpenCL support, choose "bin". If you're on an OSX that doesn't support OpenCL then choose "bin-no-ocl-comp".

Then choose your windows "bit" which is like 32bit or 64bit. Or if you're on an OSX then click OSX..



Now click "TestVHACD.exe"



Now click on the Button that says "V-HACD"



This will come up, just press "Ok" unless you know what its talking about.



You now have a Convex Shape!

Now, in the object editor panel click on the newly created object.



Now click the little plus sign next to it to expand it



See the object that starts with "BSP"? Thats the cut model just select it and delete it.

Now, In the group panel press the + button and name it "Collision-1"



Now, press the newly created mesh while holding CTRL to rename. And add at the beginning "COL"



Now you've created your first collision!

Now lets say you have alot of collisions in one mesh. Like this



That would be alot of renaming now wouldn't it?

No problem! First delete the mesh in there. Then click the "Parent" which would be the object that the rest of the meshes are under.



Then click on the "Add to Group" button and click "Collision-1" Remember to do this all to the parent first. Then press Shift+G and click "Children", then press CTRL+Shift+G and click "Collision-1" and now you have added all of those meshes to the collision group!

Now don't rename them by hand. Let blender do it!

Click on the "Name" button on the side, then press the blue highlighted button shown in the picture.



Then click "Batch Name"

And now make your settings exactly like mine.



Then click Ok and now the Child objects have COL in the beginning!



Almost done! Now press Alt+P and click "Clear and Keep Transform" Now all child object have left the parent! Now the only thing thats left is to rename the parent object to have COL as a prefix. Which you can do by CTRL clicking it in the object viewer.



Now you have to do that same thing for the rest of the map!

Anyway lets say you wanna test it out. Well you need to open the scripting panel first



Click Open



Now look for where you put Tendons export.py and open it

Once you have it found go ahead and open it, then scroll to the bottom and find this line.



change this to your blockland installation directory. And for where it says Map_Kitchen, go into your blockland addons folder and create a folder named "Map_[yourmapname]" and within that folder create another named shapes. Since im making snark_pit from HLDM im gonna change it to be.



Now save the .blend by going to File->Save. Then click on Run Script!

Now go back into "Default" mode by changing script mode back to it. And now we're going to get the textures into blockland

Now to get the textures, find your mesh files that dont have COL at the beginning and Shift Click them all.



Then press Ctrl+J. Now head back to your Models Import Location and find the JPG files (If you used the goldsrc/source way)



See how they have Snerkperp at the beginning? well we have to add those to the materials aswell in blender. So click on your meshed map that you just did. And head to the "materials" area



Then go back into the Batch renamer and this time make it like this.



Notice how the cube isn't selected but the checkered ball is.

Now click OK



If it matches, it works! Now re-run the script to export!

Now head to your map folder in your blockland addons, copy all of the map textures and put them inside the "shapes" folder



Now head into blockland and enable the map!





It WORKS! But the textures are messed up. In order to fix this you have to resize the textures to a number by the power of 2. What I normally do is make all textures 256 x 256. Thats what I did for the Black Mesa map. But there are 40 textures you're not gonna go and resize them all by hand.

This is where Flexxi Comes in handy!

Open it up and be greeted by a Fox...



Click the Add button in the top and select "Files" then select all of your texture files



Once you've done that then click the Resize button



Now click the Size resolution and change it to 256 x 256, also change the Resize Mode to sprain.



Then click start!

Once its finished, go into your shapes folder and you should see another folder named "Resized"



Drag all of those textures from the resized folder and replace the older textures and restart the server!



Its been Fixed!

That Concludes this tutorial. It looks hard because its a really long page. But its only long because I explained ever bit of it.

I would've included a part with importing v20 maps but thats really a hit or miss at times. One time it was to work, the next it doesn't. If you have any questions just reply and I'll try to answer to my best.

I also think that this tutorial isn't really as good as it should be but will hopefully get it across..
« Last Edit: June 05, 2018, 11:24:54 AM by datiel12 »

Very nice tutorial! I'll keep my eye on this in case I want to do something like this in the future.

Very nice tutorial! I'll keep my eye on this in case I want to do something like this in the future.
Thanks, Only made this because I'd love to see more map makers in the community!

i still think that building the actual map out of bricks would be so much faster. anyways this is a cool tutorial, keep up the good work

eeeeeeeeeeeeeeeeeeeeeeeeeeeee eeee forget

That's an interesting way of doing collision.  And is certainly faster than doing it by hand.
I'm happy to see someone else making maps.   ... and tutorials.


I would've included a part with importing v20 maps but thats really a hit or miss at times. One time it was to work, the next it doesn't. If you have any questions just reply and I'll try to answer to my best.
I didn't have too much trouble getting the .dif interiors from v20 into blender.

For those interested:
Quote from: Tendon
It basically goes torque game editor v1 to dae to Maya to fbx to blender.
Quote from: Tendon
You'll need 2 pieces of software, and an interior w/it's related files.

Torque3D v1: https://github.com/GarageGames/Torque3D/releases/tag/v1
Maya LT: http://www.autodesk.com/products/maya-lt/free-trial

Unzip Torque3D
Exec Torque3D.exe
Click New Project
Click Template > Empty
Click Create
Minimize Torque3D
Move [interiorname].dif and it's resources to Torque3D-1\My Projects\New Project\game\art\shapes\
Maximize Torque3D
Click "Play Game"
Click "Play"
Click "Go"
Hit F11 on the keyboard
On the right side of the screen, click "Library", then click "Meshes", then double-click "art", then double-click "shapes", then double-click [interiorname]
You should see it pop up in the game, you may have to hold right-click and look at the ground before double-clicking [interiorname].

On the top left, click "File", then "Export Interiors To COLLADA".
Click your interior, deselect "Export interiors with transforms baked in", and click Export.
Close Torque3D.

Install Maya LT (It's a 30-day trial)
Open Maya LT
Click File > Import
On the bottom of the menu, change "Files of type:" to "DAE_FBX"
Navigate to [filepath]\Torque3D-1\My Projects\New Project\game\art\shapes\
Click [interiorname].dae
Your interior should appear.
You can rotate, pan, and zoom with Alt+LeftClick, Alt+MiddleClick, and Alt+RightClick.
You can also use the scroll wheel to zoom.
Click File > Export All
Navigate to [filepath]\Torque3D-1\My Projects\New Project\game\art\shapes\
Change "Files of type:" to FBX export
On the options pane to the right, go to File Type Specific Options > Advanced Options > FBX File Format and change "Version:" to "FBX 2014/2015"
Change "File name:" to "[filename].fbx"
Click "Export All"
Close Maya LT

Open Blender and import [filename].fbx from [filepath]\Torque3D-1\My Projects\New Project\game\art\shapes\

Alternatively, in Maya, while exporting, you can also select File Type Specific Options > Include > Embed Media > Embed Media
If you do that, you can put the fbx file wherever you want.
But I think it'd better to keep the fbx file with it's resources.  You'll need them if you plan on turning it into a .dts.

Very nice but why is the entire post in bold?

That's an interesting way of doing collision.  And is certainly faster than doing it by hand.
I'm happy to see someone else making maps.   ... and tutorials.


I didn't have too much trouble getting the .dif interiors from v20 into blender.

For those interested:
I meant with textures. Like I can do interiors just fine. Its just terrain..

Very nice but why is the entire post in bold?
Why not

I meant with textures. Like I can do interiors just fine. Its just terrain..
Oh, terrain.  Yeah.

I've done some experimenting w/terrain.  It seems as though a Blockland client can't support very many StaticShapes in a scene at once.  I go from about 900fps in an empty map, to 45fps in a map with 1000 static shapes, even if they're invisible.  This really limits what I can do with terrain, because I can only have, what- a 100x100 tile map?  It's possible to use that serversided selective ghosting dll to reduce or remove the lag.  If the objects are not ghosted, the client does not lag.
But there's a jitter effect while standing on an unghosted collision shape, as the client and server argue over where the player is.  And vehicles will just appear to fall through the ground when they're not moving.
I think it would be possible to selectively ghost only collision shapes that are near players, bots, and vehicles.  But I have not made a working demo for that.

Anyhow, that's just my ramblings.  I don't know how to get terrain back into Blockland w/the original textures. :c

Oh, terrain.  Yeah.

I've done some experimenting w/terrain.  It seems as though a Blockland client can't support very many StaticShapes in a scene at once.  I go from about 900fps in an empty map, to 45fps in a map with 1000 static shapes, even if they're invisible.  This really limits what I can do with terrain, because I can only have, what- a 100x100 tile map?  It's possible to use that serversided selective ghosting dll to reduce or remove the lag.  If the objects are not ghosted, the client does not lag.
But there's a jitter effect while standing on an unghosted collision shape, as the client and server argue over where the player is.  And vehicles will just appear to fall through the ground when they're not moving.
I think it would be possible to selectively ghost only collision shapes that are near players, bots, and vehicles.  But I have not made a working demo for that.

Anyhow, that's just my ramblings.  I don't know how to get terrain back into Blockland w/the original textures. :c

Well, I can import terrain just fine. Not much change in FPS. I just cant get textures to work properly. Really what I do before I import it is if it has alot of verticies then use Limited Dissovle. To simplify the mesh. Which also makes it easier to add collision to.

this is a cool post!! thanks for all the info :))

problem with these maps is that they are huge datablock wise. (dust2 was like 1000 datablocks)

problem with these maps is that they are huge datablock wise. (dust2 was like 1000 datablocks)
Yeah, but the map itself is 1 datablock. The collisions make up a lot of the datablocks.
« Last Edit: May 06, 2018, 12:49:46 AM by datiel12 »