Sign in to follow this  

[.net] 3D engine editor

This topic is 4664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
Thanks mutex for some nice sugestions!

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.

Share this post


Link to post
Share on other sites
OK, I've implemented something simmilar to what mutex posted and it works just fine so far. I still have to build bunch of subsystems to test engine with some heavy stuff.

Ridge: thanks for link (I've seen it before)

Share this post


Link to post
Share on other sites

This topic is 4664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this