Advertisement Jump to content


This topic is now archived and is closed to further replies.


Would any like to test my game?

This topic is 6871 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

Hi! I just added mouse support to my 3D Engine and it is a bit flaky. It doesn''t have the feel as quake or UT does. Heres the code I use for my mouse look, it''s very basic : g_lpMDIDevice->GetDeviceState( sizeof(DIMOUSESTATE), &dims ); if (dims.lY > 0) user.xrot -= 0.8f; if (dims.lY < 0) user.xrot += 0.8f; if (dims.lX > 0) user.yrot -= 2.0f; if (dims.lX < 0) user.yrot += 2.0f; And then I use user.yrot and user.xrot for the world rotation. But it just doesn''t have the good feel as those other games have. Can anyone give me some pointers on how to make it feel alot better? Here''s the executable for you to try out : Thanks alot to try it out! Justin Eslinger

Share this post

Link to post
Share on other sites
Without downloading your source code I can already tell you how to get the "Quake Feal". If you notice, Quake with arrow movement, Quake does not immediately stop. It slows down. You can achieve this by using a friction variable. You get the direction variable and subtract the dir by the friction every frame. With the mouse you should do mouse filtering. By looking at your code and since I did download your game, I noticed that the mouse movement was not variable. You need to do the following:

//Did you switch your x and y?
user.xrot = user.xrot + dims.lY;
user.yrot = user.yrot + dims.lX;

It is very annoying to move the mouse and it does not turn according to the speed that the user moved the mouse. Also, when doing any code that involves timing, ALWAYS MULTIPLY BY A SCENE TIMING VARIABLE!

// Example2
user.xrot = user.xrot + (dims.lY * SceneTimer);
user.yrot = user.yrot + (dims.lX * SceneTimer);

To get the SceneTimer variable just do this

-Pseudo Code-
Scenetimer = TimerFunction - LastTime
LastTime = TimerFunction


Since I do not know C/C++, my code is not optimized to its max potential. I hope this helped.

Share this post

Link to post
Share on other sites
No, that doesn''t work

Does anyone know how quake does it?

Or does anyone know how to set the mouse cursor in VC++?

Share this post

Link to post
Share on other sites
There is a friction type thing in Quake and UT, but VERY little. It slides a very little after you stop moving the mouse, in Your demo, you need it much FASTER, and use a make a little bit of a slide, Ive avoided this for now by just using Keyboard. Also, I dont use OpenGL(Sorry), but the mouse routine you use, do you get a high resouloution from it, That could be the problem?, (also, try make it start out slow, and then speed it up with acceleration, Q3 does that), later,

Share this post

Link to post
Share on other sites
Oh, woops, do what nes8bit said, didnt read that, also, nes8bit, your C/C++ code is optimized to its max potenceil,(your just adding/multiplying variables)

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!