• 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

147 Neutral

About MadSage

  • Rank
  1. I developed a 2D skeletal animation system which was working until recently. We added a couple of new animations which did not work. I found that the quaternions output from 3DS Max gave rotations on two axes instead of one - one rotation of 90 degrees, followed by the rotation I need. So I set about fixing the problem. My suspicions lead me to the quaternion to matrix conversion, which I believed was now fixed, but I am not sure. The output now matches the output of a calculator I found online, and my original problem seems to be solved. However, the animation system is broken and no animations work correctly. The character looks almost correct, except that bones are offset from their correct positions and at least some of them are rotating in the opposite direction to what they should. The .X file output from the Max plugin is for a left handed coordinate system. I then convert this output to a smaller file format of my own. This is just to reduce the file size and improve loading times. No conversion of the coordinates or quaternions is done. The matrix to quaternion conversion is as follows (matrix is in row column format)... m_fElement[0][0] = 1 - 2 * ((q.y * q.y) + (q.z * q.z)); m_fElement[0][1] = 2 * ((q.x * q.y) - (q.z * q.w)); m_fElement[0][2] = 2 * ((q.x * q.z) + (q.y * q.w)); m_fElement[0][3] = 0; m_fElement[1][0] = 2 * ((q.x * q.y) + (q.z * q.w)); m_fElement[1][1] = 1 - 2 * ((q.x * q.x) + (q.z * q.z)); m_fElement[1][2] = 2 * ((q.y * q.z) - (q.x * q.w)); m_fElement[1][3] = 0; m_fElement[2][0] = 2 * ((q.x * q.z) - (q.y * q.w)); m_fElement[2][1] = 2 * ((q.y * q.z) + (q.x * q.w)); m_fElement[2][2] = 1 - 2 * ((q.x * q.x) + (q.y * q.y)); m_fElement[2][3] = 0; m_fElement[3][0] = 0; m_fElement[3][1] = 0; m_fElement[3][2] = 0; m_fElement[3][3] = 1; Then the bone update which is called recursively... ***SFrame contains a translation vector and quaternion. All frames for every bone currently have both. Hopefully the rest is self explanatory, although something is clearly wrong here. void CAnimation::SBone::Update(CAnimation *pAnimation, const SMatrix sParentMatrix) {     const SFrame *psFrame = pAnimation->GetCurrentKeyFrame(m_sIdentifier);          if (psFrame->m_uiComponents & ANIMATION_COMPONENT_TRANSLATION)     {         SMatrix sParentRotationMatrix = sParentMatrix;         sParentRotationMatrix.m_fElement[3][0] = 0;         sParentRotationMatrix.m_fElement[3][1] = 0;         sParentRotationMatrix.m_fElement[3][2] = 0;                  SPoint3 sTranslation = psFrame->m_sTranslation * sParentRotationMatrix;         m_sWorldMatrix.m_fElement[3][0] = -sTranslation.x + sParentMatrix.m_fElement[3][0];         m_sWorldMatrix.m_fElement[3][1] = -sTranslation.y + sParentMatrix.m_fElement[3][1];         m_sWorldMatrix.m_fElement[3][2] = sTranslation.z + sParentMatrix.m_fElement[3][2];     }          SMatrix sLocalMatrix;          if (psFrame->m_uiComponents & ANIMATION_COMPONENT_ROTATION)     {         SMatrix sLocalRotation = SMatrix(psFrame->m_sRotation);// Create matrix from the rotation quaternion (see code above)         sLocalMatrix = sParentMatrix * sLocalRotation;     }          sLocalMatrix.m_fElement[3][0] = m_sWorldMatrix.m_fElement[3][0];     sLocalMatrix.m_fElement[3][1] = m_sWorldMatrix.m_fElement[3][1];     sLocalMatrix.m_fElement[3][2] = m_sWorldMatrix.m_fElement[3][2];       SBone *psSibling = m_psSibling;          if (psSibling)         psSibling->Update(pAnimation, sParentMatrix);       if (m_psChild)         m_psChild->Update(pAnimation, sLocalMatrix);          m_sWorldMatrix.m_fElement[0][0] = sLocalMatrix.m_fElement[0][0];     m_sWorldMatrix.m_fElement[0][1] = sLocalMatrix.m_fElement[0][1];     m_sWorldMatrix.m_fElement[0][2] = sLocalMatrix.m_fElement[0][2];     m_sWorldMatrix.m_fElement[1][0] = sLocalMatrix.m_fElement[1][0];     m_sWorldMatrix.m_fElement[1][1] = sLocalMatrix.m_fElement[1][1];     m_sWorldMatrix.m_fElement[1][2] = sLocalMatrix.m_fElement[1][2];     m_sWorldMatrix.m_fElement[2][0] = sLocalMatrix.m_fElement[2][0];     m_sWorldMatrix.m_fElement[2][1] = sLocalMatrix.m_fElement[2][1];     m_sWorldMatrix.m_fElement[2][2] = sLocalMatrix.m_fElement[2][2];          SPoint3 sOffset = SPoint3(-m_sFrame.m_fElement[3][0], -m_sFrame.m_fElement[3][1], m_sFrame.m_fElement[3][2]) * sLocalMatrix;     m_sWorldMatrix.m_fElement[3][0] += sOffset.x;     m_sWorldMatrix.m_fElement[3][1] += sOffset.y;     m_sWorldMatrix.m_fElement[3][2] += sOffset.z;          // HACK - Not sure why this was necessary     m_sWorldMatrix.m_fElement[3][0] = -m_sWorldMatrix.m_fElement[3][0]; } Finally, the bones (images) are rendered with the following rotation ... ***sMatrix is the bone's m_sWorldMatrix -atan2(-sMatrix.m_fElement[2][0], sMatrix.m_fElement[0][0]); I would really appreciate any help with fixing this problem because my math skills are not great and I can't get my head around what the issue is. Please let me know if anything is unclear.  Due to contractual obligations, I cannot post screenshots or more complete code.  I think I have posted all the important bits of code.
  2. I've been using OpenGL for a while to do 2D graphics. I'm doing a game conversion at the moment. The original version was all software rendering and used some nasty techniques for this effect - copying the frame buffer to a texture. I still don't know a great deal about OpenGL, and I've come across a problem with this conversion. This is how the original software version looks. I'll do my best to explain this. At times the game turns to night with a gradual blue tint over the background and other sprites. There are a number of spot lights around the map. Some of the spot light rectangles overlap. At the centre of the lights, the original background coloring is seen, graduating outwards to the blue tint. I hope that is clear. Now I need to get this working in OpenGL. The light images are circular, graduating from solid white to completely transparent, and there is a semi-transparent (alpha varying over time, as it gets darker) blue rectangle all over the play area. As it is, it doesn't work in OpenGL. I'm thinking I can do this with alpha blending, but I've not managed to get it working. Copying anything back from the frame buffer certainly isn't an option. Any ideas?