XNA Game Development Forums
2012/05/18 06:45:04 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1] 2
  Print  
Author Topic: XNA/HMEngine embedded in a WinForm, has anyone else done it?  (Read 4779 times)
Arkcann
Newbie
*
Offline Offline

Posts: 23


View Profile
« on: 2007/03/17 19:52:51 »

I was just wondering if anyone else has managed to embed the HMEngine into a WinForm (so that WinForm controls can be used), I ask this because I've recently manager to do it but I've been having problems with my camera's SLERPs getting jagged near their end. I'm pretty sure this is because using WinForms requires you to ditch the Game class that comes with the XNA framework due to multiple reasons, because of this there is no more fixed time step which would cause the jaggedness in my SLERP functions. Unfortunately I am unsure how to replicate a fixed time step using WinForms, I remember reading something about it once but at the moment I'm rather tired and am unable to do much  Wink , so my main question is if anyone knows how to replicate the fixed time step used by the XNA Framework's Game class, or if anyone has any other ideas why my SLERPs may be jagged (as in stuttering).

P.S. anyone else has successfully embedded the HMEngine into a WinForm, I'd love to hear about any other potential problems I may meet so that I can deal with them now. Also I may be able to provide my project's code if a group of people would like to see it.

Thanks!
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #1 on: 2007/03/18 13:21:28 »

You might want to have a look at the old timer class that was used in the Managed DX version of the engine. It is basically and instantiatable (sp?) version of the Timer that comes with the DirectX Framework, and it works pretty well for the same tasks as the XNA gametime class.
Logged
Arkcann
Newbie
*
Offline Offline

Posts: 23


View Profile
« Reply #2 on: 2007/03/19 10:08:17 »

While the timer class is helpful, the tutorial didn't mention how to use it to limit the FPS to certain range or to a fixed amount, such as 30 FPS. Perhaps someone knows how to make sure my render() and update() methods are staggered to keep a constant FPS? Thanks to anyone who can help out
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #3 on: 2007/03/19 16:35:01 »

All you would need to do is check every draw call at the beginning if your timer has elapsed by the correct time amount and only finish drawing if it has.

For instance:

Code:
float maxFPS = 30;
float timeToDraw = 1.0f / maxFPS;

Draw(){
    if(Timer.GetElapsedTime() > timeToDraw){
        // start timer at zero again here

        // render the scene here
    }
}
Logged
Arkcann
Newbie
*
Offline Offline

Posts: 23


View Profile
« Reply #4 on: 2007/03/20 10:03:24 »

Okay, I understand most of that except the part about starting the timer at zero after ech succesful Draw call, I take this to mean that I should have a timer dedicated to my Draw() method?
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #5 on: 2007/03/20 18:08:09 »

not necessarily a timer, but a value that keeps track of elapsed time by calling the timer at least.
Logged
Arkcann
Newbie
*
Offline Offline

Posts: 23


View Profile
« Reply #6 on: 2007/03/20 18:28:21 »

Okay I understand, by the way if you don't mind me asking, when might a new tutorial come out and what might it be about? I've been working on a simple physics engine (just motion at the moment, like gravity, acceleration etc.) but I'd definitely like to see a tutorial aimed at this problem. Thanks for the help!
Logged
muchrejoicing
Newbie
*
Offline Offline

Posts: 46


View Profile
« Reply #7 on: 2007/03/20 21:06:13 »

This is getting off-topic, but: I've been interested in what's coming up as well. It'd be a lot of help for me, as a complete novice, to see an outline of what goes in to an engine.

Put another way: if you were just starting to work on game engines today, what would you read? I'm still at that point where I don't know enough to figure out what to read first. All the tutorials I find are "here's how to write pong," something a little too. I want to start working on games where I'll need a scene graph, not one where all my objects are fields of the MyGame class. I'm willing to figure out details (like how to render sprites -- the grunt work); the overarching structure is getting hard to grasp.
Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #8 on: 2007/03/21 00:02:38 »

There are books out like 3D game engine structure, or 3D game engine design which answer those questions. There isn't a whole ton on things like scene graphs for XNA, thats why Mike's tutorial is so good. But if you know C++ and think you can convert it, or can find a good theory one, there are a whole bunch of resources out there on design and structures.
Logged

muchrejoicing
Newbie
*
Offline Offline

Posts: 46


View Profile
« Reply #9 on: 2007/03/21 18:29:18 »

Thanks -- just having the right keywords helped; I googled up with an old article on game engines in no time. In case anyone else needs as much background info as me, and doesn't know where to find the resources, here's a start:

http://www.extremetech.com/article2/0,3973,594,00.asp

Edit: As it turns out, the article doesn't offer any hints at how things work; oh well.
« Last Edit: 2007/03/21 20:38:39 by muchrejoicing » Logged
Iterion
Newbie
*
Offline Offline

Posts: 3


View Profile
« Reply #10 on: 2007/04/03 10:41:08 »

Arkcann, could you maybe give your code for how you implement the engine into a win form?  I'm kinda stuck.

Thanks.
Logged
Arkcann
Newbie
*
Offline Offline

Posts: 23


View Profile
« Reply #11 on: 2007/04/04 19:12:05 »

I would, but I've sort of forgot how it works since I gave up on it. While I could get it to work, it ran very slow on a rather good computer, it would be more suited for a developer editing a game's levels then it would be for an end-user interface. The file that I found on the internet that showed me how to do it was called RenderToPictureBox21, you might be able to find it through google, also a timer class was difficult to implement into the WinForm so all of my physics were messed up. I'd suggest using Xna5D or some other GUI component made for XNA, it'd be easier to implement and wouldn't hinder your game's FPS by that much. Good luck if you on whatever you decide on
Logged
Iterion
Newbie
*
Offline Offline

Posts: 3


View Profile
« Reply #12 on: 2007/04/05 12:03:21 »

Thanks for the suggestions.

I wasn't really wanting for a game interface, actually more of a scene editor.  But, maybe something like Xna5D would work for a scene editor.  Perhaps I'll mess around to see what i can get.

Anybody else have any suggestions?

Logged
muchrejoicing
Newbie
*
Offline Offline

Posts: 46


View Profile
« Reply #13 on: 2007/04/05 16:23:43 »

A quick google search for "xna in a WinForm" found several approaches, none of which involved a true XNA Game class -- probably because XNA handles window creation itself, and that's what embedding your game in a Panel would involve. I'm guessing it'd be easier to make an app that includes a WinForm for the tools and other controls (in one thread), and an XNA Game in another thread.

Ultimately, that wouldn't be XNA in a WinForm, but rather XNA side-by-side with one. For content-editing purposes, that should be close enough.
Logged
Tiago
Newbie
*
Offline Offline

Posts: 42


View Profile
« Reply #14 on: 2007/04/05 21:45:56 »

oohh i like that even better, thanks for the idea
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
XNA GameStudio General Discussion « 1 2 » Chr0n1x 25 7539 Last post 2007/02/02 09:08:08
by mikeschuld
so xna... General Discussion nordwindranger 3 1957 Last post 2006/10/20 12:44:58
by BrophyJ
How to show 2D Sprites in HMEngine? Hazy Mind XNA Engine Arkcann 2 1681 Last post 2007/03/25 05:54:32
by Arkcann
HMEngine Code Hazy Mind XNA Engine Canuck 2 1852 Last post 2007/05/30 21:12:19
by Canuck
XNA Animation Component Library in XNA HMEngine Hazy Mind XNA Engine dotslash 0 2617 Last post 2007/05/31 13:53:12
by dotslash
Games Written in HMEngine Hazy Mind XNA Engine listentorick 3 2202 Last post 2007/06/06 00:28:53
by Chr0n1x
Physics simulation: BulletX (Bullet for XNA) physics and Hazy Mind Xna Engine Hazy Mind XNA Engine Yubastard 6 5549 Last post 2007/08/12 08:57:21
by Yubastard
I got skinning working in HMEngine! Hazy Mind XNA Engine pixelminer 1 2273 Last post 2008/08/08 21:24:02
by mikeschuld
Please write a tutorial: XNA+WinForm in Hazy Mind General Discussion Francisk 4 3270 Last post 2009/12/14 11:45:40
by Mikeske
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 3.164 seconds with 19 queries.