• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

509 Good

About Vexal

  • Rank
  1. I have a scene graph and IK system with hierarchical transformations, but currently it only allows for a segment in the IK system to have a single parent segment.  It works fine for something like two arms attached to a torso, as that just has a segment with two children.  But for two legs attached to a torso, with the torso being dependent on the angles of the legs, it does not work. I am wondering if there is a way to calculate the parent transformation of the torso or other similar circumstance when it has multiple parent segments, such that some attachment point that is the average of all parent segments' endpoints is correctly translated and rotated based on the total transformation of the both leg transformations. An example being, the legs sway to some direction, the torso should reflect the intuitive change of its transformation (I say intuitive because I don't know how to define it in mathematical terms). My goal is to just have setup in my scene graph and IK solver which can by default automatically handle scene nodes / IK segments with multiple parents.
  2. This is what I am doing to compute the velocity bias: const XMVECTOR targetAngles = XMVectorSet(xRot, yRot, 0, 0); const XMVECTOR targetQuaternion = XMQuaternionRotationRollPitchYawFromVector(targetAngles); const XMVECTOR quaternionBetweenObjects = XMQuaternionMultiply(this->object2->qOrientation, XMQuaternionInverse(this->object1->qOrientation)); const XMVECTOR quaternionError = XMQuaternionMultiply(quaternionBetweenObjects, XMQuaternionInverse(targetQuaternion)); XMVECTOR axisBetweenObjects; float angleBetweenObjects; XMQuaternionToAxisAngle(&axisBetweenObjects, &angleBetweenObjects, quaternionError); const XMVECTOR targetAngularVelocity = XMVectorMultiply(XMVector3Normalize(axisBetweenObjects), XMVectorReplicate(angleBetweenObjects)); this->velocityBias = XMVectorMultiply(targetAngularVelocity, XMVectorReplicate(-FractalTreeResources::angleBB)); Whenever yRot in targetAngles is between the radian equivalent of -90 degrees and +90 degrees, it works correctly with any value for xRot.  If xRot is 0, any value for yRot works.  If xRot is non-zero, then as soon as yRot is no longer set to be in the range of -90 and +90, it explodes.  Moving yRot back into the working range un-explodes it and it becomes stable again, even after being unstable for a long time.  After this works, the values of targetAngles will come from my inverse kinematics solver, so it needs 3 degrees of freedom because the robot arm segments can have the ability to move on any axis the player sets.
  3. I realized that I might be using axis angle, not euler angles for angular velocity. I didn't realize they're not the same thing.
  4. @JoeJ   I changed my angle computation to figure out the error using your suggested method.  It seemed to make it better -- the method in which it fails now appears to be consistent -- it will correctly rotate unless the target angle for any degree of freedom crosses the 180 degree mark.  When moving the target back inside the working quadrant, it becomes stable again.  Aside from that, it appears to be stable, even when it's shot with the gun.   https://youtu.be/RdfKQvJOzmg
  5. I am ashamed to admit that I am not fluent enough in math to follow the notation in that person's papers.  Basically, if it's written in LaTeX, chances are, I won't understand it.   What is the jacobian you used?  I am essentially using a two-row jacobian for the angular constraint:  I combine both a positional and angular constraint, so I have   J_angle = [0 -1 0 1] J_position = [-1 skew(leverArm_1) 1 skew(leverArm_2])]   These two constraints are run as separate constraints but I am under the belief that they should work the same as a 2-row Jacobian when running with sequential impulses.  The motor is achieved by varying the constant in C so that the bias factor pushes it around its motor.   I believe that the constraint is working better now, but becomes unstable past a certain limit:   https://youtu.be/tvKEm9TST4M   Edit:  I actually just tested again, and I realize that it only becomes unstable if I rotate on more than one axis (in the above video, it rotates on segment about the x axis, and the other segment about y) -- if I use just the x axis, it does not become unstable at all, as far as I can tell.  I am unsure why rotating on the y axis and x axis together is stable up to a point, but then eventually is unstable.   Here is one more video demonstrating how it is stable in the x, and stable in the y at first: https://youtu.be/h7hzwfgceeY   @JoeJ, am I correct in understanding that you are using quaternions for calculating the impulse using the Jacobian (in that the derivative of the quaternion is simply the euler angular velocity, without anything special done to it), but for calculating the error to use for the bias correction factor, you use the dot product instead?
  6. I don't think the order dependency of euler angles is the immediate issue. In most of the video, it is only applying force and rotating about the x axis, which should make ordering not applicable.
  7. This is what I have so far.  It is still incredibly unstable:   https://youtu.be/8nay2RbWenk   Using angle constraints and sequential impulses to achieve motors connecting rods.   The bottom two segments are connected by positional constraints only; the rest of the segments are connected as rigid motors with a set target angle using angle constraints, as well as connected by positional constraints.  The middle segment moves its motor by varying the target angle of the constraint equation over time for either the x or y angle when I press a key on the keyboard. The rest of the segments connected by angle constraints are set to stay at x rotation = .5 radians.  I also apply force to the bottom two segments in this video as well as apply force to the rest when shooting it with a gun.   The angle constraint is C = Rot_2 - Rot_1 The position constraint is C = P_2 - P_1
  8. I need the angles for each degree of freedom separately.  I found a function to get the euler angles from a quaternion, but I'm not sure if it works for all quadrants.  As well, I'm not sure if this approach is the right way to go about this in the first place.  I was trying to follow this: http://www.dyn4j.org/2010/12/angle-constraint/ but it doesn't say anything about how to actually apply the bias.  My stem now appears to mostly kind of work, but it's very unstable and can take a very long time to converge to a correct state, even with 1000 iterations of sequential impulses.
  9. I would like to create a constraint for holding the angle between two connecting rods to a certain angle.  The constraint force will only act on one of the objects.  The constraint is intended to create a motor on one of the connected objects as well as a rigid connection between the two when the motor is not activated that can be violated if enough external force is applied.  The constraint does not need to keep the objects physically connected -- the objects are kept physically connected by a separate constraint connecting them at end of the rods that I already have working.  The angle constraint will create a motor by varying the target angle in the constraint equation.  I am using sequential impulses.   I am having trouble coming up with the correct constraint equation.  I thought about having C = dot(normalize(P_1_center - P_1_end), normalize(P_2_center - P_2_end)) - 1 where the P_2 terms would be treated as constants when the derivative is taken due to the constraint force only applying on the first object as the first object is the object with the motor.  However I am unsure if this will work, or where to go next.  I believe that the velocity bias result for this constraint will be what ultimately rotates the object, but I am unsure if it will work as a function of dot product, or if I will be able to cap the motor force and still achieve correct results.  As well, the issue with using the dot product to find the angle is that it does not discriminate on the axis of the angle -- I would like to restrict the axises with which the objects can rotate with respect to each other.     I store the rotation as a quaternion about each object's center of mass, so another option instead of dot product is to look at the quaternions directly and use C = R1-R2, but calculating the quaternion between two objects as the constraint function involves quaternion multiplication and quaternion inverse to give another quaternion, of which I am unsure how to use in the velocity bias term because my angular velocities are in euler angles.  I can't figure out how to convert the quaternion result from C to a change in impulse as a quaternion can't be applied directly to an angular velocity.   Does anyone have insight on how to solve this?
  10. I am trying to move a robot arm whose desired angles for each segment have been solved for with inverse kinematics.  The robot arm is in my physics engine and each segment is connected with a joint constraint; these constraints are solved using sequential impulses.   The effect I am trying to achieve is to have a robot arm that can swing at the player, but the player can shoot it to knock its movement back before it hits them.   I would like to be able to move the robot arm using something similar to a stepper motor where each frame each segment will rotate a certain number of steps until the computed target is reached.  The issue I am having is with combining this movement with the constraint system.  I am easily able to apply the force to each segment to move it a certain amount (I do this by applying the exact torque and force to each segment to make it accelerate it in global coordinate system to so that by the next frame, the angle between each segment will have changed appropriately), but I am unsure how to stop the segment at the end of its step.  Floating point rounding errors appear to especially be an issue.  I tried applying an opposite force and torque to each segment the next frame but it wasn't precise enough and caused the system to be unstable. It becomes even worse when trying to account for melding the motor force with the force applied to the segments from the constraint resolution.   Does anyone know how to solve this?
  11. Thanks for both answers -- I was able to get it working.
  12. What would the Jacobian be for the case of C = pa - pb? I calculated J = [-1, -ra^1, 1, rb^1?] where 1 is the vector <1, 1, 1>, ra and rb are the lever arms, and ^ is cross product, but it doesn't seem to be right as it doesn't work at all. Does solving for a constraint with 3 values instead of 1 change the way it works? Do I have to solve the three coordinates separately as three separate constraints? I also tried [-1 -ra 1 rb] and it didn't work either.
  13. I am trying to implement joint constraints for connected rods.  I was looking at the derivation for the particular Jacobian on this site:   http://myselph.de/gamePhysics/equalityConstraints.html   They chose the constraint to be C = (Pa - Pb)*(Pa - Pb), which makes the jacobian [-d -r1Xd d r2Xd]   d=current distance between constraint point on each object r=lever arm from center of mass of each object to its constraint point   They also have a javascript demo at the bottom which appears to work.  My question is, why does this work.  Looking at the math, it looks like it should not.   Because:   When the constraint is valid, Pa - Pb should equal 0.  Then the jacobian is 0, so JV is 0 as well, therefore lambda is 0 whenever the constraint itself is valid, even if the derivative of the constraint is invalid.  It won't attempt to create any corrective velocity until Pa and Pb are no longer equal.   This is different from a pendulum constraint where Pa - Pb is supposed to be non zero, allowing lambda to be nonzero even when the constraint position is valid. Is there something I am missing, or is this formula for joint constraint wrong?  It looks like the only reason their demo works is because the B term fixes it on the next frame.   I can't find any other decent explanations of how this is supposed to work other than the classic pendulum or penetration constraints.
  14. In case anyone is interested, I solved this problem.  I use linear programming to optimize for the minimum sum of the absolute values of the difference between "attained force / torque this frame (per dimension)", and "required force / toque this frame", where required force this frame is the force required to get the ship to a set target velocity / rotational velocity.  The variables are the percentage of each thruster; the coefficients are the force and torque the thruster has in each dimension.  The thrusters are constrained between 0 and 1.   This page has a really great explanation on how to minimize absolute value even though it itself is not linear: http://lpsolve.sourceforge.net/5.5/absolute.htm   Compiling LPSolve library with VC++14 worked fine.     If anyone has questions about the details of this feel free to ask.
  15. Hi,   I am attempting to make a system where an AI unit can move itself with an arbitrary set of thrusters.  All movement in the engine my engine is controlled by the physics engine -- to move or rotate an object, a force vector must be applied on the object.   Objects have a list of Thrusters (a thruster is not necessarily a piece of hardware like on a ship -- it's just a designator for where a force can be applied relative to an object).   At the end of each frame, the net force on an object is summed up to find the net force and acceleration.   A thruster has: x, y, z offset (in local object coordinates) x, y, z direction (in local object coordinates) current magnitude (in absolute force units) maximum magnitude (in absolute force units)   Most of the code interacts with the thrusters by setting their percentage activated.   Currently I have an AI ship that can follow the player and hover, as well as keep itself level when balls are thrown at it, by firing off the correct thrusters to keep its angular and linear velocity a set amount, and its pitch a set amount.   However, I have hard-coded the thrusters to be used at this point.  But I would like to be able to have an arbitrary set of thruster objects pointing in arbitrary directions with arbitrary maximum magnitudes and the AI calculate which thrusters to fire and at what percentage to get closest to its target position, angle, linear velocity, and angular velocity, at the end of each frame.   I'm not great at math and not sure where to start with solving for the thruster percentages.  What is most confusing to me is, for example, the fact that the ship can fire off a back-right thruster, which will turn it left and also propel it forward.