Jump to content
  • Advertisement

JimmyDeemo

Member
  • Content count

    261
  • Joined

  • Last visited

Community Reputation

156 Neutral

About JimmyDeemo

  • Rank
    Member
  1. JimmyDeemo

    Newbie

    Firstly i think there is a little confusion here as to what shaders are and how they are used. I believe in general that shaders aren't something done by artists who use modelling software to produce models. They are essentially mathematical computations that get applied at different points in the rendering stage to give certain effects. Check out this page for a brief description of rendering basics, it finishes up by talking about shaders. This has a couple of meanings too. What do you mean by 'limits'? In general there are no limits to the game play aspects that people think up, just different ways of implementing them. If you are talking about limits in terms of pushing graphical processing and effects then you are limited by the engine you use. Unreal engine its probably one of those that are at the fore front of pushing what's possible, just look at some videos of the latest version. You seems to have the right attitude towards where you want to be. Remember that if you want to be a Game Programmer using C++ then you first need to be a regular programmer using C++. Having a greater understanding of the ins and outs of your chosen language is a great benefit, and doesn't mean that you can't put a game twist on things. The point is not to overwhelm yourself, because when i do that i get disinterested.
  2. JimmyDeemo

    External forces and RK4

    Apologies, what i meant was 'In each derivative calculation, the momentum is just the same as the forces, because time isn't taken into account.'. I will take some time an do as you suggested. The slight hurdle i have got to get over is that your method looks a little different to mine (and the articles i followed), but i am sure its all there. Once i get my head around it i will post again.
  3. JimmyDeemo

    External forces and RK4

    Thanks for your reply, as well as the code but i am afraid i find you answer quite cryptic. So let me just see if i am on the right track here. What you are saying is that for a given state of a Rigid body object, forces would be accumulated in the cycle (e.g. +thrust, -drag, etc.), when it comes to each of the four derivatives it can be considered that the forces are the same and are not influenced by the time. Is that right? So therefore the momentum is just the same as the total forces acting on the object. If i have understood that right, then that's great and I'm pretty sure i can sort my code for that. But i just wondered why this was the case?
  4. JimmyDeemo

    External forces and RK4

    So i started this thread a while ago, and the replies dried up. I don't think i made it clear as to my problem so i wanted to re word it so that i might get some more responses. Firstly let me point out that i know RK4 is over kill, but it's mainly just so that i can learn and practise my coding techniques, so while i understand there are good intentions to pointing out other systems lets try and keep this about RK4. So i have implemented a system similar to that detailed on http://gafferongames.com but i am still confused as to where external forces fit into the system. From my understanding the way RK4 works is that it needs to calculate the force of a derivative implicitly from the current state, rather than explicitly applying forces once per update. So if that's the case how do i say apply some thrust to a ship for example? Let me break it down furthur i have the position and momentum of the RigidBody prior to any calculation, i also have the velocity of the current derivative step. What i want to be able to do at this point is apply things like collision input and 'push' forces, and the end result should be to calculate the forces for this current derivative step. I also have the current time step also. Here is some code for you, hopefully its clear enough, please just ask if anything is confusing. /** * Integrate a state forward by a delta time. * * This function uses the RK4 integration method to update the state by a given * time. * * @param state Reference to the state that needs integrating. * @param deltaTime Time to move the state on by. */ void CPhysController::Integrate(CRidgidBody::CRBState &state, float deltaTime) { //RK4 uses 4 derivatives of the current state at different points within the delttime. //Each evaluation uses the previous derivative to calculate next. CRidgidBody::CRBDerivative a = Evaluate(state, deltaTime, CRidgidBody::CRBDerivative() ); CRidgidBody::CRBDerivative b = Evaluate(state, deltaTime*0.5f, a); CRidgidBody::CRBDerivative c = Evaluate(state, deltaTime*0.5f, b); CRidgidBody::CRBDerivative d = Evaluate(state, deltaTime, c); //Using a wighted sum that comes from the Taylor Series expansion, the best overall derivative //is calculated. This can then increment the state. state.UpdatePosition( 1.0f/6.0f * deltaTime * (a.mVelocity + 2.0f*(b.mVelocity + c.mVelocity) + d.mVelocity) ); state.UpdateMomentum( 1.0f/6.0f * deltaTime * (a.mForce + 2.0f*(b.mForce + c.mForce) + d.mForce) ); } CRidgidBody::CRBDerivative CPhysController::Evaluate(CRidgidBody::CRBState &state, float deltaTime, const CRidgidBody::CRBDerivative &prevDerivative) { //First move the state on base on this time step value, using euler integration. state.UpdatePosition( prevDerivative.mVelocity * deltaTime ); state.UpdateMomentum( prevDerivative.mForce * deltaTime ); //Prep our derivative CRidgidBody::CRBDerivative derivative = CRidgidBody::CRBDerivative(); derivative.mVelocity = state.GetVelocity(); Resolve(state, derivative); return derivative; } void CPhysController::Resolve(CRidgidBody::CRBState &currentState, CRidgidBody::CRBDerivative &derivative) { //??? } Any help understanding this would be great. I did think that perhaps i should be coming at the problem from a different angle, perhaps someone here could enlighten me.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!