|
Arkcann
|
 |
« 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  , 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
|
 |
« 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
|
 |
« 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
|
 |
« 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: 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« 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.aspEdit: 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« Reply #14 on: 2007/04/05 21:45:56 » |
|
oohh i like that even better, thanks for the idea
|
|
|
|
|
Logged
|
|
|
|
|