VK Computer Games
Mathias Lux & Horst Pichler Universität Klagenfurt
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 2.0 License. See http://creativecommons.org/licenses/by-nc-sa/2.0/at/
VK Computer Games Mathias Lux & Horst Pichler Universitt - - PowerPoint PPT Presentation
VK Computer Games Mathias Lux & Horst Pichler Universitt Klagenfurt This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 2.0 License. See http://creativecommons.org/licenses/by-nc-sa/2.0/at/ Agenda http://
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 2.0 License. See http://creativecommons.org/licenses/by-nc-sa/2.0/at/
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
Double Buffering with repaint-method
http://www.uni-klu.ac.at
physical simulations computational geometry
robotics computer games
[www.vis.uni-stuttgart.de/~frisch/h/diss.htm ]
http://www.uni-klu.ac.at
Remark: example assumes, that there is no z-axis
http://www.uni-klu.ac.at
predict upcoming collision
respond to collision before it occurred
advance movement by small time step check if collision occurs respond to collision after it occurred much easier; used in games
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
collision detection with Pythagoras: V = sqrt( (x2-x1)2 + (y2-y1)2 ) if V < r1 + r2 collision
http://www.uni-klu.ac.at
Bounding Volume
http://www.uni-klu.ac.at
Object moves n pixels per loop Collision detection: „inelegant“ approach check possible combinations of lines [ A1B1xA2D2, A1B1xB2C2, … ] if lines cut collission
http://www.uni-klu.ac.at
Collision detected B1C1xA2D2 bounce left (if jumps) stop x-movement Collision detected C1D1xA2B2 new ground-level stop y-movement Collision detected C1D1xA2B2 bounce down reverse y-movement
[ The Great Giana Sisters, Rainbow Arts: http://www.youtube.com/watch?v=zrRHAisdIRg ]
http://www.uni-klu.ac.at
[ The Great Giana Sisters, Rainbow Arts ]]
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
(objects with geometric shape)
subtract add intersect exclusiveOr
collision detection with intersect but: no projection vector!
http://www.uni-klu.ac.at
call: detect(polygon1, polygon2)
[ See Code Example: PolygonCollision ]
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
Collision detection: no separating axis collision
1 separating axis no collision problem: infinite number of axis to test?
http://www.uni-klu.ac.at
[ projection ]
http://www.uni-klu.ac.at
no collision! collision! [ collision ]
http://www.uni-klu.ac.at
position at t1 position at t2 collision???
sweep test collision
Tutorials and further examples [http://www.harveycartel.org/metanet/tutorials/tutorialA.html#jakobsen ]
http://www.uni-klu.ac.at
R-Type, Irem[ http://www.youtube.com/watch?v=xPv5lqpA4c4&feature=related ]
http://www.uni-klu.ac.at
Big sprite is non-convex, therefor compose it from several convex polygons … Bounding Volumes
http://www.uni-klu.ac.at
first test on polygon-level then test on pixel-level
http://www.uni-klu.ac.at
find the smallest possible displacement direct modification of object positions
use spring forces to pull object out of collision modify the objects acceleration / direction
use changes in velocity to prevent interpenetration (e.g. stop object)
http://www.uni-klu.ac.at
Killer Game Programming in Java, Andrew Davison ]
http://www.uni-klu.ac.at
xxx
Bug Runner Class Diagram
http://www.uni-klu.ac.at
Locked Lock Pass Unlocked Unlocked Thanks Coin Unlocked Locked Alarm Pass Locked Unlocked Unlock Coin Locked New State Action Event Current State
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
Ball Sprite State Diagram
http://www.uni-klu.ac.at
Bug (Player) Sprite State Diagram
http://www.uni-klu.ac.at
44444 222222222 111 2222 11111 444 444 22222 444 111 1111112222222 23333 2 33 44444444 00 000111333333000000222222233333 333 2222222223333301 00000000011100000000002220000000003300000111111222222234
3 2 4 1
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
Pacman [http://www.youtube.com/watch?v=OsLGvm5-29w ]
http://www.uni-klu.ac.at
Fog of War – Warcraft II [http://www.youtube.com/watch?v=OsLGvm5-29w ]
http://www.uni-klu.ac.at
Images taken from Pathfinding for Beginners [ http://www.policyalmanac.org/games/aStarTutorial.htm ]
– g … cost from starting position (covered distance) – h … heuristic: estimated distance to goal
– if shortest path found – depth or time limit reached
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
[ implements loop ] – calculate path(s) – store path(s) information in game state – sleep(n), value of n depends on » wanted behavior » CPU utilization
http://www.uni-klu.ac.at
shortest path can be modified quite easily
Line of Sight – Commandos 3 [ http://www.youtube.com/watch?v=4CLp3D5h6RU&feature=related ]
http://www.uni-klu.ac.at
Source: http://www.cs.wisc.edu/graphics/Courses/679-s2007/Main/GameDesign
http://www.uni-klu.ac.at
http://www.uni-klu.ac.at
How to protoype a game in 7 days [ http://www.gamasutra.com/features/20051026/gabler_pfv.htm ]
http://www.uni-klu.ac.at
[ http://www.gamasutra.com/features/20051026/gabler_pfv.htm ]
http://www.uni-klu.ac.at
try to make a schedule (I know: it‘s hard to estimate …) be fair to your team-mates and hold the schedule! a lot of time is usually consumed by testing, debugging and refinement
there are still other courses & exams summer is approaching soccer fans: EM is approaching do not underestimate the time you will have to invest on new tools (graphics, sound, etc.)
http://www.uni-klu.ac.at