980 likes | 1.1k Views
Virtual Reality over the Internet 2001. Supervisor: Dr. Wenping Wang Second Examiner: Dr. C.L. Wang Group members: Chan Hing Sun, Sun Hui Pui Fan, Martha Siu Chi Man, Siu Wong Wai Kwan, Jimmy. Introduction - Presented by Martha. Introduction – Objectives.
E N D
Virtual Reality over the Internet 2001 • Supervisor: Dr. Wenping Wang • Second Examiner: Dr. C.L. Wang • Group members: Chan Hing Sun, Sun Hui Pui Fan, Martha Siu Chi Man, Siu Wong Wai Kwan, Jimmy
Introduction – Objectives • Objectives of the project: • Implement a 3D Chess Game over the Internet • Learn how to design, develop & deliver a system • Learn about 3D graphics & knowledge required for project • Fundamental requirements: • 3D Studio Max • MFC • OpenGL
Introduction – The Game • Title of the Game: King of the Forest • Game Environment: • Forest, River, etc • Main Characters: • 8 kinds of animals in the forest • Elephant, Lion, Tiger, Fox, Dog, Cat, etc
Introduction – Division of Labor • Modeling: Sun & Martha • Parser: Siu • OpenGL Display: Jimmy • GUI: Martha & Jimmy • Sound & Animation: Sun • Commun Engine: Sun & Siu
Introduction – Presentation Outline • Architecture • Modeling • Parser • OpenGL Display • Progress Evaluation & Planning • Graphical User Interface • Sound & Animation • Communication Engine • Game Logic
Architecture Game Engine User Parser GUI Game Display Engine Sound & Animation Communication Engine Server
Modeling - Introduction • Modeling is the part to make the 3D models for the game • 3 types of model: • 3D animal models in the game • The environment of the forest • The weapon model
Modeling - Tool • Discreet 3D Max Studio 4.2 (the newest version) • Why? • common • Better for a beginner to learn
Modeling – Animal models • Simulating a real game • Keep the original animals of the game • Totally 8 animals • Elephant
Modeling – Animal Models • Lion, tiger, panther, fox • Dog, cat and mouse
Modeling – Scene Objects • Create a scene similar to the board • Many components that found in the forest • tree, mushroom • Bridge and hole
Modeling – Scene Objects • Combining all the scene objects:
Modeling – Scene Objects • Combining the scene with the animal models
Modeling – weapon models • Create 5 different weapons • stick, sword, gun, knife and hammer
Modeling - Technique • create a model, consider 2 things • its funny and interesting • simplicity • Funny • increase user’s interest • Simplicity • complexity of each model would relate to the game speed • due to the readability of the Parser
Modeling - Technique • Created two versions of the models • First version • The speed for loading into Parser is quite long • Second version • exists commonality between each model • their bodies, hands and legs are the same and the objects are primitive • increase the speed for readability of the parser.
Modeling - Technique First version Second version
Modeling - Integration • The parser need to read in the file in vrml format • Export each object from 3d max (.max) to vrml file (.wrl).
Modeling – Improvement & difficulties • Efficiency of the parser to read each object is still long for second version of model. • Improve the quality of the model still • finding the commonality for each model • Modifying export format for each 3d max model • redrawing the model with some better primitive objects.
Parser – Reason for using parser Why should we use the parser? • Difficult to render attractive 3D models • Efficient way to break down models • Easy to trace the nodes of the models
Parser – Role of parser • Transformation of VRML file into C++ recognizable data format. • Bridge between 3D models and OPENGL rendering process
Parser – Flow of the rendering process VRML files Parser 3D Studio Parser objects Object Collect C++ recognizable data format Display Engine Display
Parser – Structure design • Class which parses and stores VRML nodes and properties • Based on VRML 2.0 hierarchical structure • Create an object tree
Parser – Structure component Main Component: • SceneGraph Class • IO manipulation • Whole output data structure • Node Class • Root Node • Children Node • Non-children Node • etc
Parser – Structure hierarchy SceneGraph Root Node Root Node Grouping Node Grouping Node Children Node Non-Children Node Grouping Node Children Node Non-Children Node
Parser – Example • Root Node • DEF Node • Children Node • Shape Node • Non-children Node • Material Node • Appearance Node • Geometry Node
Parser – Implementation Approach • Object-Oriented Approach • Ready to be used in several place • High cohesion • Each node has its separate class to represent its properties • Low coupling • Class is provided API to facilitate its function
Parser – Implementation • Classes written in C++ • Integrate into Visual C++ 6.0 Project • Tokenizer • Use of flex and bison functions in Unix • Help analysis input and pattern matching
Parser – Mechanism • Read a VRML 2.0 file • Tokenize the VRML file into token • Store the data if the token is valid • Drop the data if the token is invalid • Output a C++ recognizable data structure
Parser – Difficulties and limitation • Suitable for parsing primitive objects • Long Processing time when parsing lots of complex objects • High performance computer should be used
Parser – Improvement • Reduce VRML file size • Using primitive objects • Good design of game flow • Reuse parsed objects • CPU processing is much faster than IO processing • Adding animation information in the object data file
Game Engine - Outline • Components • Scene Rendering • Game Flow • Event Handling • Improvements
Components - 3D Objects • Inherits from CObject class in MFC • A class for all the 3D objects - Characters - Background Objects (e.g. ground, river, sky…)
Components - 3D Objects • An 3D Object contains: - Location - Transformation - Power attributes (for characters only)
Components - Hierarchy of 3D objects CObject 3D Object Characters Background
Components - Camera • Defines the users’ point of view in the game • The Camera class contains: - Eyes location of the user - Targeting point
Components - Players • Define a player status in the game • A player class contains: - The “animals” remaining in the “forest” - Win/Lose
Components - Scene • Model a virtual reality environment (the game environment) • Contains a list of 3D objects
Components - Game Display Engine • Initialize the OpenGL context for drawing • Initialize the lighting of the scene • Define the viewport
Scene Rendering • 3D objects in the scene are stored in a list • Transformation is applied to the 3D objects • The game engine will call the object collection to render the 3D objects
Scene Rendering Object Collection Store all imported 3D objects Object List A list of objects to form a 3D objects Object Primitive objects, e.g. sphere, box….
Game Flow Program start Server Setting Connect to server Game start Quit game Game end
Event Handling • Handling user input event • Use arrows to move the view point • Use the left mouse click to select an animal (to move that animal) • User can trigger a dialog box to chat with the opponent
Improvements • Texture mapping of the background objects • Shorten the time to initialize the program • Smooth moving when user changing the view point