NubDevice : Under The Covers

posted in A Hobbyist Tale
Published November 04, 2019
Advertisement

Huh, that's 'kinda neat moments...

When you start over from scratch, design aspects become more important. I can't help what I have yet to discover but for the first of I suspect to be many, a happy moment.

Mouse input ponder.

The usual choice is to constantly redirect the mouse cursor to the center and act from the deltas. I'm starting to hate that. Something about it. So I changed it up a bit where I'm still clipping to the window but wrapping on the left and right edge. This feels better at least to not have to hide the cursor and still not allow to click focus lost. This is what my front end input handling looks like. Now I don't care about mouse sensitivity or delta timing on the camera yaw movement and perhaps puts a skill modifier back on the user. In a sense. 


#define imp_bool(x) if(input.pAction_map->GetBool(x))
#define imp_float(x) if(input.pAction_map->GetFloatDelta(x) != 0.0f)
void Game::update(float deltaTime) 
{  // user input pump
   imp_bool(cancel) { action_this_frame = quit; }

   // camera
   imp_bool(forward)  { camera.move(FORWARD,  deltaTime); }
   imp_bool(backward) { camera.move(BACKWARD, deltaTime); }
   imp_bool(left)     { camera.move(LEFT,     deltaTime); }
   imp_bool(right)    { camera.move(RIGHT,    deltaTime); }
   imp_bool(up)       { camera.move(UP,       deltaTime); }
   imp_bool(down)     { camera.move(DOWN,     deltaTime); }
   imp_bool(jump)     { }

   float x = input.pAction_map->GetFloat(mouseX); // 0.0--->1.0 (l--r)
   float y = input.pAction_map->GetFloatDelta(mouseY); // upper ndc space also
   camera.ProcessMouseMovement(x * 360.0f, y, true);   // yaw rotation based on horz screen position
                                                       // pitch is accumulated and clamped process side
   //
   // todo: take into account the physical velocity of the mouse movement
   // high velocity user movement skips a beat at edge transition
   // solution: track previous movement and apply
   // priority: barely notice-able
   //

   POINT pt; ::GetCursorPos(&pt); // keep y component
   if(x<0) { // left and right screen edge cursor wrapping
      POINT pt_desired = { display.dims.width, 0 }; ::ClientToScreen(display.hwnd, &pt_desired);
      ::SetCursorPos(pt_desired.x-2, pt.y); // todo: refactor out the magic number
   }
   if(x>0.9985f) { // partial cause of refactor above (but it's decent smooth at 800 x_res)
      POINT pt_desired = { 0, 0 }; ::ClientToScreen(display.hwnd, &pt_desired);
      ::SetCursorPos(pt_desired.x, pt.y);
   }
}

we'll see how it goes....

 

Next up...

[ Fix your timestep ] yup, I'm a believer. I've heard said, 'If you're going to do multiplayer, do it early'. Hard to argue, set up you system to play nice with something hard. I've always partially ignored the previous state - this state tween concept when it came to timing, but this really, really makes sense to me now. Oh yeah, we're keeping that...

And the closer..

 I'll be spending the week cleaning up and minor miscellaneous tweaks. I understand the importance of tidying up and now is the point to decide how I branch out from here cleanly. I feel now is a good time to give the [ RIP Method ] a serious follow through. I agree, repetition is key (at least for me) Thanks @DavinCreed, that's helping. :) I've only started to browse. Have to go to work for now though. 

phase_one_close.jpg.fa09795549f18715b21bf4cc00e15cd0.jpg

 

3 likes 0 comments

Comments

DavinCreed

I'm actually in the process of a revision on that. As I work through it myself, I'm refining things. And you don't have to follow what I planned out to follow the spirit of it. The basic idea is gaining proficiency through repetitive iterations.

I hope it helps.

November 04, 2019 02:03 PM
Choo Wagga Choo Choo

What I'm experiencing with that is, I find my speed improving but the process is slightly slightly skewed because of my increased personal reference available. The last work being the better parts of the previous attempts. or in other words, previous successes fuel current endeavour. Yes, I'm feeling that. To actually organize a plan is welcoming. It's hard to choose realistic scope when it's your dream project getting it's belly rubbed. 

November 05, 2019 02:54 PM
DavinCreed

I think along with speed and skill, what I gain is also a better understanding of how things interact and interface with each other which helps me make things that are easier to expand on and maintain.

November 05, 2019 05:46 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement