1 / 16

Web Games Programming

Web Games Programming. Game Elements and Generic Content. Agenda. Consider generic features of a computer game Dealing with hardware devices Game scenario and player interest Deployment. Elements: User Input. Capturing application-wide keyboard input

ali-gentry
Download Presentation

Web Games Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Games Programming Game Elements and Generic Content

  2. Agenda • Consider generic features of a computer game • Dealing with hardware devices • Game scenario and player interest • Deployment

  3. Elements: User Input • Capturing application-wide keyboard input • Capturing keyboard input to a specific object • Capturing application-wide mouse actions • Capturing mouse input to a specific object • Creating drag-and-drop interactivity • Creating a custom mouse cursor (mouse pointer) • Managing focus • Game controller input support • Feedback device support

  4. Elements: Visuals and Sound • Visuals - Game World viewpoint • 2D - Side View or Top Down (Static, Scrolling) - e.g. PacMan, Frogger static topdown, Defender, Sonic - side view - scrolling. Finite game world or infinite. • 3D Simulated or Real time - simulated (Isometric, changing scenes)Flash-base 3D (Papervision API, Starling API) • Sound - Audio and Music • Music = MIDI generated sound, Audio = digital sound • Sound ‘candy’ at start of game, between levels, game over • Ambient sounds • Sprite sounds • Event sounds

  5. Elements:Maths,Physics and AI • Maths and Physics • Maths - calculating the distance between objects and points, collisions, rotations, movement around the game world using geometry and trigonometry, based on known theorems (Pythagoras) and rules - sine and cosine of angles (radians) - random integers for logic / state control, real values for probabilities. • Physics - reaction to collisions - motion under gravity (or not), speed, acceleration, velocity, friction, inertia. Some plug-ins available which provide physics properties e.g Ageia PhysX (Shockwave 3D and Unity 3D) • Artificial Intelligence • Simulated AI - tracking and evasion algorithms, patterns, finite state structures, fuzzy logic • Path finding algorithms (A*) flocking and swarming algorithms

  6. Game Setup and Launch • Set the Graphics Device (Poll hardware - get the best available screen resolution mode(s) - user decides) • Set the Sound Devices (Audio, MIDI, set levels - user) • Set Input Devices (Keyboard, mouse, joystick, controller) • Run the game intro and credits • User configuration - load last game state if available • Launch the game • while (runTheGameIsTrue){ // main game loop • setTimer • getPlayerInput • setSprites, applyAI, doCollisionDetection, addPhysics • renderFrameToBuffer • renderBufferToScreen • // end while (player wins/loses/quits) • Game Over - rerun save and or exit

  7. Device Handling (DirectX) Code fragment copied straight out of SimpleSample.cpp (Direct3D DirectX 9.0 SDK) • bool CALLBACK IsDeviceAcceptable( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat, • D3DFORMAT BackBufferFormat, bool bWindowed, void* pUserContext ) • { • // Skip backbuffer formats that don't support alpha blending • IDirect3D9* pD3D = DXUTGetD3DObject(); • if( FAILED( pD3D->CheckDeviceFormat( pCaps->AdapterOrdinal, pCaps->DeviceType, • AdapterFormat, D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, • D3DRTYPE_TEXTURE, BackBufferFormat ) ) ) • return false; • return true; • }

  8. Device Handling (Java) • public DisplayMode[] getCompatibleDisplayModes() { • return device.getDisplayModes(); • } • /** • Returns the first compatible mode in a list of modes. • Returns null if no modes are compatible. • */ • public DisplayMode findFirstCompatibleMode( • DisplayMode modes[]) • { • DisplayMode goodModes[] = device.getDisplayModes(); • for (int i = 0; i < modes.length; i++) { • for (int j = 0; j < goodModes.length; j++) { • if (displayModesMatch(modes[i], goodModes[j])) { • return modes[i]; • } • } • } • return null; • }

  9. Device Handling (C#) • /** Code fragment from SpaceWar (SceneGraph.cs) Microsoft XNA Framework • public Screen(Game game) • { • this.game = game; • this.scene = new SceneItem(game); • if (game != null) • { • IGraphicsDeviceService graphicsService = (IGraphicsDeviceService)game.Services.GetService(typeof(IGraphicsDeviceService)); • batch = new SpriteBatch(graphicsService.GraphicsDevice); • } • }

  10. ActionScript 3.0 Graphics Device Poll • Not required...Phew! • Flash comes with a ready-to-go graphics / animation engine • Just need to think about the screen resolution appropriate for a browser-based audience • ActionScript 3.0 has a Stage class that acts as a top level container for other container objects such as sprites

  11. Game Play: Getting the Right Balance Game Play Success and Progression Challenges / Difficulty

  12. Game Play:Boredom Challenges / Difficulty Game Play Success and Progression

  13. Game Play: Frustration Game Play Success and Progression Challenges / Difficulty

  14. Game Play: Vary the Balance Game Play Success and Progression Challenges / Difficulty Make early levels easy to encourage progression Provide game entry points - novice, expert etc.

  15. Elements of a Computer Game • Visuals • Sound • Action • Input • Objectives / Challenges • Time Limits • Levels / Progression with Rising Difficulty • Scoring • Saving Game State • Addictive Quality - the hardest thing to code - more about artistry and ideas!

  16. Game Deployment • How will your game be accessed? • CD / DVD (localised) • Network Play • Mobile Device - Smart Phone, Tablet • Web All will have deployment considerations which must balance game sophistication with technical constraints of device and / or network bandwidth

More Related