Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 408 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
408
Dung lượng
2,71 MB
Nội dung
Games on Symbian OS A Handbook for Mobile Development Games on Symbian OS A Handbook for Mobile Development Authors Fadi Chehimi, Leon Clarke (Ideaworks3D), Michael Coffey, Paul Coulton, Twm Davies, Roland Geisler, Nigel Hietala, Sam Mason, Peter Lykke Nielsen, Aleks Garo Pamir and Jo Stichbury (Lead author and editor) Contributors Sam Cartwright (Mobile Developer Lab), Tim Closs (Ideaworks3D), John Holloway (ZingMagic), David MacQueen (Screen Digest), Adam Taylor (Ideaworks3D) and Steve Townsend (Great Ape Software) Reviewed by Michael Aubert, Jan Bonnevier, Sam Cartwright, Martin de Jode, Brian Evans, Toby Gray, Martin Hardman, John Imhofe, Mathew Inwood, Mark Jacobs, Erik Jacobson, Rob James, Elina Koivisto, Kazuhiro Konishi, Mal Minhas, Ben Morris, Matthew O’Donnell, Matt Plumtree, Lane Roberts, Jesus Ruiz, Hartti Suomela, Steve Townsend, Shawn Van Every and Sally Vedros Head of Symbian Press Freddie Gjertsen Managing Editor Satu McNabb Copy Editor Lisa Voisin Copyright 2008 Published by Symbian Software Ltd John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England Telephone (+44) 1243 779777 Email (for orders and customer service enquiries): cs-books@wiley.co.uk Visit our Home Page on www.wileyeurope.com or www.wiley.com All Rights Reserved No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licensing Agency Ltd, 90 Tottenham Court Road, London W1T 4LP, UK, without the permission in writing of the Publisher Requests to the Publisher should be addressed to the Permissions Department, John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England, or emailed to permreq@wiley.co.uk, or faxed to (+44) 1243 770620 Designations used by companies to distinguish their products are often claimed as trademarks All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners The Publisher is not associated with any product or vendor mentioned in this book This publication is designed to provide accurate and authoritative information in regard to the subject matter covered It is sold on the understanding that the Publisher is not engaged in rendering professional services If professional advice or other expert assistance is required, the services of a competent professional should be sought The Publisher and the Author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation any implied warranties of fitness for a particular purpose The advice and strategies contained herein may not be suitable for every situation In view of ongoing research, equipment modifications, changes in governmental regulations, and the constant flow of information relating to the use of experimental reagents, equipment, and devices, the reader is urged to review and evaluate the information provided in the package insert or instructions for each chemical, piece of equipment, reagent, or device for, among other things, any changes in the instructions or indication of usage and for added warnings and precautions The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read No warranty may be created or extended by any promotional statements for this work Neither the Publisher nor the Author shall be liable for any damages arising herefrom Copyright 2007 Nokia All rights reserved Nokia, N-Series, N-Gage QD, N-Gage Arena, Space Impact, Pathway to Glory, High Seize, Pro Series Golf, System Rush: Evolution and Mile High Pinball are trademarks or registered trademarks of Nokia Corporation Other product and company names mentioned herein may be trademarks or trade names of their respective owners The Bluetooth word mark and logos are registered trademarks owned by Bluetooth SIG, Inc and any use of such marks by Symbian Software Ltd is under license Other trademarks and trade names are those of their respective owners All trademarks and logos that contain Java are trademarks or registered trademarks of Sun Microsystems, Inc in the United States and other countries Other Wiley Editorial Offices John Wiley & Sons Inc., 111 River Street, Hoboken, NJ 07030, USA Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA Wiley-VCH Verlag GmbH, Boschstr 12, D-69469 Weinheim, Germany John Wiley & Sons Australia Ltd, 42 McDougall Street, Milton, Queensland 4064, Australia John Wiley & Sons (Asia) Pte Ltd, Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809 John Wiley & Sons Canada Ltd, 6045 Freemont Blvd, Mississauga, Ontario, L5R 4J3, Canada Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library ISBN: 978-0-470-99804-5 Typeset in 10/12pt Optima by Laserwords Private Limited, Chennai, India Printed and bound in Great Britain by Bell & Bain, Glasgow This book is printed on acid-free paper responsibly manufactured from sustainable forestry in which at least two trees are planted for each one used for paper production Contents Forewords ix About this Book xiii About the Authors xvii Editor’s Acknowledgements xxiii Part One: A Symbian Perspective on Mobile Games Introduction 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 Why Games? What Is Symbian? What Is Symbian OS? Some Statistics Games Platforms Compared Types of Mobile Games Who Plays Mobile Games? Who’s Who in Mobile Game Creation? Mobile Game Distribution: Routes to Market The User Experience Mobile Game Platforms Portability and Compatibility Smartphone Characteristics The Future for Games on Symbian Smartphones Summary 1 10 13 16 17 20 25 27 32 37 38 40 vi CONTENTS Part Two: Creating Native Games on Symbian OS v9 Symbian OS Game Basics 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 Introduction The Game Loop The Heartbeat Timer Handling Input from the Keypad Handling Input from the Screen System Events Memory Management and Disk Space Maths and Floating Point Support Tools and Further Reading Graphics on Symbian OS 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 Introduction Overview On Frame Rate About Display Memory A Primer on Drawing on Symbian OS Direct Screen Access Double Buffering and Anti-Tearing Pixel Color Representations Loading and Manipulating Images Scaling for Variable Screen Sizes and Resolutions Rendering Text Playing Video Clips Less Useful APIs Summary Adding Audio to Games on Symbian OS 4.1 4.2 4.3 4.4 4.5 4.6 Introduction Multimedia Framework (MMF) Sound Effects Background Music Best Practice in Mobile Game Audio What’s Next? Multiplayer Games 5.1 5.2 5.3 5.4 Introduction Local Multiplayer Games Over a Bluetooth Connection Online Multiplayer Games Airplay Online: A Multiplayer SDK and Service Solution 43 43 43 46 49 52 54 57 59 60 61 61 62 64 67 68 75 83 90 97 105 111 115 121 121 123 123 124 128 142 150 151 157 157 159 160 165 CONTENTS 5.5 5.6 5.7 N-Gage Arena Other Online Multiplayer Solutions Further Reading Exploiting the Phone Hardware 6.1 6.2 6.3 6.4 6.5 6.6 6.7 Introduction Camera Location 3D Motion Sensors Vibration Summary Acknowledgements vii 171 174 174 175 175 178 188 198 207 216 216 Part Three: Porting Games to Symbian OS C/C++ Standards Support for Games Developers on Symbian OS 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 P.I.P.S Is POSIX on Symbian OS Open C OpenKODE OpenVG OpenMAX OpenSL ES EGL OpenGL ES Get Your Fix Enough Already! Further Reading The N-Gage Platform 8.1 8.2 8.3 8.4 8.5 8.6 A Brief History of N-Gage N-Gage Platform: The Next Generation of Mobile Gaming The N-Gage SDK The N-Gage Application Becoming an N-Gage Developer Summary 217 217 220 224 227 228 229 230 231 234 236 237 239 239 244 248 256 262 264 ... Characteristics The Future for Games on Symbian Smartphones Summary 1 10 13 16 17 20 25 27 32 37 38 40 vi CONTENTS Part Two: Creating Native Games on Symbian OS v9 Symbian OS Game Basics 2.1 2.2 2.3... Vibration Summary Acknowledgements vii 171 174 174 175 175 178 188 198 207 216 216 Part Three: Porting Games to Symbian OS C/C++ Standards Support for Games Developers on Symbian OS 7.1 7.2 7.3 7.4 ... Part One: A Symbian Perspective on Mobile Games Introduction 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 Why Games? What Is Symbian? What Is Symbian OS? Some Statistics Games