background preloader

Game programming

Facebook Twitter

Game Physics: Motion Dynamics Fundamentals. This post is part of my Game Physics Series.

Game Physics: Motion Dynamics Fundamentals

Before delving deep into the programming aspect of physics engines, I would like to first go over the fundamentals of motion dynamics. Unless specified otherwise, all discussion is in 3D. Also, when it comes to formula consisting of vectors and matrices, all vectors are considered to be column vectors. Position & Orientation Position and orientation of a rigid body are both positional properties. Position is typically represented as a vector, and orientation in 3D can be represented by a 3D vector (the direction is the rotation axis, and the magnitude is the rotation angle), a 3-by-3 matrix (basis vectors as columns), or a quaternion. I prefer storing a 3-by-3 orientation matrix and, in addition, its inverse. Linear Velocity & Angular Velocity Linear velocity, denoted , is the rate of change of position, denoted .

Angular velocity, denoted , is the rate of change of orientation, denoted . However, this gets trickier in 3D. Where is normalized, , and. Using Lua with C++. Using Lua scripts with C++ classes. Read the first part about LuaBridge here to see how to install it and use it for basic things.

Using Lua with C++. Using Lua scripts with C++ classes.

You can find the complete source code of this article here This part will show you how to register C++ classes in Lua, call member functions and how to apply scripts to something practical like putting object behaviour code in scripts. I’m a game developer, so I’ve used examples related to gamedev but you can use Lua almost everywhere, so take a look even if you’re not interested in gamedev. The code used in this article is as simple as possible while also remaining a complete example which you can run and compile. I leave out the details which are irrelevant to focus on the main topic: scripts. The first approach Suppose you want to make NPCs which react differently to the player interacting with them. Let’s go with a naive implementation. Here’s the Player class: Character base class: interact if a function which gets called each time player interacts with characters, for example, talks with them.

Using Lua with C++. LuaBridge makes everything easier. Variables and functions. This part of tutorial doesn’t depend on the others so you can start here even if you haven’t read the previous parts!

Using Lua with C++. LuaBridge makes everything easier. Variables and functions

Understanding Quaternions3D Game Engine Programming. Understanding Quaternions In this article I will attempt to explain the concept of Quaternions in an easy to understand way.

Understanding Quaternions3D Game Engine Programming

I will explain how you might visualize a Quaternion as well as explain the different operations that can be applied to quaternions. I will also compare applications of matrices, euler angles, and quaternions and try to explain when you would want to use quaterions instead of Euler angles or matrices and when you would not. DISCLAIMER: You cannot fully understand quaternions in just 45 minutes. This article is extremely math intensive and is not intended for the weak-hearted. In computer graphics, we use transformation matrices to express a position in space (translation) as well as its orientation in space (rotation). In this article, I will not discuss the details of transformation matrices. In this article, I want to discuss an alternative method of describing the orientation of an object (rotation) in space using quaternions. The imaginary number has the form: or. Lazy Foo' Productions - Beginning Game Programming v2.0(Beta) Game Programming - Episode 1 - Resolution.

Urho3d - Cross-platform rendering and game engine.


TwinklebearDev. Torque 3d Engine Source Analysis #1. Graphics. Essential Math for Games Programmers. As the quality of games has improved, more attention has been given to all aspects of a game to increase the feeling of reality during gameplay and distinguish it from its competitors.

Essential Math for Games Programmers

Mathematics provides much of the groundwork for this improvement in realism. And a large part of this improvement is due to the addition of physical simulation. Creating such a simulation may appear to be a daunting task, but given the right background it is not too difficult, and can add a great deal of realism to animation systems, and interactions between avatars and the world. This tutorial deepens the approach of the previous years' Essential Math for Games Programmers, by spending one day on general math topics, and one day focusing in on the topic of physical simulation. It, like the previous tutorials, provides a toolbox of techniques for programmers, with references and links for those looking for more information.

Topics for the various incarnations of this tutorial can be found below. Slides. 3D Game Programming - Episode 1 - Window. Game Programming Patterns.