a few issues.

Jan 30, 2010 at 12:43 PM

hi again (posted as requested) :)
got a couple of problems.
one is to do with the physics so you might not be able to help, although the jiglibx wiki is kinda poor.
1) im using
protected override void UpdateHook(GameTime gameTime)
"heyhey", new Vector2(20, 20), Color.White);
// TODO: Put your game's update code here
to try and display text on the screen, this is quite important to me both for debug and other stuff. is it possible to display my own text, or do i have to use the Gui Editor?
2) the physics and collision system is kinda, well. tough.  i would love to know if i can easily implement a simple wrapper for your engine + jiglib to have a line of code like
if (thisobject.collides(otherobject)
//code in here
although i realise that the actual code required for a collision may be a lot more complicated.
and finally, a secret third query.
is it possible to implement a constant velocity to a physics object? ive tried most of the parameters within a "body" but none seem to do what i want.
thanks in advance

Jan 30, 2010 at 2:23 PM
Edited Jan 30, 2010 at 2:23 PM

NOTE: this reply assumes you've installed Release 65 and if using an earlier version, have followed the directions on the installer page for Program.cs.

1) Never attempt any drawing in an update loop. If you want a little debug console in the engine, you'll have to extend the system to provide the facility. If I were you, I'd probably extend the GuiSystem to have an optionally visible console gui component. Extending the GuiSystem (or any other services) also means extending the DefaultEngine to create your new GuiSystem by overriding DefaultEngine.Create...Hook(). In turn, this also means changing EngineConstructionToken in Ox.xml to create your new DefaultEngine.

As you can see, extending the engine in this way is a little extra work. Once you initially get it set for extension in this way, though, you'll never have to set it up again - and you'll have _complete_ control over Ox.

If you create a functional debug console thingy, you could send me the code and I could consider integrating it into Ox's code base :)

2) If you have common functionality you'd like to factor out and simplify, consider using the Subcomponent extension system. A single subcomponent class can set up and handle physics for different types of components. It could expose a simple OnCollided event that you can pass control into. Leveraging the subcomponent idiom will allow you to move most of the common code out of components into nice, simple, little classes. The only thing the components have to do is create their appropriate subcomponents in the script's constructors and assign behavior to the OnCollided event.

I was wanting to allow the player to set up subcomponents for components inside the editor, but haven't gotten around to it yet. It's not a terribly high priority.

3) No idea; that's buried in JigLibX land. You could simply monitor the velocity of an object every frame, then apply an impulse if it's under a certain amount. This would also be implemented nicely as a subcomponent. Any generally useful behavior is often a candidate for being implemented as a subcomponent. As you develop more subcomponents, you'll have accumulate a lot of reusable functionality over time.

Feb 2, 2010 at 10:53 PM

The scene Editor seems to have a problem. "Value cannot be null" when trying to create any new object, have got the newest version here.


Feb 2, 2010 at 11:09 PM

aha, geez :) I fail @ codez here lately.

fix is in SVN now, though :)