Shockeye
11-01-2009 05:53:39
Hi,
I was wondering, what are people using to generate their levels for PCZSM? I've started to work on some Python scripts for Blender, and I just thought I'd ask if anyone has followed that route sucessfully, or any other method?
I'm using a script to add a “ZONE” property to a mesh to flag it as a zone for my exporter. Another script converts a selected quad face into a separate mesh and adds a “PORTAL” property. This part is a pain because I'm having trouble with both the selection behavior in Blender, and also the coordinates get messed up if the zone mesh has been translated before adding a portal. Another script which I have yet to start on will link 2 selected portals. Once all this stuff is done, the exporter is the easy part, it just traverses the scene and writes out the zone & portal data in whatever format I decide on.
This method has the advantage that I can check each zone is a manifold mesh which important for creating a zone. The disadvantage is that portals are defined one at a time, and it would be up to the user to make sure they were in pairs & matched geometrically.
The other technique that I thought I might try with Blender would be to design a whole level mesh and then chop it up into zones by adding portals at appropriate places. This would mean that the matching pairs of portals would be created at the same time and based on the same vertices. However, this method would make it difficult to create zones. I would need some way of splitting the mesh and keeping track of what parts belonged to each mesh. This would be especially difficult if the level was toroidal in design – when you add the first portal, you would still only have one zone!
It's a pity Blender uses Python instead of allowing C++ plugins. Learning Python is killing me! Indentation to define code blocks, instead of brackets - madness!
So what's everyone else using or working on for level creation?
OlRaygun
11-01-2009 13:44:45
I'm interested in this too. Jacmoe advised that I use PCZSM for my needs, here -
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=47038
But this leads to the question of tools. PCZSM doesn't support any sort of serialization (on purpose), so its every man for himself, right?
I guess I'm going to have to learn Blender scripting with Python after all..
Chaster
12-01-2009 04:57:43
Yeah, PCZSM doesn't include any tools to create the zones & portals (by design - we didn't want to force any particular solution down people's throats), so you need to design your own way of doing this.
For me, my artist uses Max, so we devised a system using OgreMax that allows us to specify meshes for Zones and for portals. It works pretty well, but it is limited to OgreMax. We just brought on an artist who uses Maya, and he's SOL for creating levels. He'll have to use Max (or at the very least, export to a Max-readable format, and then edit in Max, and re-export)...
Chaster
Shockeye
12-01-2009 08:22:30
OlRaygun, I checked out that thread you mentioned. Using another level editor and importing into Blender as discussed seems like a good idea. Blender lacks a lot of features for level editing.(Actually the problem is that it has to many features - which lets you too easily build meshes that are not constrained by the rules that a level mesh needs) I imagine there might be some licensing concerns if one where to use an editor from another game, for example Hammer or UnrealED.
Anyway, if you try using Blender, you might want to look for a python script called "checkintegrity.py" by a guy called Yorick. It checks a mesh for non-manifold edges and you can use it to make sure your mesh doesn't have holes.
Chaster, I agree with the decision not to have built in tools. There's just too many possible uses for a scenemanager like this. And I would hate to be forced to used a specific modeller, especially a commercial one with all the expense that entails. But I'm curious to know what others are trying.
My first (overly ambitious) idea was to implement a CSG modeller using OgreMVC. But the only documentation on CSG algorithms I could find was the Laidlaw one from the early eighties. I gave up after a few weeks and decided to use Blender.
lvella
12-01-2009 20:29:05
The other technique that I thought I might try with Blender would be to design a whole level mesh and then chop it up into zones by adding portals at appropriate places. This would mean that the matching pairs of portals would be created at the same time and based on the same vertices. However, this method would make it difficult to create zones. I would need some way of splitting the mesh and keeping track of what parts belonged to each mesh. This would be especially difficult if the level was toroidal in design – when you add the first portal, you would still only have one zone!
This is more or less what I do.
I have the whole level designed in one Blender scene, then I split it up into zones. The way I found on how to define the zones was simple: I add an empty object, name it with the name of the zone, then add a Game Logic property called "type", with "zone" as the value, then I parent this empty object to all the objects of the zone. My script, while exporting the scene, looks for the "type" property to find out the roles of the objects inside the game, being "zone" and "portal" two of these roles. When the script find an object with "type"="zone", then all its children are placed in this zone.
For the portals, it is similar: each portal is a quadrilateral coplanar mesh, with "type" = "portal" and two other properties: "z1" and "z2", each one referencing to a zone, being "z1" the zone the portal is facing to (to know where the portal is facing, I use the button "Draw Normals").
Later I found another feature that should be better suited for defining the zones, called Object Groups:
http://www.blender.org/development/release-logs/blender-242/object-groups/. I would search about this if I was writing the script right now.
Shockeye
13-01-2009 08:12:22
Why do you use an Empty? I've been adding a Property of "PCZSMdata" = "zone" to the mesh object itself.(and PCZSMdata = portal for portal meshes, obviously) Any portals are created from faces in the mesh by copying the 4 verts and then creating a new mesh which is made a child of the zone mesh.I haven't got as far as adding any thing other than portals to a zone, but I would have thought you could just make any static meshes , waypoints, playerstarts etc children of the zone mesh in Blender.
Its a pity you can't add Properties to individual faces in Blender, that would make the whole thing easier.
OlRaygun
13-01-2009 13:00:58
OlRaygun, I checked out that thread you mentioned. Using another level editor and importing into Blender as discussed seems like a good idea. Blender lacks a lot of features for level editing.(Actually the problem is that it has to many features - which lets you too easily build meshes that are not constrained by the rules that a level mesh needs) I imagine there might be some licensing concerns if one where to use an editor from another game, for example Hammer or UnrealED.
Yes, I understand that its quite possible to mess up your level using Blender. But still, adding another (potentially not so well suited for the purpose) tool doesn't seem like a good idea. Especially considering potential implications you've mentioned.
I think I'm gonna have to modify Blender .scene exporter after all, to make it recognize and export some objects as zones/portals. After all, I've done something like that for Maya about 4 years ago, can't be that hard (although I've never used Python before
![Rolling Eyes :roll:]({SMILIES_PATH}/icon_rolleyes.gif)
)
Anyway, if you try using Blender, you might want to look for a python script called "checkintegrity.py" by a guy called Yorick. It checks a mesh for non-manifold edges and you can use it to make sure your mesh doesn't have holes.
Thanks for the tip!
lvella
13-01-2009 13:19:51
My zones do not have a "determining mesh". If I understood, you have a "main" mesh for the zone that are probably its walls, but my zones are just a pack of objects spatially close to each other. I don't parent the portals to any zone because, since I model the whole level in one blender scene, each portal belongs to two different zones, and one object can not have two parents.
Doing it separately, I think you will have problems remounting the scene, since the corresponding portals locations must match. Anyway, it is easy to identify special faces in you mesh. In 'Editing (F9)' panel, under 'Material', there are tools to separate the mesh's faces to use different materials. You could simply create a special "portal" material and assign it only to faces meant to be portals.
By the way, I wrote from scratch the tool for exporting blender scenes, for my own XML format. I should release it soon...
OlRaygun
13-01-2009 14:36:54
You could simply create a special "portal" material and assign it only to faces meant to be portals.
Probably, sounds logical.
BTW, could you please answer my naive
![Very Happy :D]({SMILIES_PATH}/icon_biggrin.gif)
question: how would you create a non-quad portal, since PCZ SM supports quads but not n-gons (and spheres and AABs). I can imagine using many co-planar quads to make my arch or whatever, but wouldn't that cause a performance hit?
Oh, and by the way, check this out:
http://www.ogre3d.org/forums/viewtopic.php?f=11&t=46869
The author says he plans to support PCZ SM. Yay!
lvella
13-01-2009 16:59:23
BTW, could you please answer my naive
question: how would you create a non-quad portal, since PCZ SM supports quads but not n-gons (and spheres and AABs). I can imagine using many co-planar quads to make my arch or whatever, but wouldn't that cause a performance hit?
I am not sure what you mean by arch portal, but the portal inside the scene manager is invisible, its just a mark that limits the zones. If you want to build a portal in the common sense, like this:
http://www.sirgeorgetrevelyan.org.uk/books/images/bk-arch-fig06c.gif, you can simply model the arch, and put inside it the quad portal of the scene manager.
Oh, and by the way, check this out: http://www.ogre3d.org/forums/viewtopic.php?f=11&t=46869
The author says he plans to support PCZ SM. Yay! ![Cool 8)]({SMILIES_PATH}/icon_cool.gif)
Well, won't work for me, since I don't have Windows at my work place.
OlRaygun
13-01-2009 23:25:55
I am not sure what you mean by arch portal, but the portal inside the scene manager is invisible, its just a mark that limits the zones. If you want to build a portal in the common sense, like this: http://www.sirgeorgetrevelyan.org.uk/books/images/bk-arch-fig06c.gif, you can simply model the arch, and put inside it the quad portal of the scene manager.
Dang, that was a dumb question
Yes, I meant an arch like the one you've shown. Could have guessed myself that making an encompassing quad would simply give false positives as far as zone visibility is concerned (I mean, PCZ SM would simply draw the adjacent zone when its not really visible in some cases).
Shockeye
14-01-2009 09:07:00
Ivella, thanks for that idea about using the portal material, that'll make things a lot easier.
(although after doing some research on the blender wiki I have worked out what was going wrong with my face to mesh code, so its a shame I won't need it now that I can just use the materials to make portals
![Very Happy :D]({SMILIES_PATH}/icon_biggrin.gif)
)
OlRaygun
01-02-2009 15:12:55
Just wanted to mention this small "howto" on creating and loading levels (ahem) for PCZ SM which I've concocted hastily
![Rolling Eyes :roll:]({SMILIES_PATH}/icon_rolleyes.gif)
:
http://akireev.freehostia.com/pcz_blender_howto.html
(with modified exporter scripts and a test loader project)
I wouldn't call it a proper HOWTO, more like a cheat sheet for myself..
Shockeye
05-02-2009 12:05:12
OpenCSG is not for geometry, its for CSG rendering.
There actually a few libraries out there, but with problems.
GTS has good licensing terms but: "The code is written entirely in C with an object-oriented approach based mostly on the design of GTK+." ANd not much sample code etc. So I couldn't understand how to use it.
CGAL has some CSG feature, but is licenced under a mixture of LGPL
![Smile :)]({SMILIES_PATH}/icon_smile.gif)
and QPL
![Sad :(]({SMILIES_PATH}/icon_sad.gif)
. And guess what the CSG features are licensed under...
"C with an object-oriented approach"
![Question :?:]({SMILIES_PATH}/icon_question.gif)
why didn't they use C++?
xadh00m
05-02-2009 15:15:51
I think it should be easy to integrate Portals into an ogre scene with custom properties using the coming up WYSIWYG SceneEditor of Stealth977:
http://www.ogre3d.org/forums/viewtopic.php?f=11&t=46869&start=0
Its just a small xml property specification for e.g. a custom entity (which represents the portal in the editor)...
xad
steven
25-07-2009 03:09:06
Just wanted to mention this small "howto" on creating and loading levels (ahem) for PCZ SM which I've concocted hastily
: http://akireev.freehostia.com/pcz_blender_howto.html
(with modified exporter scripts and a test loader project)
Nice. You should put a link on the ogre wiki or it will get lost in the forums. Perhaps in the article.