Transcript Evil Boat

Bumper Boats
Daniel Johannessen
Santiago Donoso
Christian Mercado
Andreas Juul Hirszhorn
Indledning




Game concept
Player
Objective
Treasure
Virus the Attack
”turn movement”
”turn movement”
_RigidBody.dll


SWIG
Gravity (z-axis) styret af panda
float fMass;
float fInertia;
Vector vPosition;
Vector vVelocity;
Vector vVelocityBody;
Vector vAngularVelocity;
float fSpeed;
float fOrientation;
Vector vForces;
Vector vMoment;
float ThrustForce;
Vector PThrust, SThrust;
// total mass (constant)
// mass moment of inertia in body coordinates(constant)
// position in global coordinates
// velocity in global coordinates
// velocity in body coordinates
// angular velocity in body coordinates
// speed (magnitude of the velocity)
// orientation
// total force on body
// total moment (torque) on body (2D: about z-axis only)
// Magnitude of the thrust force
// stern thruster forces
Forces Affecting the Boat
What is Collision


Share space in time
Collisions are
expensive
Collision Solids








Collision Sphere
Collision Tube
Collision Plane
Collision Polygon
Collision Ray
Collision Line
Collision Segment
We applied Collision to geometry ( walls, floor)
Collision Handlers





CollisionHandlerQueue
CollisionHandlerEvent
CollisionHandlerPusher
PhysicsCollisionHandler
CollisionHandlerFloor
What can collide in the game?





Bumper Boat collides with:
Floor
–
Walls
–
Evil Boats
Barrels
-
0x10
0x11
0x12
0x13
Problems & Improvements
Only 1 CollisionHandlerPusher – Therefore “Evil
Boats” can go through the walls
Solution to collision problems:
•
•
Use CollisionHandlerQueues and check
each event recorded in it.
Use more traverser to check all solid
objects for collisions
Improvements:
•
•
•
•
Enemies could use a ray/segment to shoot
Create a view/sight for the boat or enemies with the
use of segments
Use polygons as walls
Use segments to know obstacles
Ai in Bumper Boats

Evil Boat






Deterministic
Rigid Body
Interception
Finite State Machine
Weaknesses
Extending the Ai
Evil Boat: Interception

Vr  Vprey  Vpredator
Algorithm




Closing Velocity
Range to Close
Time to Close
Interception Point
Sr  Sprey  Spredator
Tc  Sr / Vr
S t  Sprey  ( Vprey )( Tc )
Predicted interception
point
Enemy
Player
Evil Boat: Finite State Machine

States



Search
Attack
Transitions
No Target
Target
Search
Attack
No Target
Target
Weaknesses

Interception Algorithm


Finite State Machine


3 Cases
Distance Calculation
Deterministic
Extending the Ai




Pattern Movement
Random Movement
Waypoint Navigation
Flocking




Cohesion
Alignment
Separation
Nondeterministic Ai
Patrol Pattern
Visibility Arc
y
Singleton



Kun en instans tilladt
Udføres typisk ved privat contructor
Ingen private type i python


pseudo-singleton
ingen sikkerhed
Interface



Bedre overblik
Abstrakte metoder
Ingen tvang om implementering i python ved
pass
Factory


Genererer objekter
Kan abstrahere fra specifikke typer

f.eks. Enemy kontra EvilBoat
State manager




Tilstand kan skiftes runtime
Factory til states
Singleton
Statemanager til
spillets state
Den overordnede programstruktur




Ensartedhed
Klasseopdeling efter spilkomponenter
Factory og singleton mønstrene
Fordele



mulighed for udvidelse
overskuelighed
Interfaces kontra nedarv


lav kobling
lettere læsbar kode
Erfaringer

Erfaringer med en game engine




sparer ressourcer
kan medføre problemer
brug dele af den
OOP til spilprogrammering