Climbey

Climbey

View Stats:
Chris P 12 Jan, 2017 @ 11:49pm
Code to convert 3D models to Climbey custom levels.
EDIT: Muninn has made a superior version of my code, found here[github.com].

I created a python 2.7 file that converts all .obj files in its current directory and all sub directories into Climbey custom level .txt files. I intended for this to work in conjunction with the 3D modeling program "blender" for easier creation of Climbey custom levels. The code and example files can be found here[github.com].

To use,
1: Create a .obj file with rectangles (and only rectangles) who's material names are the Climbey type names (i.e. "Grabbable" or "Metal"). Generic meshes are not supported.
2: Install python 2.7 (found here[www.python.org]).
3: Install numpy (a python addon, found here[sourceforge.net])
4: Place "Obj_file_decoder.py" in a directory at or above the target .obj files.
5: Run "Obj_file_decoder.py"
6: Move the generated .txt files to "probably C:\Program Files (x86)\Steam\SteamApps\common\Climbey\CustomLevels" inside of a folder as the same name as the .txt file.

I can't double check that my code is working properly as I am just learning the lesson of you-cant-mount-the-lighthouse-to-the-wall-with-command-strips-even-if-you-screw-them-to-a-block-of-wood-first. I'm sure if the code doesn't work though someone will yell at me and tell me :P. Apologies in advance for making it work best with the program "blender", which has a needlessly high learning curve. It is however, powerful and fully free. If you're downloading that for the first time, a good starting tip is that by default left and right click are reversed...
Last edited by Chris P; 8 Feb, 2017 @ 6:07pm
< >
Showing 1-15 of 16 comments
MDK 13 Jan, 2017 @ 2:21pm 
I need to test this out at some point.
MDK 13 Jan, 2017 @ 3:10pm 
Do I need to add the endflag and player to the obj as well?
MDK 13 Jan, 2017 @ 3:52pm 
01/14/2017 01:49 AM <DIR> .
01/14/2017 01:49 AM <DIR> ..
01/13/2017 09:34 AM 10,327 Obj_file_decoder.py
01/14/2017 01:47 AM 764 test3_blender.mtl
01/14/2017 01:47 AM 1,158,137 test3_blender.obj
3 File(s) 1,169,228 bytes
2 Dir(s) 777,362,202,624 bytes free

G:\Projects\Climbey_level_edit\scenes\level_test_01_convert\test>Obj_file_decoder.py
Traceback (most recent call last):
File "G:\Projects\Climbey_level_edit\scenes\level_test_01_convert\test\Obj_file_decoder.py", line 10, in <module>
import numpy as np
ImportError: No module named numpy

G:\Projects\Climbey_level_edit\scenes\level_test_01_convert\test>



I get this error when trying to run the script. I tried an obj file created by maya and blender. I'm using the newest version of python and I'm trying to run it from command prompt.
Last edited by MDK; 13 Jan, 2017 @ 4:16pm
MDK 13 Jan, 2017 @ 4:37pm 
I might know what the problem is. The OBJ i create have different type of file structure. By changing the export parameters I could probably fix this, but there are so many parameters in blendder that it's very tedious to go through every single combination.
Chris P 13 Jan, 2017 @ 6:26pm 
MDK2k,

Looks like you don't have numpy installed, you can download it at https://sourceforge.net/projects/numpy/. Thank you for including the error message.

Originally posted by MDK2k:
Do I need to add the endflag and player to the obj as well?

Yes. Use the material names "[CameraRig]" and "Finishline" without quotes. Only have one of each. Their size and rotation are hard-coded for error reasons, altering these parameters in the .obj file will do nothing.

Originally posted by MDK2k:
By changing the export parameters I could probably fix this, but there are so many parameters in blendder that it's very tedious to go through every single combination.

If you are using blender: create a rectangle object, give it a material named "Metal", create all other metal blocks by making a copy of the initial "Metal" block, the will automatically be assigned the materials "Metal.001", "Metal.002", "Metal.002.001", etc.. since the code drops everything in the material name after the first period these will all be assigned the material "Metal".

Valid type names are:
"Icy", "Metal", "Glass", "Grabbable", "Spikes", "Jumpy", "GravityField", "[CameraRig]", "Finishline"
Last edited by Chris P; 13 Jan, 2017 @ 6:37pm
MDK 13 Jan, 2017 @ 6:36pm 
Can you link the OBJ export setting you use in blender?
Chris P 13 Jan, 2017 @ 6:42pm 
Originally posted by MDK2k:
Can you link the OBJ export setting you use in blender?

My .obj file export settings: http://imgur.com/c8nhhLn. (see the edits I made in my previous post)
MDK 13 Jan, 2017 @ 6:55pm 
Ok I managed to install numpy and I could run the script on an example level. Next up I will finish my own test level and give it a go.
Last edited by MDK; 13 Jan, 2017 @ 6:57pm
Muninn 14 Jan, 2017 @ 7:43am 
Very nice, but I've noticed a few things that could improve in the script, I'll take a run at it and submit a pull request.

Any thoughts on adding Pyside as a dependency? If so I could knock up a simple UI to make it a bit more easy to use.
Chris P 14 Jan, 2017 @ 7:36pm 
Originally posted by MDK2k:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=841824359&searchtext=
<3, I'm so happy that it worked lol.

Originally posted by Muninn:
Very nice, but I've noticed a few things that could improve in the script, I'll take a run at it and submit a pull request.

Any thoughts on adding Pyside as a dependency? If so I could knock up a simple UI to make it a bit more easy to use.
Yeah, its definitely not a golden piece of code. I've never heard of Pyside. I'm all for making the script easy to use, but at the moment I don't know exactly what a simple UI's (purpose would be)/(would add to it). Let me know if you have an idea though. Since I have a version which "works" without Pyside, I would probably default to it if importing Pyside fails.
Last edited by Chris P; 14 Jan, 2017 @ 7:45pm
Muninn 15 Jan, 2017 @ 6:21am 
Pyside is the python wrapper around QT which is a GUI framework. Currently your script just loops through the folder it is in, instead I was thinking you can browse to files, select only a subset to convert.

You could also use the GUI for options like setting the level settings (number of checkpoints, etc.) for the files you convert. Plus it's just generally more user friendly for people who aren't used to the command line.
Muninn 15 Jan, 2017 @ 7:51am 
Right, I've done a big refactor of the code and abstracted it to a point that it would be easy to add support for any additional 3d file types such as FBX or SculptVR files. Now the data is all converted to an intermediate format and then serialized from there which is much closer to the internal Climbey representation.

You can find my code here: https://github.com/DrHibbitts/Climbey_File_Converter

To get the same behaviour as you had by default you now need to do "python Main.py -r" as it does not recurse through directories by default.

Would you be willing to add a license such as MIT in to your repository so that it's a bit clearer about me releasing the code?

It's still a work in progress but should be a much more generic framework for building on now.
Chris P 19 Jan, 2017 @ 9:54pm 
Okay, I could see that making the program more legible. I'd agree with the GUI then.

Originally posted by Muninn:
Right, I've done a big refactor of the code and abstracted it to a point that it would be easy to add support for any additional 3d file types such as FBX or SculptVR files.

Wow, that is very well written. I see you are a fan of dictionaries :p. Thaks for taking a pass at the code. So I've never done the Github thing before, and since your code is better written, is the idea that your code becomes the new go-to code, and I should link to your github in the main description, or should i overwrite my github with your stuff?

Originally posted by Muninn:
Would you be willing to add a license such as MIT in to your repository so that it's a bit clearer about me releasing the code?

I'll do that as soon as i have access to a proper internet connection and a PC (both are in short supply a.t.m.)

Sorry for the delay, I've been obsorbed in climbey level creating. If you've used the code, have you noticed that the climbey level is mirrored on...the x-axis?... Need to know if its my Blender .obj export settings or a change I need to make to the code.
Last edited by Chris P; 19 Jan, 2017 @ 9:55pm
Muninn 20 Jan, 2017 @ 5:05am 
Originally posted by themonkeyoverlordofsatin:
Okay, I could see that making the program more legible. I'd agree with the GUI then.

Wow, that is very well written. I see you are a fan of dictionaries :p. Thaks for taking a pass at the code. So I've never done the Github thing before, and since your code is better written, is the idea that your code becomes the new go-to code, and I should link to your github in the main description, or should i overwrite my github with your stuff?

Thanks! Dictionaries and lovely and make things nice and readable which I'm a fan of for stuff like this. Plus they serialize really nicely for JSON which is what the Climbey files are stored in.

Normally the way it would work is I'd create a pull request on your repo which you can then choose to merge in, however because it was such a large change and it's now more general so it can handle more than OBJ files in the future I kept it separate for now. I'm not opposed to merging it back at some point though, although perhaps a rename of the repo is in order to reflect the more general nature of it?

Originally posted by themonkeyoverlordofsatin:
If you've used the code, have you noticed that the climbey level is mirrored on...the x-axis?... Need to know if its my Blender .obj export settings or a change I need to make to the code.

I've actually only tested some very basic levels and wasn't paying too much attention to axes, I'm actually busy this weekend but I may have a play next week when I get some more time. Probably the easiest way to check is to make a little axis guide in blender, have three cuboids, one along each major axis (+x, +y, +z) and give them a different material so you can identify them. When you import them you should be easily able to see the axis system. It's quite likely that Unity is using a different coordinate system to Blender so we may have to do a coordinate system transform. (They're pretty trivial, just a matrix multiply, or you can do it as some swaps and negations in the vectors / quaternions)
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: 12 Jan, 2017 @ 11:49pm
Posts: 16