Changing game demo scene

Apr 11, 2009 at 2:25 PM
Great engine, been digging with it and have encountered a few issues.

I open the scene editor and try to change the skybox texture.

Where do I put my new skybox texture at?

No matter where I put it in the project, I continually get a file not found error when I try to change Ox\Texture\skyCubeMap to Ox\Texture\mySkyCubeMap

Appreciate any help, thanks
Apr 11, 2009 at 4:30 PM
More issues.

Start with game demo project running on xbox 360.

Go into scene editor and add a skinned model.  No changes nothing fancy.

Now run project and get an invocation error. 
Does every object need its own script?

Not getting crazy yet, just want to render the playermarine model.

On another note, when I try to write a script for the playermarine, the ISkinnedModelComponent isn't listed as a component type in the following line of code.
Try to replace inormalmapped with iskinned and won't work, thanks.



class ExampleActor : ComponentScript<INormalMappedModel>, ICollidable


Apr 11, 2009 at 8:48 PM
Edited Apr 11, 2009 at 9:10 PM

From the documentation -

Q. How do I access my game’s content in the editors?

A. By default the editors have access only to content provided by Ox. To make your game’s content available to the editors, you have to edit the editor’s OxConsts.xml file. Specifically, you must modify the <ContentRootDirectory> path to point to your project’s output content folder. The output content folder is the folder that contains the compiler-generated .xnb files, not the artist-created source files.
Apr 11, 2009 at 8:59 PM
Scripts are not required for any object. They are always optional.

ISkinnedModelComponent does not inherit from INormalMappedModel, so that will and should throw an exception.

Are you specifying your script's fully-qualified name in the text-box? If not, the script won't be found.

What do you mean by ISkinnedModelComponent is not listed? Listed how, where?
Apr 11, 2009 at 11:58 PM
I found the reason for your invocation exception. It's a bug in Ox. Yet another bug fix release will be issued ASAP.

Sigh @ my lack of regression tests...
Apr 12, 2009 at 3:12 AM
Ok, the new version is up. Please pull it down and try what you were doing again. If you have any more problems, please let me know and I will fix them immediately.
Apr 12, 2009 at 1:03 PM
Thanks so much for answering my questions.  Your engine is really a hidden gem, and the more I dig into it the more features I find.

I will go download and see how it works now, thanks.
Apr 13, 2009 at 10:59 PM
Another question for you.  When I run the game in windows I shadows, when I run on the XBOX 360 I don't see shadows, is this correct?

Thanks again!
Apr 14, 2009 at 12:18 AM
Yes, that is the intended behavior. Shadows simply don't work on the Xbox due to the hardware particulars of the current algorithm. I hope to rewrite that shadows when they trump the other things that need done :)
Apr 14, 2009 at 5:52 AM

Another question if you don't mind, looking at the gui demo it shows an example of a gui that is crafted within the code.

How do I load a gui made with the editor?  This is what I tried.


guiSystem = engine.Services.Get<






IPanel screen = new Panel(engine, DomainName, true) { Parent = engine.Root };


screen.LocalPosition =



screen.LocalScale =



screen.Color =

new Color();


guiSystem.Screen = screen;


"Documents/PauseGui.xml", GuiConsts.GuiDocumentType, DomainName, true);

Thanks much.


Apr 16, 2009 at 9:10 AM

Sorry for taking so long to respond :(

After you load the document with that last line, you have to call up the root GUI component by its name via that engine.GetComponent<IGuiComponent>("NameOfComponent"); call where "NameOfComponent" is the name you gave to it in the editor. So if the root component is named "PauseWidget", you would do this -

IGuiComponent pauseWidget = engine.GetComponent<IGuiComponent>("PauseWidget");
pauseWidget.Parent = screen;

or, if the pauseWidget IS a screen you just do this for the second line instead -

guiSystem.Screen = pauseWidget;

Let me know if this works out for ya!
Apr 16, 2009 at 6:53 PM
Sounds like just what I needed to know.  Thanks again for all the timely feedback.
Apr 19, 2009 at 9:39 PM
Quick bug I found in release 56.  Start editor, add a skinned model component, crash.  Same error is causing all my old scenes to not work.  Thanks.
Apr 20, 2009 at 3:31 AM
Ya, I found it. I hope to have the next release up ASAP.
Apr 20, 2009 at 1:19 PM
Edited Apr 20, 2009 at 1:19 PM
Ok, the fix is in release 57 :)

Sorry about the error :/
Apr 22, 2009 at 2:47 PM
How goes it, seems this is my thread for asking you ox questions.  Few questions this morning.

My current Player script clamps the player to the heightmap, which is what I need for my game.  To do this I used the GrabHeight function.  I have it working fine, but only on a level with a quad scale of 1!  Now I scaled all my components down so it looks fine just everything being scaled down.  When I use a quad scale of >1 on the terrain, I cannot accurately grab the correct height.  Just wondering if you had any insight into the grab height function and why this might be hapening.  I understand that the Player's position must be converted because it seems that grab height grabs a height based on the pixel coordinates, and not the actual localposition.  Insights appreciated on this one, once again I have it working but wanna understand ur engine better.

Still can't get the GUI components to load right.  In the application I add this code:

guiSystem.Screen = screen;

engine.LoadDocument("Documents/PauseGui.xml", GuiConsts.GuiDocumentType, DomainName, true);

IGuiComponent panel= engine.GetComponent<IGuiComponent>("Panel");
panel.Parent = screen;

This throws an error at the IGuiComponent panel= engine.GetComponent<IGuiComponent>("Panel"); line.
I also try changing IGuiComponent to IPanel and still no luck.

I really wanna get my own gui system to work with ox.  What is the quick and dirty way for me to access the graphics device and draw gui components without using the gui system.  Not that your system is bad, but its easier for me to use the dozens of gui elements I already have than to recreate ones in a different format.

Thanks for taking the time to answer my questions.

Apr 22, 2009 at 10:37 PM
Ox's editors to do expose this yet, but you can't get a component by its default name. If you create a component in the editor but do not give it a non-default name, it will be inaccessible via engine.GetComponent(). So give it a non-default name.

(The next version of the editor will express this fact better.)

Ox makes the graphics device available easily. Just use the properties Engine.GraphicsDevice and Engine.GraphicsDeviceManager.
Apr 22, 2009 at 11:06 PM
As to the need to convert because of a change in QuadScale, you have to do it manually. Not much else I can say :)
Apr 24, 2009 at 1:29 PM
Thanks again for the answers.  Yeah I was doing the math to convert the coordinates when using quad scales, and my heightmap that the player was walking on was 90 degrees off from the actual heightmap!  Almost melted my brain to get the math changed to line it up right. 
Apr 25, 2009 at 4:54 PM
Finally got back to working on my gui and here is the problem I have.

In the application file I create a spritebatch


public SpriteBatch spriteBatch;

Then once engine is initialized I associate the spritebatch with the engine's graphics device

spriteBatch =

new SpriteBatch(engine.GraphicsDevice);

Now in the draw method after the engine has draw itself I add the following code





Vector2.Zero, Color.White);




Now this does draw my minimap atop the image but with many problems.
1. The 3d components are all whacked out in the scene, water is drawn on top of land, and textures for 3d boxes on top of those.
2. Some weird brown image appears to be flickering on and off ever 3-4 seconds.

Should I be using spritebatch?
Is there another way to directly draw 2d textures atop of the 3d engine?

Thanks for the help.

Apr 26, 2009 at 12:12 AM
SpriteBatch is perfectly fine, but you have to know the minutiae of using it :)

Basically, when SpriteBatch does its drawing magic, it changes the device RenderState dramatically. Ox's out-of-box components expect the RenderState to be in a defualt state. So hopefully all you have to do is SpriteBatch.Begin with the SaveStateMode overload found here -

In your case, I think you'd use it like this -


Here's more details from the FAQ forum -