12.07.2015 Views

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 4.2: In-game status message display (HUD)will overwrite the previous message for that category. category is displayed as the caption <strong>of</strong> thecorresponding message. Passing an empty string <strong>to</strong> message will remove the message for the givencategory.EntityEach object in the game’s 3D world is represented by an Entity object. An Entity encapsulates an Irrlichtscene node (ISceneNode) and provides basic manipulation <strong>of</strong> that scene node. The most importantextra feature added by Entity is animation including collision detection.Entity animation provides basically two modes: absolute and relative. For both transla<strong>to</strong>ry and rotarymovement, absolute animation translates/rotates the scene node <strong>with</strong> a constant velocity <strong>to</strong> the destinationposition. When that position has been reached, the movement s<strong>to</strong>ps. For relative animation, thereis a direction vec<strong>to</strong>r and a velocity describing the movement. The animation does not s<strong>to</strong>p until it isexplicitly aborted, for instance using setPosition() and setRotation() respectively.Entity has the following public methods:const vec<strong>to</strong>r3df& getPosition() const Returns the corresponding scene node’s current position.const vec<strong>to</strong>r3df& getDestPosition() const Returns the destination position (if movement is absolute)or direction (if movement is relative). See also movementIsAbsolute().const vec<strong>to</strong>r3df& getRotation() const Returns the corresponding scene node’s current rotation.const vec<strong>to</strong>r3df& getDestRotation() const Returns the destination rotation (if movement is absolute)or direction (if movement is relative). See also movementIsAbsolute().const s32 getPosSpeed() const Returns the translational speed (units/sec) <strong>of</strong> the current animation.const s32 getRotSpeed() const Returns the rotary speed (units/sec) <strong>of</strong> the current animation.const bool movementIsAbsolute() const Returns whether the current animation (and destinationposition) is absolute (true) or relative (false).const vec<strong>to</strong>r3df& getScale() const Returns the scene node’s scale.void setPosition(const vec<strong>to</strong>r3df& pos) Sets the scene node’s position and s<strong>to</strong>ps its movement.48 4.1 <strong>Game</strong> Architecture

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!