-
|
|
How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
( Edit: I have updated the document for XNA 3.0, the link points to the updated version.) (Edit 27 May 2009: Example have been updated as well, and a mistake in the tutorial code has been corrected).
Feedback welcome.
ht
Code Spot Tutorials, Game Prototypes, Tools
|
|
-
-
- (0)
-
premium membership
-
Posts
2
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
This is a brilliant document. I was worried I'd have to create my own editor, but this inspired me to do it within XSIm though I wrote my plugins using VBScript.
I did manage to get it working on XNA 3.0 with some fiddling, but I'm still trying to get my head around on building the Content Processor to have it build and load my content dynamically
|
|
-
|
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
|
|
-
-
- (5)
-
premium membership
-
Posts
4
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
Hey Eduardo, I was curious as to what pitfalls you ran into when using XSI and the document to load your levels.
And were you able to get your dynamic pipeline going?
Since no good level editor is out there, I was looking at this with interest. :)
|
|
-
|
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
nice, i will have to check this out later. getting a level editor, like this to load and actually work would be priceless and i see where it was updated for 2.0. now for 3.0!
any help from someone that has actually got a level editor to 'work' would be of great value to the community. :)
|
|
-
-
- (0)
-
premium membership
-
Posts
2
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
I decided to postpone my dynamic loading of the content because it seemed like a bit of an overkill for the size of the project right now, so it isn't high on my priorities, but I'll definetely check it out later. The Level Editor worked as a proof of concept. I haven't actually made it useful yet as I am still working out what my entities are going to be made of. But I found very useful that you can add custom properties to every model in XSI (properties that do not necessarily need to be related to the rendering process).
So I am thinking about defining the Components of my entities as custom properties that are going to be written into the XML.
My entities are build out of individual components (Graphics, Physics, Audio, Particles, AI, etc...). and I can define what components each entity has and what parameters that component takes in XSI. I'm still trying to work out how to build Inherited entities. for instance:
If I have a Spaceship Class, I'll probably want to have a Fighter Class and a Hauler Class that both inherit the components from the Spaceship class but have their own particular parameter and/or extra components. This Inheritance in the editor bit I'm still trying to figure out. And it might not be very trivial, so I guess this would be one of the pitfalls.
|
|
-
|
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
Sorry ahead of time if this isn't the best place to post this.
I've been trying to figure this out since it's a very interesting Idea. I have just started though so my knowledge of the mod tool and python is pretty non existent. I get the concepts of everything you have in your tutorial but I'm getting some errors with AddParameter3 method concerning adding custom parameters to the property set. I basically copied and pasted your code the same way you had it. I've tried searching python specific problems but can't come up with anything but I could be searching for the wrong thing. Maybe someone can point me in the right direction. see error below.
Thanks,
Artimus
| # ERROR : Traceback (most recent call last): |
| # File "<Script Block >", line 85, in <module> |
| # test() |
| # File "<Script Block >", line 73, in test |
| # addMyPropertySet(obj) |
| # File "<Script Block >", line 54, in addMyPropertySet |
| # pSet.AddParameter3(parmName, constants.siFloat, 0.5, 0.0, 1.0) |
| # File "C:\Python25\Lib\site-packages\win32com\client\__init__.py", line 454, in getattr__ |
| # raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) |
| # AttributeError: '<win32com.gen_py.Softimage|XSI Object Model Library v1.5.Property instance at 0x864418352>' object has no attribute 'AddParameter3' |
| # - [line 54] |
| |
|
|
-
-
- (1195)
-
premium membership
MVP
-
Posts
896
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
Have to give it a read during the week.
|
|
-
|
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
@Artimus
Can you post some code so that we can see what (exact) code is giving you the problem?
The error you are getting is very common [at least, I have seen it many times]. Usually it is because your object is not of the type that you think it is, sometimes because of a logical mistake, sometimes because of XSI weirdness. Because of the way XSI wraps objects, it is hard to find out what type an object really is. Also, the types of things in XSI is really confusing, and the documentation is not sufficient to clear things up...
ht
Code Spot Tutorials, Game Prototypes, Tools
|
|
-
|
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
I was basically trying to just use the examples from the tutorial to see how it works and how to use the custom properties. Yeah I found it quite difficult to find documentation. Thanks for your help.
just a side note, the custom property gets created fine but can't get the parameters to work.
Heres the code.
| def addPorpertySet(obj, propertyName): |
| pSet = obj.Properties(propertyName) |
| |
| if pSet == None: |
| obj.AddCustomProperty(propertyName) |
| |
| |
| return pSet |
| |
| from win32com.client import constants |
| |
| def addMyPropertySet(obj): |
| pSet = addPropertySet(obj, 'Test') |
| parmName = 'Float_Test' |
| parm = pSet.Parameters(parmName) |
| |
| if parm == None: |
| pSet.AddParameter3(parmName, constants.siFloat, 0.5, 0.0, 1.0) |
| |
| parmName = 'Bool_Test' |
| parm = pSet.Parameters(parmName) |
| |
| if parm == None: |
| pSet.AddParameter3(parmName, constants.siBool, True) |
| |
| parmName = 'String_Test' |
| parm = pSet.Parameters(parmName) |
| |
| if parm == None: |
| pSet.AddParameter3(parmName, constants.siString, 'Hello') |
|
|
-
|
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
OK, there is a small mistake in the tutorial code. In the addPoprertySet function, pSet must be assigned to the return value of the call obj.AddPropertySet. Otherwise it is None, casusing problems where that value is used.
The correct code is below (the change is in line 5). Also note that you mistyped addPropertySet.
Sorry for this mistake; I have corrected the tutorial. BTW - I updated the example that goes with the tutorial as well. Grab it from here (5.2 MB, zip). (It includes the updated PDF).
| 1 | def addPropertySet(obj, propertyName): | | 2 | pSet = obj.Properties(propertyName) | | 3 | | | 4 | if pSet == None: | | 5 | pSet = obj.AddCustomProperty(propertyName) | | 6 | | | 7 | | | 8 | return pSet | | 9 | | | 10 | from win32com.client import constants | | 11 | | | 12 | def addMyPropertySet(obj): | | 13 | pSet = addPropertySet(obj, 'Test') | | 14 | parmName = 'Float_Test' | | 15 | parm = pSet.Parameters(parmName) | | 16 | | | 17 | if parm == None: | | 18 | pSet.AddParameter3(parmName, constants.siFloat, 0.5, 0.0, 1.0) | | 19 | | | 20 | parmName = 'Bool_Test' | | 21 | parm = pSet.Parameters(parmName) | | 22 | | | 23 | if parm == None: | | 24 | pSet.AddParameter3(parmName, constants.siBool, True) | | 25 | | | 26 | parmName = 'String_Test' | | 27 | parm = pSet.Parameters(parmName) | | 28 | | | 29 | if parm == None: | | 30 | pSet.AddParameter3(parmName, constants.siString, 'Hello') | | 31 | | | 32 | | | 33 | addMyPropertySet(Application.Selection[0]) |
Code Spot Tutorials, Game Prototypes, Tools
|
|
-
|
|
Re: How to Turn XSI Mod Tool into a Level Editor for your XNA Games
|
That worked. Thanks. I still have problems doing my own (adding parameters to the property set) Seems like it's just really temperamental in xsi, but it could just very well be me, i'll keep playing. Thanks again.
-Artimus
|
|
|