[.net] 3D engine editor
Now that I'm back from the hospital I should have time to do some work..
I'm working on a new engine in C# and I have a bit trouble combining it with windows GUI. The engine itself works just fine, but now I want to create a simple editor for it. I need to have engine renderer in one componenet(panel) and a bunch of buttons and other components around. The problem is that the moment I start renderers main loop (I'm using kerner/service system) the GUI stops responding. I have been thinking about using multithreading but I have no idea what to put in other thread. Only kernel or whole engine? I have seen some people (The Senshi) using C# 3D editors but I couldn't found a source code for any of them so see how they did it. Would someone with some experience in this area hive me a few tips how to go on.
ps:
Just a side question: did any of you working on game engine in C# divide engine in a bunch of projects (like math, sound, kernel, input, tools...) like me or do you keep whole engine in one project.
In your Main function there's a call to Application.Run, this has a loop itself that basically drives the entire UI. If you run your render loop on the same thread, then the Application.Run loop won't get to run, and all UI activity freezes.
To get around this I'd have the engine redraw itself when needed, such as when you delete or add an object to the world. You won't get an editor that animates in realtime this way.
Another solution is to create a System.Windows.Forms.Timer object; tell the engine to render/update itself on every timer tick. The smallest timer resolution is a bit higher than if you updated in a plain loop, though, so it might give it a jerky feel (I'm purely conjecturing here, I have no idea really).
And another solution is to implement the Application.Run loop yourself, updating/rendering your engine when there are no other messages in the message queue for the thread. I don't know if this is possible with only .NET. You might also want to look into the Application.Idle event. You can update/render in there, but I don't think it's called repeatedly so you'll need some way to continue updating/rendering after the first Idle event firing, and stopping when there are messages to process.
I just found this. That's probably the simplest solution that sounds like it'd work, but it also sounds inefficient based on the comments. Someone out there recommend something :)
To get around this I'd have the engine redraw itself when needed, such as when you delete or add an object to the world. You won't get an editor that animates in realtime this way.
Another solution is to create a System.Windows.Forms.Timer object; tell the engine to render/update itself on every timer tick. The smallest timer resolution is a bit higher than if you updated in a plain loop, though, so it might give it a jerky feel (I'm purely conjecturing here, I have no idea really).
And another solution is to implement the Application.Run loop yourself, updating/rendering your engine when there are no other messages in the message queue for the thread. I don't know if this is possible with only .NET. You might also want to look into the Application.Idle event. You can update/render in there, but I don't think it's called repeatedly so you'll need some way to continue updating/rendering after the first Idle event firing, and stopping when there are messages to process.
I just found this. That's probably the simplest solution that sounds like it'd work, but it also sounds inefficient based on the comments. Someone out there recommend something :)
Thanks mutex for some nice sugestions!
This is not an option here. There are animated objects in game that should also be animated in editor.
I tried this before but either I messed up something or it feels very jerky.
This looks best solution I have so far. I'm gonna try to iplement it now, but I have to redesing a few things to make it work. I'll post back with results.
If anyone has any comment about this please reply.
Quote:
To get around this I'd have the engine redraw itself when needed, such as when you delete or add an object to the world. You won't get an editor that animates in realtime this way.
This is not an option here. There are animated objects in game that should also be animated in editor.
Quote:
Another solution is to create a System.Windows.Forms.Timer object; tell the engine to render/update itself on every timer tick. The smallest timer resolution is a bit higher than if you updated in a plain loop, though, so it might give it a jerky feel (I'm purely conjecturing here, I have no idea really).
I tried this before but either I messed up something or it feels very jerky.
Quote:
I just found this. That's probably the simplest solution that sounds like it'd work, but it also sounds inefficient based on the comments.
This looks best solution I have so far. I'm gonna try to iplement it now, but I have to redesing a few things to make it work. I'll post back with results.
If anyone has any comment about this please reply.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement