high level development

Upload: gururajallurkar

Post on 30-May-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 High Level Development

    1/47

    2001 Sony Computer Entertainment Europe

    High-Level Game

    Development for PlayStation2

    HemalHemal BodasingBodasing (SCEE)(SCEE)

    Confidential Information of Sony Computer Entertainment Europe

    1

  • 8/14/2019 High Level Development

    2/47

    High-Level Game Development for PlayStation2

    22001 Sony Computer Entertainment Europe

    Overview

    Problems with starting PS2 development

    Overview of high-level library (HiG) +demos

    HiG Art production pipeline HiG Usability issues

    Game demo

    Further work

  • 8/14/2019 High Level Development

    3/47

    High-Level Game Development for PlayStation2

    32001 Sony Computer Entertainment Europe

    Introduction

    Will NOT talk about:

    Algorithms used for specific effects PS2 hardware architecture details

    Low-level PS2 optimisation techniques

  • 8/14/2019 High Level Development

    4/47

    High-Level Game Development for PlayStation2

    42001 Sony Computer Entertainment Europe

    Problems with starting PS2

    development

  • 8/14/2019 High Level Development

    5/47

    High-Level Game Development for PlayStation2

    52001 Sony Computer Entertainment Europe

    Problems with starting PS2

    development I found it ****** hard!

    No exporters or engine available as part

    of the standard libs (or so I thought)

    Lack of a standard graphics file format

    Forces you to optimise from the start of

    the development cycle (eg VU coding)

    Sample Code vs Game Code

  • 8/14/2019 High Level Development

    6/47

  • 8/14/2019 High Level Development

    7/47

    High-Level Game Development for PlayStation2

    72001 Sony Computer Entertainment Europe

    HiG (HiHigh-level GGraphics

    Library) Overview Developed by SCEI (Japan)

    Open-source (to PS2 developers)

    Target users:

    Beginner-level PS2 users

  • 8/14/2019 High Level Development

    8/47

    High-Level Game Development for PlayStation2

    82001 Sony Computer Entertainment Europe

    HiG (High-level Graphics

    Library): GoalsHiG aims are:

    Usability Efficiency

    Extensibility

  • 8/14/2019 High Level Development

    9/47

    High-Level Game Development for PlayStation2

    92001 Sony Computer Entertainment Europe

    HiG (High-level Graphics

    Library): Goals Usability:

    Abstraction Reduce effort

    Efficiency

    VU1-based

  • 8/14/2019 High Level Development

    10/47

    High-Level Game Development for PlayStation2

    102001 Sony Computer Entertainment Europe

    HiG (High-level Graphics

    Library): Goals Extensibility

    Data format Plugin architecture

  • 8/14/2019 High Level Development

    11/47

    High-Level Game Development for PlayStation2

    112001 Sony Computer Entertainment Europe

    Relationship with Middleware

    Free to all PS2 developers

    PS2-specific

    Less comprehensive than middleware

    HiG is currently purely a rendering solution

    HiG architecture designed to allow middleware

    companies to develop plugins

    No dedicated support channel

  • 8/14/2019 High Level Development

    12/47

    High-Level Game Development for PlayStation2

    122001 Sony Computer Entertainment Europe

    High-level Functionality

  • 8/14/2019 High Level Development

    13/47

    High-Level Game Development for PlayStation2

    132001 Sony Computer Entertainment Europe

    High-level Functionality

    Fundamental operations:

    Loads mesh, texture and animation data Performs transformation (rotation, translation

    and perspective correction) and rendering

    Handles hierarchical meshes and keyframe

    animation

  • 8/14/2019 High Level Development

    14/47

    High-Level Game Development for PlayStation2

    142001 Sony Computer Entertainment Europe

    High-level Functionality

    Advanced operations:

    Reflection

    Refraction

    Shadow-mapping

    Fish-eye lens rendering

    Clut-based bump-mapping

  • 8/14/2019 High Level Development

    15/47

    High-Level Game Development for PlayStation2

    152001 Sony Computer Entertainment Europe

    HiG Demos

    Shadow mapping

    Reflection mapping Real-time environment mapping

  • 8/14/2019 High Level Development

    16/47

    High-Level Game Development for PlayStation2

    162001 Sony Computer Entertainment Europe

    Plugin System

    A plugin system is used to implement most of

    HiGs functionality

    HiG allows you to create your own plugins

    Plugins can be used in combination, eg for

    multipass effects

  • 8/14/2019 High Level Development

    17/47

    High-Level Game Development for PlayStation2

    172001 Sony Computer Entertainment Europe

    Plugin System

    Fundamental: shape (vertex + face data), microcode, texture,

    hierarchy, animation

    Advanced:

    reflection, refraction, shadow-mapping, fish-eyelens rendering, clut-based bump-mapping

  • 8/14/2019 High Level Development

    18/47

    High-Level Game Development for PlayStation2

    182001 Sony Computer Entertainment Europe

    Low-level Functionality

    HiG Service functions can be used to

    create your own plugins Service functionality covers:

    Data format

    Memory management

    DMA

    GS (Graphics Synthesiser)

  • 8/14/2019 High Level Development

    19/47

    High-Level Game Development for PlayStation2

    192001 Sony Computer Entertainment Europe

    Art Pipeline

    Exporters

    File formats Art Production Process

  • 8/14/2019 High Level Development

    20/47

    High-Level Game Development for PlayStation2

    202001 Sony Computer Entertainment Europe

    Art Pipeline - Exporters

    Exporters are available for 3DS Max,

    Maya and Lightwave

    Export to ES format

  • 8/14/2019 High Level Development

    21/47

    High-Level Game Development for PlayStation2

    212001 Sony Computer Entertainment Europe

    Art Pipeline - File formats

    All HiG file formats contain the following

    information:

    Mesh data

    Hierarchy data

    Animation data

    Texture data

    Texture context data

  • 8/14/2019 High Level Development

    22/47

    Art Pipeline: Production

  • 8/14/2019 High Level Development

    23/47

    High-Level Game Development for PlayStation2

    232001 Sony Computer Entertainment Europe

    Art Pipeline: Production

    Process

    Export from art package in .ES format

    If reqd, edit .es file to customise for specific

    features, eg shadow mapping. (Additional

    tools can be created to perform this)

    Use provided converter (esConv) to convertfrom .es to .bin file

    If problems exist with .bin file, .s file can be

    generated and inspected

  • 8/14/2019 High Level Development

    24/47

    High-Level Game Development for PlayStation2

    242001 Sony Computer Entertainment Europe

    HiG VCL Macro-Library

  • 8/14/2019 High Level Development

    25/47

    High-Level Game Development for PlayStation2

    252001 Sony Computer Entertainment Europe

    HiG VCL Macro-Library

    What is VCL? What is the HiG macro-library?

    Macro-library functionality

    Macro-library implementation

  • 8/14/2019 High Level Development

    26/47

    High-Level Game Development for PlayStation2

    262001 Sony Computer Entertainment Europe

    What is VCL?

    Text pre-processor for VU (Vector Unit) micro

    code.

    Note: Vector Units are are vector processors that

    perform high-speed floating-point operations such

    as vertex transformations

    VU coding requires dual-pipeline assembler

    VCL takes a single stream of instructions

    Produces optimised vu code. Basic support for macros and structs

  • 8/14/2019 High Level Development

    27/47

    High-Level Game Development for PlayStation2

    272001 Sony Computer Entertainment Europe

    VCL Macro-Library

    Functionality:

    Gives VU implementations of basic and

    advanced techniques (eg reflection /

    refraction mapping, real-time shadow

    mapping and fish-eye lens rendering)

  • 8/14/2019 High Level Development

    28/47

    High-Level Game Development for PlayStation2

    282001 Sony Computer Entertainment Europe

    VCL Macro-Library

    Implementation: Macros used for individual units of functionality, eg

    transformation, lighting, backface culling

    Each macro is about 10-20 lines long which makes

    for easy readability

    Number of microprograms available which use the

    macros as building blocks

    Excellent example of how VU code can be

    developed in a modular fashion

    Useful for non-HiG developers to look at

  • 8/14/2019 High Level Development

    29/47

    High-Level Game Development for PlayStation2

    292001 Sony Computer Entertainment Europe

    Game Demo

  • 8/14/2019 High Level Development

    30/47

  • 8/14/2019 High Level Development

    31/47

    High-Level Game Development for PlayStation2

    312001 Sony Computer Entertainment Europe

    Game Demo - Objectives

    To investigate the usability of HiG within a

    game architecture

    To produce a simple game demonstrating

    HiGs functionality

    If I can write this anyone can!

    Game Demo - Design &

  • 8/14/2019 High Level Development

    32/47

    High-Level Game Development for PlayStation2

    322001 Sony Computer Entertainment Europe

    Game Demo Design &

    Implementation

    Use of C++ for:

    Modularity, re-usability, maintainability, etc

    Map HiG functionality to game entities

    Fundamental classes for meshes, cameras,

    etc Instruction cache thrashing issue

    HiG Usability - Problems

  • 8/14/2019 High Level Development

    33/47

    High-Level Game Development for PlayStation2

    332001 Sony Computer Entertainment Europe

    HiG Usability Problems

    Encountered

    Data generation (Art pipeline) Much time spent resolving MAX exporter problems

    Conversion to and from intermediate formats

    Documentation Lack of English docs initially!

    Consists mainly of a lib reference

    Lack of How to... docs

    Other sources of documentation are scattered

    Have created a HiG overview doc which hopefully will

    address these issues

    HiG U bilit

  • 8/14/2019 High Level Development

    34/47

    High-Level Game Development for PlayStation2

    342001 Sony Computer Entertainment Europe

    HiG Usability

    Using HiG in a game architecture

    HiG works by building DMA chains

    Doesn't map easily to game objects / entities

    Mesh instancing

    Combining different functionality, eg reflectionswith shadow mapping

    G D T h i

  • 8/14/2019 High Level Development

    35/47

    High-Level Game Development for PlayStation2

    352001 Sony Computer Entertainment Europe

    Game Demo - Techniques

    Problem with true reflection-mapping: Area of the world seen in reflection is dependent

    upon the orientation of the reflecting object

    Often this is the uninteresting area of the world!

    G D T h i

  • 8/14/2019 High Level Development

    36/47

    High-Level Game Development for PlayStation2

    362001 Sony Computer Entertainment Europe

    Game Demo - Techniques

    Game reflection" effect: Real-time reflection map used with refraction microcode

    Interesting" area of the world can always be seen as a reflection,

    regardless of the orientation of the reflecting object Although the resulting effect is inaccurate, it works well in a game

    environment

    Small refraction index used to give discontinuity at edges

    Large missiles used for off-screen render!

    ToDo: Game Demo -

  • 8/14/2019 High Level Development

    37/47

    High-Level Game Development for PlayStation2

    372001 Sony Computer Entertainment Europe

    Techniques

    Static texture used for reflection effect on

    player ship

    Simple ship physics

    Interpolation used to give smooth motion

    Skydome Large hemisphere fixed relative to the camera

    Gameplay designed to show off effects

    Shadow mapping: ship pitching and rolling

    Reflection mapping: Large enemy character

    Game Demo Stats

  • 8/14/2019 High Level Development

    38/47

    High-Level Game Development for PlayStation2

    382001 Sony Computer Entertainment Europe

    Game Demo - Stats

    Note: All models are triangle-stripped

    Mesh Num Trian les Texture

    Player ship 1163 256x256 32 bitEnemy ship 368 256x256 32 bit

    Landscape 8015 256x256 32 bitSkydome 640 256x256 32 bit

    Missile 66 Untextured

    HiG Microcode Performance

  • 8/14/2019 High Level Development

    39/47

    High-Level Game Development for PlayStation2

    392001 Sony Computer Entertainment Europe

    HiG Microcode Performance

    Micro name Shading

    type

    Back-face

    culling

    Volume

    clip

    Light type Vertices/sec

    vu1basicVo vertex

    color

    N N directional 15,668,800

    vu1basicCli vertex

    color

    N Y directional 12,379,976

    vu1cullVo vertex

    color

    Y Y directional 10,188,080

    vu1fisheye vertexcolor

    Y Y directional 8,204,112

    vu1reflectR - N Y - 7,057,624

    vu1refractR - N Y - 7,057,624

    Performance PA Scan

  • 8/14/2019 High Level Development

    40/47

    High-Level Game Development for PlayStation2

    402001 Sony Computer Entertainment Europe

    Performance - PA Scan

    Performance PA Scan

  • 8/14/2019 High Level Development

    41/47

    High-Level Game Development for PlayStation2

    412001 Sony Computer Entertainment Europe

    Performance - PA Scan

    CPU cycles

    Data Cache miss

    DMA Transfer

    VU activity(micromode)

    GS Idle

    Performance

  • 8/14/2019 High Level Development

    42/47

    High-Level Game Development for PlayStation2

    422001 Sony Computer Entertainment Europe

    Performance

    PA scans:

    DMA bound

    Sends all the data which may be reqd -

    XYZ, normal, ST, colour

    Some data may be redundant, eg ST's notreqd for reflection / refraction mapping

    Data is uncompressed

    I-cache trashing

    Performance

  • 8/14/2019 High Level Development

    43/47

    High-Level Game Development for PlayStation2

    432001 Sony Computer Entertainment Europe

    Performance

    Tip:

    HiG clears DMA buffer every time a chain is

    sent

    Fixed cost per frame

    => Keep DMA buffer small (buffer sizespecified in sceHiDMAInit)

    Game demo uses 0.5K

    Further Work - Optimisation

  • 8/14/2019 High Level Development

    44/47

    High-Level Game Development for PlayStation2

    442001 Sony Computer Entertainment Europe

    Further Work - Optimisation

    Application-level:

    Use low level-of-detail meshes for off-screen render

    Reduce texture sizes

    Double buffering DMA chains

    Library-level: VIF compression of mesh data

    Currently DMAs 4 quadwords per vertex

    Further Work - Functionality

  • 8/14/2019 High Level Development

    45/47

    High-Level Game Development for PlayStation2

    452001 Sony Computer Entertainment Europe

    Further Work - Functionality

    Hierarchical animation

    Scene culling Multiple shadows

    Bump mapping (clut-based)

    Summary - 1

  • 8/14/2019 High Level Development

    46/47

    High-Level Game Development for PlayStation2

    462001 Sony Computer Entertainment Europe

    Summary - 1

    VCL-macro library worthwhile examining

    Demo and doc on PS2 website soon

    Where to start: sce\ee\sample\graphics\hig

    Summary - 2

  • 8/14/2019 High Level Development

    47/47

    High-Level Game Development for PlayStation2

    472001 Sony Computer Entertainment Europe

    Summary - 2

    Game demo achieved in a few months

    Most of the problems I encountered havenow been resolved

    By re-using code and tools, completely

    different demo using same techniquescould be achieved in a few days

    => High-level libs do exist and areusable!