dev.mag - 16

Upload: georgpiorczynski

Post on 30-May-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Dev.Mag - 16

    1/32

    August 2007

  • 8/14/2019 Dev.Mag - 16

    2/32

    REGULARS

    EdsNote.........................................................................................P03

    News...............................................................................................P04

    SPOTLIGHT

    NicklasNygren,creatorofKnytt.......................................................P05

    OPINION

    AReallyJuicyStory.........................................................................P08

    REVIEW

    NewgroundsFlashPortal................................................................P09

    DESIGN

    BlenderIntermediateTutorial:Converting2Dto3D........................P10

    ABeginnersGuidetoMakingGames:Part3..................................P12

    ABeginnersGuidetoMakingGames:Part2EXTRA.....................P14

    PROJECTS

    RoachToaster2:BigCity................................................................P15

    TECH

    CodingEtiquette:Doxygen..............................................................P16

    GameCodingwithTrigonometry:Part3.........................................P19

    Gooptimise!....................................................................................P22

    HISTORY

    TheHistoryofI-ImaginePart6:EnterthePublisher......................P25

    TAIL PIECE

    InCasualWeTrust..........................................................................P29

    CONTENTS WHATS INSIDE

    05

    10

    22

    25

  • 8/14/2019 Dev.Mag - 16

    3/32

    EDS NOTE THE BIG CHIEF

    Wowee,thesituationisgettingintense.Iwillconfess:thingshavebeenslowthismonth.

    WithIssue16,thatis.Butatthesametime,stuffisgoingreally,reallyfastanditsgetting

    prettytrickytokeepupwitheverything.Onthecommunityfront,thewinnersofComp15

    havebeenannouncedandaniftyR5000goestoEvil_ToasterforhisgameCartesian

    Chaos(luckybugger).Wevealsogotsomeprettycoolgamesfromtherunners-upandafullreportwillbe

    presentinthenextDev.Mag.Inthemeantime,wevealsogotComp16startingup(text-basedgraphics

    beingthetheme)andpeoplearescrabblingtogetsomeentriesinbeforethe28thofthismonth.

    Ofcourse,IstillhaventexplainedwhyIssue16wassolongincomingout:asitsohappens,wevegotrAge

    comingupattheendofthismonth.InhonourofthisannualSAtechnologyexpo(abiggieonourcalendar),

    Dev.MagIssue17willcomeoutcompletewithafullvisualmakeover,amassiveamountofcontent,and

    someotherexcitingoddsandendswhicharetakingupalotofourattention.Asofnow,whileImsitting

    herefuriouslytappingoutmylittleeditorsspiel,theresanotherlittlewindowopenonmycomputershow-

    ingthefirstdraftofthenew-lookmag,accompaniedbyatentativefirstarticle.Hopefully,theproblems

    encounteredwiththiseditionwillbeforgivenonceourbumperissueseesthelightofday.

    Untilthen,youhavethisoffering.Idontquiteknowhowtheteammanagesit,buteverymonthhasatleast

    onepersontoddlinguptomeandpresentingsomethingawesomeforeitheraspotlightorafeature.This

    month,wevesnaggedatalkwithNifflas,thecreatorofthepopular(andabsolutelyadorable)freeware

    game,Knytt.Ifyoudontknowwhatitis,turntopage5andfollowthelink.Ifyoudoknowwhatitis,turn

    topage5andhaveanawesometimereading.

    ThatsitfornowifIblabanylonger,thismagsgoingtobedelayedevenfurther,andavidreadersare

    goingtobebringingthetorchesandpitchforkstomyproverbialdoortomakesureIshutup.Staytunedfor

    Dev.Mag17.Itsgoingtobeablast,andyouwontwanttomissthat.

    Editor

    Rodain Nandrew Joubert

    EDITOR

    Rodain Nandrew Joubert

    DEPUTY EDITOR

    Claudio Chippit de Sa

    SUB EDITOR

    Tarryn Azimuth van der Byl

    DESIGNERS

    Brandon Cyberninja Rajkumar

    Geoff GeometriX Burrows

    MARKETING

    Bernard Mushi Mushi Boshoff

    Andre Fengol Odendaal

    WRITERS

    Simon Tr00jg de la Rouviere

    Ricky Insomniac Abell

    William Cairnswm Cairns

    Danny Dislekcia Day

    Andre Fengol Odendaal

    Heinrich Himmler RallMatt Flint Benic

    Luke Coolhand Lamothe

    Stefan ?rman van der Vyver

    Gareth Gazza_N Wilcock

    WEBSITE DESIGNER

    Robbie Squid Fraser

    WEBSITE

    www.devmag.org.za

    EMAIL

    [email protected]

    This magazine is a project of the

    South African Game.Dev commu-

    nity. Visit us at:

    www.gamedotdev.co.za .

    All images used in the mag are copy-

    right and belong to their respectiveowners. If you try and claim other-

    wise, think again. In fact, think ca-

    sual.

    ... no, wait, scratch that.

    Think sentient strawberries.

    DID YOU KNOW?

    Thinkthathavingajobasatesteriseasy?Think

    again.Arecentchataboutthetestingprocessof

    Crackdown,afree-roamurbangameconsisting

    of495cityblocks,revealedsomestartlingfigures.

    Oneofthesewastheamountofenvironmentbugs

    thatwerereportedandsquashed:awhopping

    10000.Notatypo.

    DEV.MAG ISSUE 163

    This months opinion columnists:

    QuintonQ-man Bronkhorst

  • 8/14/2019 Dev.Mag - 16

    4/32

    XNA Gamefest videos released

    http://creators.xna.com/Headlines/presentations/default.aspx

    GameFest 2007 was an educational experience which also provided benefits for the

    armchairenthusiasts.Yes,eventhosewhohaventattendedthefestivalcanstillwatch

    severalcomprehensivepresentationsonthever-

    satileXNAgamedevelopmenttool,thankstothe

    XNACreatorsClubwebsite.Thereare7videos

    viewableonline,mostofthematleasthalfanhour

    longandrangingfromtopicslikeXNAGameStu-

    dio forFun andProfit toprofilesof XNAworks

    inprogress.Worthalookifyouhavethetime.

    NVIDIA releases third GPU programming book

    http://developer.nvidia.com/object/gpu-gems-3.html

    NVIDIA has released its third GPU programming book,

    entitled GPU Gems 3, which outlines some of the

    more advanced uses of the graphics processing unit

    in NVIDIA cards, even outlining uses such as physics

    simulations, financial analysis and even virus detection.

    Whoah! The book, which is roughly 1000 pages, also

    has the latest algorithms for a menagerie of advanced

    graphics effects. The price? $69.99 from Amazon.

    NEWS HEADLINES

    Casual games study

    http://www.gamasutra.com/php-bin/

    news_index.php?story=15145

    Casualgamesseemtobethepopular

    choice for Internet users, according to

    arecentstudyconductedbyParksAs-

    sociates. Gamasutra reports that the

    companyhasfoundcasualgamestobe

    evenmorepopular thanmajor players

    such asYouTube and Myspace. Not

    onlyiscasualgamingthemostpopular

    pasttime,butitsgrowthinrecentyears

    hasbeenimpressiveandthiswillprob-

    ablymakeroomformoreaviddevelop-

    ers.Timetoclamberontothebus.

    Torque MMO kit free under BSD-style licence

    http://www.gamedev.net/community/forums/topic.asp?topic_id=459909

    WantagoodreasontobuytheTorqueGameEngineandArcaneFX?

    Well,Gamedev.netreports thatthecrewfromGarageGameshave

    givenfanspreciselythatwiththeoffertomaketheTorqueMMOkit

    freeforbothcommercialandnon-commercialusetoanybodywho

    alreadyownsTGEandArcaneFX.Accordingtothemarketblurb,

    TheMMOkitrepresentsfouryearsofdevelopmentandthousandsof

    hoursoflabour,andthefullPythonandTorquescriptsourceisnow

    available.

    DEV.MAG ISSUE 164

  • 8/14/2019 Dev.Mag - 16

    5/32

    Nifflas is an individual on the web whoseems to enjoy creating the cutest and

    most intriguing little games. One of these

    is Knytt (http://nifflas.ni2.se/), a freeware

    jump n climb platformer thats notable

    for being remarkably polished and eerily

    engaging. We decided to have a little talk

    with him about the whole game making

    deal.

    Tell us about how you got into game de-

    velopment? What got you interested?

    When did you start?

    Istartedoutaround10yearsagowithKlik&

    Play.Sinceitwasalongtimeago,Icantquite

    remember what got me interested. Ive sim-

    ply always had aninterest increating things,

    nomatter ifit have beenbuildingthingswith

    LEGO,composingmusic,drawingthings,orat-

    temptingtocreatecomputergames.

    IttookmequitealotofyearstofigureoutthatI

    shouldkeepmygameprojectsatareasonable

    size.IfittookSquarealargedevelopmentteam

    tocreateagamelikeChronoTrigger,Ishould

    haveknownbetterthanbelievingthatitwould

    bepossibleformealonetocreateanRPGthat

    youdneedtospendover60hourstobeat.

    AfewyearsagoIrealisedthisthough,andgave

    game development another go, and created

    #modarchivestory- andsince thenIvebeen

    releasingmygamesonamoreorlessregular

    basis.Sincethenmygameshaveincreasedin

    size andmorepeople havebeenhelpingme

    out,butImofcoursestillnevercreatingany-

    thingnearlyaslargeasthestuffIplannedinthe

    past.Butreally,itsnotthesizeofthegamethat

    expressmeanyway,itsthecontent.

    What made you decide to create a game such

    as Knytt?

    Well,I wasworkingonWithin aDeepForest

    SPOTLIGHT WELCOME TO THE WORLD OF KNYTT

    DEV.MAG ISSUE 165

    TALKING TO NICKLAS NYGRENCreator of Knytt

    2,butwasntreallyinspired.IwantedWaDF2

    tohavesomemini-games,soIplannedKnytttobe aWaDF2mini-game,but assoonas I

    startedtocreatethefirstpartofKnytt,Igota

    massive amount of inspiration to continue on

    that,whileIspentlesstimeonWaDF2.Inthe

    end,IabandonedWaDF2becauseofthelack

    ofinspiration,andreleasedKnytt.Imstillreally

    happyaboutthatdecision.Iknowalotofpeople

    wouldhavepreferredmetofinishWaDF2,but

    personallyIcaresomuchaboutcreatingthings

    whichreallyexpressmyself-andKnyttreally

    doesthat,perhapsmorethananyotherofmy

    gameseverhas.

    Tell us more about your upcoming game,

    Knytt Stories.

    Ive been working onKnyttStories since the

    dayIreleasedKnytt(December2006ifI dont

    rememberwrong).ItsbasedontheKnyttplat-

    formengine,butfeaturesmorechallenge,pow-

    er-ups, anda powerful level editor.Thistime

    Im trying toencourage the players to create

    theirownlevelswiththeirownuniquestories.

    Itswithnodoubtmylargestcreation,anditsreleaseisjustaroundthecorner.

    You created a niche on the net for your

    games. Do you think every developer can

    have this kind of niche?

    Iseenovalueinbeingoriginaljustforthesake

    ofbeingoriginalitself.Idohoweverthinkthat

    mostgamesaretooalikethesedays,asifthe

    developersjustseetheirgamesasentertainent

    createdtomeetthedemandsoftheaudience,

    rather than a form ofartistic expression. Of

    course,thereareplentyofexceptions.

    The music in Within A Deep Forest and Knytt

    lends a great deal to the atmosphere of the

    game. Have you ever considered making

    music as a career?

    IbettermentionfirstthatIdidntcreatemostof

    themusicforWithinaDeepForest,Ionlycre-

    atedoneofthesongsonmyown(theonein

    Utopioca).Icreatedaroundhalfofthemusicin

  • 8/14/2019 Dev.Mag - 16

    6/32

    SPOTLIGHT WELCOME TO THE WORLD OF KNYTT

    DEV.MAG ISSUE 166

    Knyttthough.EarlierIwasplanningtomaking

    musicas acareer, butat themoment,things

    lookslikegamedevelopmentismybestchance

    foracareer...

    You have a whole community of fans help-

    ing you on Knytt Stories. How do you find

    working with such a community??

    ItsgreatfunIgotaninsaneamountofhelpde-

    signingtilesetsforthegame,whichiswhyKnytt

    Storieswillcomewithalibraryof256tilesets

    thatcanbeusedinleveldesign.Mostgames

    justcomewiththegraphicsthatareusedinthe

    gameitself(ofcourse,KnyttStorieslevelscan

    featuretheirowncustomgraphicstoo).

    Ico was a huge inspiration for Knytt. Do

    you think games like these are grossly un-

    derrated?

    IcantsayIcoisunderrated,althoughIconever

    becameahugecommercialsuccess(ifIdont

    rememberwrong,thatis).Thereviewersreally

    lovedthatgame,andgaveitthefeedbackitde-

    served.Butyeah,Idlovetoseemoreofthose

    kindofgames.

    Do you want to continue working on small

    games like these, or are you interested in

    getting into the major game industry?

    Imopenforanything,aslongasIdonthaveto

    sacrificethepersonalityofmygames.Inother

    words,Idratherkeepreleasingsmallproduc-

    tionsthanjoiningabigcompanyandhelpout

    designinggamesthatIdontreallylikeorhave

    any control of. A smallcompanywith people

    whosharemyideaswouldbetheidealthing.

    What recent game that you have played

    made you sit up and say Wow, this is ge-

    nius?

    Shellblast by Vertigo Games is fantastic, al-

    thoughIneverlikedthewaronterrorphrase

    usedinit(negativeassociations).Itsportable

    too!

    language? Do you think there is a place

    for games not made in English?

    YourenotlikelytofindKnyttintheaveragedic-

    tionary,butitsstillawordsometimesusedto

    describesmall harmlesscreatures.Originally,

    thewordwasinventedbyToveJansson(the

    childrensbookauthor)knownfortheMoomin

    trolls. Theparticular bookthat usesthe word

    is titled Vem ska trsta knyttet? (which is

    translatedtoWhowillComfortToffle?inthe

    Englishversion).Icanhighlyrecommendthis

    childrensbook.

    Abouttheotherquestion:yeah,Ithinktheres

    aplaceforgamesinanylanguage,butaswith

    allotherthings,youcangetawideraudienceif

    thegameisavailableinalanguagethatmore

    peoplespeak.

    TROOJG

    Quick Questions ... 3 ... 2 ... 1 ... Go!

    Pizza or Pasta?

    Pasta

    PS3, Wii or Xbox-360?

    XBoxhavealwayshadmoregoodgames,

    butPlaystationhavealwayshadthemostin-

    terestinganduniqueproductions(although

    thereareonlyaveryfewofthem).Imgonna

    havetogowithPS3.

    The Simpsons or Family Guy?

    Simpsons

    Guitar or Piano?

    Piano

  • 8/14/2019 Dev.Mag - 16

    7/32

  • 8/14/2019 Dev.Mag - 16

    8/32

    When Iwas approached towriteanice little opinion piece for Dev.

    Mag,Ifoundmyselfsittinginfront

    ofmywordprocessingapplication,staringrath-

    erblanklyatthescreen.Onlyhavingdonelow-

    levelprogramminginhighschool(intheformof

    TurboPascal7.0)IcametorealizethatIdont

    really know much about game development

    - and thatwhichI doknow, isnowherenear

    enoughtofillawholeopinionarticle.Afterall,

    themostIvedoneintermsofgamedevelop-

    ment,isalittletext-basedRPGofepicfailure.

    SowhileIstartedtypingoutspacefillerabout

    howlittleIactuallyknowaboutgamedevelop-

    ment,andhowwhatI did knowwouldnot be

    sufficientenoughtofillacolumnithitmelike

    aproverbialbricktothehead;insteadofwast-

    ingallthisspace,wafflingonlikeapretentious

    git,IshouldwriteaboutsomethingIdoknowa

    lotabout:

    Boyohboy,doIlovetotellagoodstory..

    Itshouldbeobvioustomostpeople,thathav-

    inggoodprogramminginagame,althoughex-

    tremely important, isntalwaysgoing tomake

    your game the winner. Every game needs a

    story; from a plumpplumber in red savinga

    pinkprincessfromadragon-thingwithaspiked

    turtle shellon his back, toa journey into the

    horrorsofonesownmindtofacepsychological

    demonsbroughtouttoattackyou,bysubcon-

    sciousguilt.Iwouldevenhazardaguessthat

    OPINION WHAT YOURE THINKING

    them.Therecouldbeminorormajorobstruc-

    tions hemust overcome, or even strawberry

    generalsto destroy thereareno limits from

    thispointon.

    Itmaysoundlikearidiculousstory,butifyouve

    readupuntilthispoint,itmusthaveintrigued

    youinsomeway.Withoutastoryforyourgame

    to work on, your game isnt going to make

    muchsensetotheplayer.WhyamIshooting

    thesepeople?Wherearethesechickenscom-

    ingfrom?Whatisthepointofcollectingallthis

    ham? These are the kinds of questions you

    needtoanswer.

    Ifyoucansellsomeoneacompellingstoryofa

    braveyoungorangesavinghispeoplefroman

    evilstrawberrysiege,andhaveitmakesense

    inthecontextofyourgame;youjustmighthave

    somethingsolidtostartworkingon.

    Q-MAN

    If you fancy saying something about game development and have enough

    faith in your writing ability to do so, feel free to submit content to our

    monthly opinions section.

    Send your work, 400-500 words in length, with the subject title Opinion

    Submission to [email protected], and you may just wind up in our pag-

    es. Please note that we reserve the right to decide what material is suitable

    to publish in the magazine.

    DEV.MAG ISSUE 168

    The Dev.Mag staff does not expressly support or agree with the views of guest columnists in this section. In fact, the Dev.Mag

    staff does not expressly support or agree with the views of Dev.Mag staff writers in this section.

    Its a crazy world, isnt it?

    A really juicy

    story

    evengamessuchasTetriswerecreatedwithsomeformofworldinmind.

    Soweremakingagameright?Ok,soletsget

    started then.Beforewecaneven think about

    programming anything,weneedsomesort of

    concept.Oranges.Orangesthatarealive.Lets

    workwiththat.Wherearetheselivingoranges

    found?Letsjustsaytheyrelivinginthemagi-

    cal city ofCitrus, where the buildings are all

    fruityandbright.Weregoingtonowintroduce

    ourmaincharacter,Oscar,whoisjustanevery

    daykindoforange,goingabouthiseveryday

    orangeystuff.

    Ohdear,butthatwouldbeaboringconcept(un-

    lessitwereafruitcitysimulatorcoveredinan-

    otherarticlesometimeperhaps)soweneedto

    bringsomesortofconflictinhere.Strawberries!

    TheevilstrawberrieshavedeclaredwaronCit-

    rusCityandhavebesiegedthetown,takingall

    oftheorangescaptivetobesqueezedfortheir

    juicestomakesugar-filled,impurecold-drinkin

    specialConcentrationcamps.Theonlyorange

    whocanstopthemisOscar!

    Nowthatwehaveourlocation,charactersand

    conflict,wecanstartgettingourheadsaround

    howOscarwillgoaboutsavinghispeople.Ido

    believe this is the pointwhere programmers

    ears should prick up. AsOscar rolls through

    thecity,heencountersevilstrawberrieswhich

    hemusteitherpower-chargethrough,bomb-

    drop on, ormerely avoid, by bouncing over

  • 8/14/2019 Dev.Mag - 16

    9/32

    9

    NewgroundsNewgroundsNewgroundsNewgrounds

    REVIEW ON THE WEB

    imple,quickandeasygamesareking

    intheworldofcasualgaming.Inthis

    vein,itisnosurprisethatflashgames

    are immensely popular online, with

    numerous flash-gameportalsappearingallover the web.Nothing isquicker oreasier

    than navigating your browser to your

    favouriteportalandselectingagame.

    Newgroundsislikelythelargestflashportal

    around, boasting over a million registered

    users and 300 000 submissions, including

    flashvideosandgames.Sinceitsfoundation

    12 years ago, Newgrounds has done for

    flash gaming whatYouTube did foronline

    video.

    Part of its success can be attributed to a

    largeandactivecommunity,spurredonbya

    ranking system that rewards users for

    participatinginthesite.Ratinggamesscores

    users Grounds Gold which places more

    weight behind future

    votes, as well as

    increasing the users

    rank,earningtheusermorerespectinthecommunity.

    To keep the site fresh,

    submissionsthathave

    alowaggregatescore

    are automatically

    removed from the

    website,orblammed.To

    encourage fair voting, the

    websiteawardsblam/protectpointstousers

    whosevotesaccuratelydepicttheeventual

    fate of the game. These points alsocontributetowardsausersrank.

    Newgrounds has been home to many

    popular flash video and game series,

    S

    DEV.MAG ISSUE 16

    including Salad Fingers and Super Mario

    BrothersZ.ItisalsotheoriginalhomeofThe

    BehemothssurprisehitAlien

    Hominid, whose prototype

    was first displayed atNewgrounds.AlienHominid

    wentontobeapopularPS2

    andGamecubetitle,with a

    HD Xbox Live Arcade

    version recently released. The

    Behemoth is also currently

    working on another XBLA title,

    Castle Crashers, which also

    lookssettobeasuccess.

    Foraquickfixofgamingfun,orforalittlebit

    a humour, Newgrounds is always a greatplacetolookforaqualitydiversion.

    CHIPPIT

    WebsiteWebsiteWebsiteWebsite

    http://www.newgrounds.com/

    UpdatedUpdatedUpdatedUpdated

    Continuously

  • 8/14/2019 Dev.Mag - 16

    10/32

    10

    BLENDER INTERMEDIATE TUTORIAL:BLENDER INTERMEDIATE TUTORIAL:BLENDER INTERMEDIATE TUTORIAL:BLENDER INTERMEDIATE TUTORIAL:

    Converting 2D to 3DConverting 2D to 3DConverting 2D to 3DConverting 2D to 3D

    DESIGN ENTER THE 3D WORLD

    onverting2Ddrawingsinto3D.Yep,

    thatsoundsprettycool,right?Inthis

    articleIwillshowyouhowtotakea

    2D design and transform it into 3D. Yes,

    there are limitations, but what we can do

    heremightjustcomeinveryhandy.

    WewillusetheGIMP,consideredthebest

    Open Source alternative to Adobe

    Photoshop. In the GIMP we wi ll draw

    something,selectthatdrawingandusethe

    GIMPtocreateanoutline.Theoutlinewillbe

    exportedoutoftheGIMP,andimportedinto

    Blender. Blender will then add the 3D

    element.TheGIMPcanbedownloadedfrom

    www.GIMP.org.

    Forthistutorialwewillcreateasimplegame

    interfacescreenusingthefollowingsteps:

    DrawinGIMP

    Selectthedrawnbits

    ConverttheselectiontoapathExportthepath

    ImportthepathintoBlender

    Adddepthtotheobject

    Let'sgetgoing.FireuptheGIMP.Assuming

    thatmygamescreensizewillbe800X600

    pixels,Iwillcreateanimageofthatsizein

    theGIMP.Whatactuallyhappensisthatyou

    can scale the object toany size once you

    haveitinBlender,butitiseasiertoworkwith

    theactualdimensionsintheGIMP.Thebest

    suggestionIhaveforcreatingadesignthat

    will work well

    for conversion

    into3Dis:

    Todo the

    design in one

    colour only.

    Thismakesiteasyfortheselectiontoolto

    selectonlythatcolour.

    Yourdesignpiecescannothaveholesin

    them.Iftheydo,you'llneedtothinkcarefully.

    Now,usetheSelectregionsbycolourtool

    toselectacolourontheimage.Youshould

    see the single colour surrounded by a

    flashingdottedoutline.Nowthatwehavea

    selection,weconvertthattoapath.Apath

    isalsocalledavector,orcurve.Itisawayof

    C

    DEV.MAG ISSUE 16

    describing an

    outline in

    mathematically

    precise terms.

    You can then

    scale or move

    thatlinewithout

    losing any

    quality. Use

    Select --> To

    Path to convert

    our selection

    into a path/

    curve/vector.

    Now,openthePathsdialog.Selectthepath

    oujustcreated,rightclickonit,andchoose

    ExportPath.Typeaname,andbesureto

    include the extension. Call the file

    interface.svg. The .svg extension is for

    scalablevectorgraphics.

    Now,finally,wegettoBlender.Herewecan

    nowimportthefileasaGIMP2.0file,giving

    us the outline of what we created in 2D.

    Pleasedelete everything you have inyour

    scene. Easiest way isto AKEY (select all)

    andDELETEKEY.NowgotoFile-->Import

    -->Paths(svg,.ps).ChooseGIMP2.0in

    thenextmenu.Browsetothelocationofyour

    exportedpath.svgfile,andselectthatfile.

    Next, just click onImport Path,and click

    OKintheimportoptionsmenu.

    (IfyourenewtoBlender,checkoutDev.MagIssue5forthebeginningofourBlendertutorialseries!)(IfyourenewtoBlender,checkoutDev.MagIssue5forthebeginningofourBlendertutorialseries!)(IfyourenewtoBlender,checkoutDev.MagIssue5forthebeginningofourBlendertutorialseries!)(IfyourenewtoBlender,checkoutDev.MagIssue5forthebeginningofourBlendertutorialseries!)

  • 8/14/2019 Dev.Mag - 16

    11/32

    11

    DESIGN ENTER THE 3D WORLD

    Welldoneifyougotthisfarwithouthassles!

    Mostpeopledon'teventhinkofthisoptionof

    combining2Dand3Ddesign.

    You now have a curveobjectin Blender.

    Youoptionsare:

    Usethecurveoptionsmenutoextrudethe

    outlineinto3D

    Converttheoutlinetoa meshandwork

    fromthere.

    I'mgoingtousethecurvemenuoptionsto

    extrudethe outlineintoa 3Dshape.Go to

    theEditbutton.Thisiswhereyou'llfindthe

    curveoptions:

    Extrude:Makestheobject3D

    BevelDepth:Addsbevellededge

    BevReso:Smoothesthebevellededge

    Idecidedtobringtheoutsideorangeborderinasacurve

    aswell.Inthiscase,Blender

    founditeasytounderstand

    the curve. It consists of a

    rectangle (4 points) on the

    insideandarectangleonthe

    outside(4points).Youmay

    find that if your shape is

    more complex, GIMP will

    use different numbers of

    points to define thecurves,

    whichwillleadtounreliable

    results in Blender. There

    are,however,waystosolve

    theseproblems,buttheygo

    beyondthescopeofthisspecifictutorial.

    Afterimportingtheorangeoutlineaswell,my

    Blendercurveobjectslookliketheimageto

    theright.

    Ihadaside-scrollingspaceshooterinmind,

    soIwillchangethecoloursandpresentation

    oftheinterfacetoreflectthat.Ialsoedited

    thecurveontheoutsidesothatIcouldhave

    space on the left to add some interface

    buttonslateron.

    DEV.MAG ISSUE 16

    Iwon'tbeenteringthisdesignforanygaming

    competitionsascandidateforbestinterface

    design, but I trust that your creative spirit

    maytakesomethingfromthis,andapplyitto

    yourownwork.

    HappyBlendin',folks!

    ?RMAN

  • 8/14/2019 Dev.Mag - 16

    12/32

    12

    Beginners Guide to MakingBeginners Guide to MakingBeginners Guide to MakingBeginners Guide to Making

    Games - BackgroundsGames - BackgroundsGames - BackgroundsGames - Backgrounds

    DESIGN HELPING YOU ALONG

    his is the third article in the Beginners Guide to Making

    Games.Sofar,wehavelookedatmakingobjectsmoveand

    checkingwhethertheycollidewitheachother.Thismonthwe

    willlookatvariousoptionswehaveforsettingbackgrounds

    inourrooms.

    ThemaingoaloftheBeginner'sGuideseriesistotryandensurea

    detailedunderstandingofthevariousconceptssothattheycanbe

    applied to other new and exciting games. While most traditional

    tutorialswillshowyouwhatcodeisneeded,theseguideswillensure

    thatyouwalkawayactuallyunderstandingeachoftheseconcepts.

    This article isaimed atsomeonewhohas juststarted learningto

    makegames.Whileitisexpectedthatthereaderofthearticlehas

    completedthefirstGameMakertutorialandcanthuscreatesprites

    andobjects,it isquite possibleto follow thearticlewithout having

    doneso.Thearticleisstructuredtointroduceanewprogrammerto

    theconcept,andperhapsbeofsomevaluetotheintermediate-level

    programmeraswell.

    Thismonthsarticlewillcontainthefollowingsections:

    1. AGameMakertutoriallookingatsettingabackground

    2. AGameMakertutoriallookingatatiledbackground

    3. Fiddlingwi thbackgroundsinGML

    BackgroundsGMTutorialBackgroundsGMTutorialBackgroundsGMTutorialBackgroundsGMTutorial

    Backgroundsarecriticalinsettingthethemeandfeelofagame.In

    GameMaker,it'seasytosetupabackgroundanduseitinaroom.

    Step1CreatetheBackgroundStep1CreatetheBackgroundStep1CreatetheBackgroundStep1CreatetheBackground

    Addanewbackground(eitherunderthebackgroundslinkontheleft)

    orbyselectingAdd|Addabackgroundfromthemenu.Choosethe

    imagethatyouwant.Fornow,selectanimagethatisbigenoughto

    coverthewholescreen.

    In most cases, backgrounds don't need to be transparent or

    smoothedastheyshouldbedesignedtolookrightjustastheyare.

    Ifyourbackgroundimageisnotlargeenoughtofillthewholescreen

    itwillneedtobetiled.Inthiscase,youneedtomakesurethatthe

    imagecantileseamlesslyfromlefttorightandtoptobottom.

    Step2CreateaRoomStep2CreateaRoomStep2CreateaRoomStep2CreateaRoom

    Addanewroomandnameit.Selectthebackgroundtabandselect

    the newly created image as the foreground image. Uncheck the

    Drawbackgroundcolourcheckbox.Itwastesprocessingpowerto

    paintthebackgroundandthentodrawtheselectedbackgroundover

    thepaintedbackground.

    IftheimageusedforthebackgroundneedstobetiledsettheVertical

    andhorizontalcheckboxesandsetthenumberofimagestotileover

    thehorizontalandverticalspace.

    Anotheroptionforbackgroundsistostretchasmallerimageacross

    the full screen. Very small images will become very pixelated if

    stretchedsoonlyimagesthatareclosetothescreensizeshouldbe

    usedasstretchedbackgrounds.

    TilesGMTutorialTilesGMTutorialTilesGMTutorialTilesGMTutorial

    Tilesareverysimilartobackgrounds,butinsteadofusingasingle

    imagetocoverthewholeroomtheimageusedto tileis splitinto

    smallpiecesandaddedtothescreenbitbybittoformanimage.

    T

    DEV.MAG ISSUE 16

  • 8/14/2019 Dev.Mag - 16

    13/32

    13

    DESIGN HELPING YOU ALONG

    Step1CreatethebackgroundtilesStep1CreatethebackgroundtilesStep1CreatethebackgroundtilesStep1CreatethebackgroundtilesCreateabackgroundimageinthesamewayastheprevioustutorial.

    ChecktheUseastilesetoption.ATilePropertiespanelwillopen

    upwherethesizeofthetilescanbeset.Notehowtheindividualtiles

    aremarkedasthesizeoftheeditboxes.

    Whencreatinganimagetouseasatilesetmakesurethatallthe

    tiles are the same size and are evenly spaced across the whole

    image.

    Step2CreatearoomStep2CreatearoomStep2CreatearoomStep2Createaroom

    Create a new room.

    Select the tiles tab.Selectthebackground

    that was created as

    thetileset.Ontheleft

    side panelthe tile set

    will be displayed. On

    theright,agridwillbe

    displayed (defaulting

    to the whole tile set).

    Onebyoneselectthe

    tileintheleftwindowandclickonthegridontherighttosetthetile.

    Bychoosingatileontheleftandplacingitontherightafulltiledbackgroundcanbecreated.Thisallowscomplexandcustomisable

    roomstobecreatedtolooklikeaworldmaporamazeetc.

    GameMakerallowsmultipledifferenttilelayers.Eachlayercanthen

    bemanagedseparately.This allowsthe useof differentlayersfor

    differenttypesofobjects.Thiswouldforexampleallowthecreation

    ofamapinthebackgroundwithbuildingsetcontheforeground.

    FiddlingwithbackgroundsinGMLFiddlingwithbackgroundsinGMLFiddlingwithbackgroundsinGMLFiddlingwithbackgroundsinGML

    Backgroundsarenotthemostamazingthingstofiddlearoundwith.

    However,therearesomefunthingstodowithbackgrounds.Notall

    backgroundsneedtobecreatedup front.In fact,backgroundscan

    becreatedwhilethegameisrunningandGameMakerhasanumber

    ofmethodsavailabletomakethishappen.

    AddthefollowingcodetotheRoom'sCreationcodetocreate(at

    runtime)aredtobluegradientbackground.

    bg =background_create_gradient(room_width, room_height,

    c_navy, c_red, 0, true);

    background_index[0] = bg;

    room_set_background(room1, 0, true, false, bg, 0, 0,

    false, true, 0, 0, 1);

    background_create_gradient(w, h, col1, col2, kind,

    preload)

    Createsagradientfilledbackgroundofthegivensize.col1andcol2

    indicatethetwocolors.kindisanumberbetween0and5indicating

    thekindofgradient:0=horizontal1=vertical,2=rectangle,3=ellipse,

    4=doublehorizontal,5=doublevertical.

    background_create_from_screen(x, y, w, h, transparent,

    smooth, preload)

    Createsabackgroundbycopyingthegivenareafromthescreen.

    Thismakesitpossibletocreateanybackgroundyouwant.Drawthe

    imageonthescreenusingthedrawingfunctionsandnextcreatea

    backgroundfromit.

    CAIRNSWM

    DEV.MAG ISSUE 16

  • 8/14/2019 Dev.Mag - 16

    14/32

    14

    Beginners Guide to MakingBeginners Guide to MakingBeginners Guide to MakingBeginners Guide to Making

    Games - Part 2Games - Part 2Games - Part 2Games - Part 2

    DESIGN HELPING YOU ALONG

    astmonth,wehadalookatdifferentwaysGameMakermanagescollisions.Thismonth'sExtrawilllookatvariousmethods of doing collision detection in 2D in otherprogramminglanguages.ThebenefitofusingGameMakerisofcoursethatyoudontactuallyneedtounderstandallthe

    intricaciesoftheprocess.

    Whenlookingforcollisionsbetween2Dobjectstherearetwobasicmethodsofdoingso:1. BoundingBoxcollisiondetection2. PixelperfectcollisiondetectionAthirdalternatemethodisalsopossiblethrough3. Map-basedcol lisiondetection

    ManydevelopersfeelthatBoundingBoxesdonotgiveanaccurateenoughlevelofcollisiondetectionandinsistondoingmorefine-grainedcollisiondetection.Howeverinmostcasesthereisnorealvisibledifferencebetweenboundingboxandpixelperfectcollisiondetection.

    BoundingBoxCollisionDetectionBoundingBoxCollisionDetectionBoundingBoxCollisionDetectionBoundingBoxCollisionDetectionBounding box collisiondetection is done by defining simple

    geometricshapes around thespritesusedfor theobjectsandcheckingifthegeometricshapesoverlap.Typically,theeasiestshapestocheckforoverlaparerectangles.

    The overlap of two rectangles can also be defined as theintersectionbetweentherectangleorevenmoresimplyasbeingtrue if any corner of the second rectangle is inside the firstrectangle.Forexampleifeachrectangleisdefinedbyx1,y1asthetopleftcornerandx2,y2asthebottomrightcornerwecandefineacollisionanytimerectangletwosx1orx2isbetweenrectangleone'sx1andx2andthesamefortheycoordinates.

    Function BoundingBoxCollision(rect1, rect2 : rectangle)

    {

    If ((rect1.x1 < rect2.x1 and rect1.x2 > rect2.x1) or

    (rect1.x1 < rect2.x2 and rect1.x2 > rect2.x2)) and

    ((rect1.y1 < rect2.y1 and rect1.y2 > rect2.y1) or

    (rect1.y1 < rect2.y2 and rect1.y2 > rect2.y2)) then

    Result := true

    Else

    Result := false

    End if

    }

    Boundingboxesareusuallysmallerthanthefullsizeofthespritebeingusedasthepictureofthespritewilloftenbesurroundedbyatransparentborder.Inaddition,theboundingboxcouldalsobedefinedasacirclewithacertainradius.Ifthedistancebetweentwocirclesislessthantheircombinedradius,thereisacollision.

    Iftheshapeofaspriteisnotgenerallyrectangularorcircularitis

    alsopossibletodefinethecollisionareaofaspriteasacollectionofshapes and check for collision with anyof the bounding boxshapes.

    PixelPerfectCollisionDetectionPixelPerfectCollisionDetectionPixelPerfectCollisionDetectionPixelPerfectCollisionDetectionPixelperfectcollisiondetectioniswhereeachpixelofthetwospritesischeckedtoseeiftheyareinthesameplaceaseachother.Duetothenumberoftestsneededtoimplementpixelperfectcollisiondetection, it should onlybe usedwhenboundingboxcollisiondetectionisclearlynotaccurateenough.(suchaswhen

    checkingifastarfishandanoctopuscollide).

    Ofcourse,itisnotnecessarytocheckeverysinglepixelofthetwosprites,infactinmostcasesitwouldbesufficienttouseonlytheoutlineofthespritesoreveninmanycasesjustafewoftheoutlinepixels.

    Typically, pixel perfect collision detection is used alongwithboundingboxes.Ifaboundingboxcollisionisdetected,thenmoredetailedtestsaredonetocheckthatthereareinfactpixelsthatcollidewith eachother.Bywrappingthe pixelperfectcollisiondetectionwithinalesscomplextesttheperformanceimpactofthepixeltestingisminimized.

    Map-basedCollisionDetectionMap-basedCollisionDetectionMap-basedCollisionDetectionMap-basedCollisionDetectionMapbasedcollisiondetectionworksonthepresumptionthatfirstly

    youknowwhereinthegameworldeachitemisandsecondlythatonlyoneitemcanexistineachspaceoftheworld.Byusinganarraytorepresenttheworldandstoringalinktotheitemthatexistsineachspaceitsasimplechecktofindwhichobjectisinwhichspaceatanytime.Theuseofanarraytostorewhereeachandeveryitemofthegameis,makesitalotquickertocheckforacollision.

    Wheneveranobjectmoves,itisfirstremovedfromtheworldarray,itsnewlocationiscalculatedandthearrayischeckedtoseeifanotheritemisalreadyintherequiredlocation.Ifnoitemisfoundinthedestinationlocation,theitemisagainaddedtotheworldarray.Ifanitemisalreadyinthelocationtheitemwantstomovetoacollisionbetweentheobjectsiscreated.

    Map-basedcollisiondetectionoftenrequiresobjectstocheckforcollisionsinmorethanonelocationintheworldarrayduetothingssuchasitemsizeor just tomakethecollision checkingmorerealistic.Buildingsaretypicalexamplesofwhereanitemneedstoexistinmorethanonemaplocationsimultaneously.

    Map-basedcollisiondetectionisoftenverysuitedtoisometric-stylegames.

    ChoiceChoiceChoiceChoiceThechoiceofcollisiondetectionmethodisoftenbasedonthegamebeingdeveloped.Eachmethodofcollisiondetectionhasitsplace.Mostgameswillfindthatboundingboxesaresufficientfortheirneeds.

    CAIRNSWM

    L

    DEV.MAG ISSUE 16

  • 8/14/2019 Dev.Mag - 16

    15/32

    WellwellThisserieshascomea

    longwaynow.Itsalmostayear

    sinceitstarted.Aftertheprevious

    article,IhavenothadtimetoworkonRoach

    Toaster2duetoholidays,workandschool.

    AsIwritethisarticle,Ihaveoneweekofschool

    left.Afterthat,itsalljustexamsuntiltheendof

    theyear.Thisisalsomysenioryearinschool,

    somyworkwilltakepriority.

    Inpreviousexams, I haveworked ongames

    throughout,butasIsithere,Iamnotquitesure

    ifIwillhaveenoughtimetoreallypayattention

    toRoachToaster2duringtheexams.

    RT2hasbeenthroughthickandthin.Itstaking

    memuchlongerthanexpected.AsIhavemen-

    tionedpreviously,IthoughtIwouldbefinished

    withbetabyDecember2006.

    So,consideringthatIdontreallyknowwhatwill

    happenandRT2stumultuousdevving,Ihave

    decidedtoendthisseriesfornow.Youwillmost

    likelyseeapost-mortemonceitisdone,ora

    beta-feedbackarticle.

    So,IthoughtIdusethisarticletoonceagain

    explainwhatRoachToaster2anditsdevelop-ment.

    What the bug is Roach Toaster 2?

    RoachToaster 2 isthe sequel tothe award-

    winningRoachToaster1.Byaward-winning,I

    meanitwonaninternationalandlocalcompeti-

    tion.RoachToaster2alsowonaplaceinalo-

    calcompetitionasaWIP(WorkInProgress).

    RT2 places you inthecommandof teamsof

    roachtoastersasyoudefendBigCityfrombe-

    ingdestroyedbyaroachinfestation.

    Itcontainsmulti-levelgameplay.Youmustman-

    ageyourteamsonacity-widescaletoobliterate

    theroaches.Theoriginalandaddictivegame-

    playfromRT1isstillhereinanewguise.With

    updated gameplay and new enhancements,

    eachlevelwillbeauniquechallengethatcan

    betackledthewayyouseefit.

    What is the story behind RT2?

    Afteryoudefeatedyourneighbourhoodsroach-

    esinRT1,yourteamsetofftoCancunetoen-

    joyawell-deservedholiday.Wheredidtheyget

    themoney?Dontknow,butwhocares?

    Unbeknownst to them, theBroodmotherincu-

    batedinsidetheHoover.Shethencameback

    withavengeance.Sheislivid,andwantstode-

    stroyBigCityonceandforall.

    Youmustdefeather.

    ROACH TOASTER 2: PICKING OUT THE BUGS

    PART 7

    PROJECTS LEARNING HOW ITS DONE

    Wheredidyougetallthemoney?Istheresome-

    thinggreateratstake?World-domination?Find

    outwhenRT2getsreleased.

    RoachToaster2hasbeenanimmenselearn-

    ingcurveforme.Itsbeenmypuppyformore

    thanayearnow.Despiteeverythingelsethat

    occupiedme,Ialwayshadtimetofitinabout

    ofRT2devving.

    Icantwaittofinallycompletethefinished,pol-

    ishedproduct.

    Let me finish by saying that I already have

    RoachToaster3plannedout.Howitwillplay,

    orwhatitwillbe,willhavetowait.

    Keeptoasting!

    For more info onRoach Toaster 2:Big City,

    head on to http://www.shotbeakgames.za.net

    orthenewsitehttp://www.roachtoaster.com

    TROOJG

    DEV.MAG ISSUE 1615

    ( Wondering what were talking about over here? check out Dev.Mag Issue 10 for the beginning of this Project series! )

  • 8/14/2019 Dev.Mag - 16

    16/32

    minimalamountofeffort.Italsoprovidesmuch

    morecomplexdocumentationfeaturessuchas

    call graphs, dependency graphs, inheritance

    diagrams,andcollaborationdiagramsforthose

    developerswhowantto integratethesemore

    complexfeaturesintotheirprojectdocumenta-

    tion.AnothergreatthingaboutDoxygenisthatit

    hasnativesupportformostofthemorepopular

    languagessuchasC,C++,C#,Java,Python,

    andevenPHP(sorry,nonativeDelphisupport!).

    The documentation that is generated by

    Doxygencan beoutputintoHTML,PDF,and

    (my personal favourite) compressed HTML

    (CHM), amongst other formats. The ben-

    efits of having this documentation generated

    for you automatically should be fairly obvi-

    ousasitprovidestheabilitytohaveyouren-tire code base documented inwhatever form

    suits you (ie. PDF for reading or printing, or

    HTML/CHM for PC-based hyperlink naviga-

    tion and searching), with very little overhead

    onthepartofthepersonwritingthecomments.

    This documentation can then become a very

    important tool for your team as it will allow

    programmers toeasily search forand seein-

    formation (in an easily accessible and read-

    ableformat)onany codethattheymayneed

    todealwith.Thisfunctionalitybecomesextra

    Itisafactofprogramminglifethatprogram-

    merswillmakemistakesintheircode.These

    mistakesorerrorsarenotusuallydownto

    bad programming or any lack of talent, but

    merelyduetothesheerscopethatmostpro-

    gramsarecomprisedof.Whenanyoneprogram-

    merischurningouthundredsuponhundredsof

    linesofcodeaday,itsonlyamatteroftime

    beforesomeofthoselineswillcontainerrors.

    Asdiscussedinthesecondarticleinthisseries,

    propercommentingofcodeisaveryimportant

    partofgamedevelopment.Buildinguponthis

    idea,peoplehavegoneaboutdevelopingsys-

    temsthatallowfordeveloperstoeasilycreate

    fully featured documentationof theircodeby

    merelyalteringtheircommentstoincludemark-

    erswhichthenallowthecommentsthemselvestobeconvertedintodocumentation.Onesuch

    systemthatallowsthis,andthatIfullyadvocate

    the use of, is Doxygen (www.doxygen.org).

    Doxygenisincrediblyusefulbecauseitisvery

    simple and straightforward touse inits most

    basicform,andtheresultsthatyoucanobtain

    fromitareterrificforanyonemanagingthecode

    baseofa project.It allows very robust docu-

    mentation tobe generated for all ofthemost

    important areas of your code such as files,

    functions,variables,anddatastructureswitha

    helpfuliftheyaredealingwithsectionsofcode

    written byotherprogrammers, andespecially

    soiftheoriginalwriterofthecodeisnolonger

    onthe teamorisnt available toask for help

    in understanding the code that they wrote.

    ThebasicideabehindDoxygenisthatitlooks

    forandparsesvarioustokenkeywordsthatare

    placedinsideof speciallyformattedcomment-

    ingblocksthatworkinsideofthelanguageyou

    arewritingyourcodein.Therearefourkinds

    ofcommentingblockssupportedbyDoxygen,

    and any Doxygen keyword that is found in-

    side ofthese comment blockswillbe parsed

    andusedfordocumentationgeneration,while

    any keywords found inside of the standard

    languagecommenting blocks willbe ignored.

    Supported Commenting Block Formats:

    /** addcommentshere... */

    /*! addcommentshere... */

    /// addcommentshere...

    //! addcommentshere...

    Onethingthatyoumustnoteisthatbydefault,

    Doxygen assumes that the code being com-

    mentedonislocatedafterthecommentblock.

    InordertotellDoxygenthatthecodeisactually

    located before the comment block, you must

    CODING ETIQUETTE:

    DOXYGEN

    TECH ELECTRONIC PLAYGROUND

    DEV.MAG ISSUE 1616

  • 8/14/2019 Dev.Mag - 16

    17/32

    \param--Usedtomarkeachparameterofa

    function

    \return--Usedtomarkthereturnvalueofa

    function

    Doxygenalsoprovidesvariousmiscellaneous

    keywordsthatcanbeusedatanytimeinorder

    tomarkvariouspointsofinterestinthecode.

    These keywords are very helpful in creating

    morerobust documenation,especiallyfor the

    purpose of adding specific types of notes to

    complement themoretechnicalnatureof the

    documentationrelatedtothecodeitself.

    Misc Doxygen Keywords:

    \ref--Createsahyperlinkreferencetoaspe-

    cifickeyword

    add a extra

  • 8/14/2019 Dev.Mag - 16

    18/32

    TECH ELECTRONIC PLAYGROUND

    DEV.MAG ISSUE 1618

    Simple Example of Doxygen Commenting

    /**

    \file vector.cpp

    \author Luke Lamothe

    \date Saturday, 18 August, 2007

    \version 1.0\brief File containing vector math utilities

    */

    /**

    \struct tVec2D

    \brief Structure that defines a 2-dimensional vector

    \note There is a \ref tVec3D structure for use if you need to use 3-dimensional

    vectors

    */

    typedef struct

    {

    float x; ///< The x component of the 2D vector

    float y; ///< The y component of the 2D vector

    }tVec2D;

    /**

    \struct tVec3D

    \brief Structure that defines a 3-dimensional vector

    \note There is a \ref tVec2D structure for use if you need to use 2-dimensional

    vectors

    */

    typedef struct

    {

    float x; ///< The x component of the 3D vector

    float y; ///< The y component of the 3D vector

    float z; ///< The z component of the 3D vector

    }tVec3D;

    /**

    \param psVecA The first vector to use in the dot product calculation

    \param psVecB The second vector to use in the dot product calculation

    \return float The result of the dot product between the two vectors

    \brief Utility function to calculate the dot product between two 2-dimensional

    vectors

    */

    float Vec2DDot(tVec2D *psVecA, tVec2D *psVecB)

    {

    float fResult;

    //calculate the dot product of the two vectors and return it

    fResult = (psVecA->x * psVecB->x) + (psVecA->y * psVecB->y);

    return fResult;

    }

    /**

    \param psVecA The first vector to use in the dot product calculation

    \param psVecB The second vector to use in the dot product calculation

    \return float The result of the dot product between the two vectors

    \brief Utility function to calculate the dot product between two 3-dimensional

    vectors

    */

    float Vec3DDot(tVec3D *psVecA, tVec3D *psVecB)

    {

    float fResult;

    //calculate the dot product of the two vectors and return it

    fResult = (psVecA->x * psVecB->x) + (psVecA->y * psVecB->y) + (psVecA->z * ps-VecB->z);

    return fResult;

    }

  • 8/14/2019 Dev.Mag - 16

    19/32

    Welcome back, fellow coders! Pre-

    pare yourselves for the final,

    bumper episode of the Trig Tril-

    ogy, where I cover a whole lot of awesome

    trig techniques for your game-making plea-

    sure.Wevegot a lot to cover, so lets jump

    right in. Its time for my first trick! Now, as

    youcansee,thereisnothingupmysleeve...

    Relative Angling 101

    Nomatter what kind ofgameyoure working

    on, moreoftenthannot youll need tocalcu-

    late the anglebetween two objects for some

    reason.Itstimetolookatachunkofcodethat

    canmake your life very easy in this regard:

    Whatthis codedoes is firstcalculate thedif-

    ference in x and y coordinates between

    the two objects, then divide as per the arc-

    tan ratio. X1 and Y1 represent the coordi-

    natesof the object you want tocalculate the

    angle from. X2 and Y2 are, obviously, the

    coordinates of the object whose angle youwant to measure relative to the first object.

    Weperformthesubtractionbecausealltrigcal-

    culationsassumethatouroriginisatpoint(0,0)

    ontheCartesianplane.As aresult,weneed

    to use relativemeasures, essentially making

    point(X1,Y1) our origin .If thisall seemsre-

    allyconfusing toyou,worrynot.Ive summed

    itupforyouinthesetwodiagrams.Asyoucan

    see,theresamassivedifferencebetweenthe

    twodependingonwhetheryousubtractornot!

    Onefinalthingtonoteisthatthisalgorithmwill

    giveyoutheangleinradians,aswasdiscussed

    lastmonth.Remember toconvert theanswer

    todegrees if thatswhatyour game requires!

    Andthere you haveit: all you needto know

    about calculating the relative angle between

    twoobjects!Thatwasntsocomplicated,wasit?

    Goin Round in Circles

    Oneof themostprevalentproblemsthatfirst-

    time coders have is making objects follow

    a circular path. There could be any number

    ofusesforthishavingatargetingreticleor-

    bit around your game character, or perhaps

    GAME CODING WITH TRIGONOMETRY

    PART 3

    TECH WHEN MATHS GETS USEFUL

    DEV.MAG ISSUE 1619

    Figure 1a: Angle calculated without subtraction

    Figure 1b: Angle calculated with subtraction

    GAME MAKER TIP:

    There are several functions you can use

    in GM to calculate your angles. You can

    use the same algorithm as above or use

    the slightly altered arctan2(y,x) function,

    meaning you dont have to divide first. By

    far the easiest, however, is to use the point_

    direction(x1,y1,x2,y2) function, which

    also converts the angle to degrees for you

    as a little added extra! The choice is yours.

    ( What manner of trickery is this? To delve into the mysteries of trigonometry properly, maybe Dev.Mag Issue 14 would be a better starting point! )

  • 8/14/2019 Dev.Mag - 16

    20/32

    within a set distance of that centre.We cando that using the following two algorithms:

    centreX and centreY refer to the coordi-

    nates of theposition/objectwewantto rotate

    around.Itsimportantthatwehavethese,oth-

    erwise(aswithouranglecalculations)theob-

    jectis going torotatearoundthe screen/level

    origin (0,0) instead of the centre we want.

    Radiusis obviously the radius ofour circle,

    andAngleis therelativeanglebetween the

    centre and the orbiting object. Changing the

    Anglewillrotatetheobjectaroundthecentre.

    IncreasingordecreasingtheRadiuswillmove

    theobjectfurtherfromorclosertothecentre.

    Changing the centreX and centreY coordi-

    nateswill,ofcourse,movethecentreandthe

    spinningobjectwithit.Thatsallthereistoit!

    Afinalnote. Ifyoureimplementingaspinning

    object where you keep increasing the angle

    tocreate rotation,itswiseto resettheAngle

    to0onceit exceedsthemeasureforonefull

    rotation (either 360 degrees or 2 radians).

    Although it shouldnt make much difference

    to your calculations, it certainly keeps things

    cleaner, and ensures that you know exactly

    what rangeof numbers your code isworking

    with. This can make debugging a lot easier.

    a spinning-blade-on-a-chain trap for haplessplayers to wander into. Either way, if youve

    ever wanted to have one thing spinning

    aroundanother,thisisexactlywhatyouneed!

    Fortunately,circularpositioningisnotatall diffi-

    culttodoforusmightytrig-wielders.Asalways,

    lets look at exactly what were trying to ac-

    complishhereintheformofahandydiagram.

    Figure2depictswhatiscommonlyreferredto

    asacircle.Thisshapeisnotablebecauseit

    hasaconstantradius.Thatmeansthatregard-

    less ofwhere you are on the circumference,

    youllbeexactlythesamedistanceawayfrom

    the centre. This gives us an important clue.

    Figure 3 depicts our situation more clearly.

    What we really want to do in code terms is

    to calculate the x and y coordinates of an

    object while ensuring that, regardless of

    its angle to the centre, it always remains

    Whats this? Theres more?

    Yes! Sometimes you may want an object

    to move in an elliptical fashion, especially if

    youre creatinganisometric gamewhere the

    perspective means that you need ellipses

    to represent circles and circular movement.

    Fearnot, goodpeople!By alteringthe radius

    values in the circular positioning algorithms,

    wecanmakeobjects followanellipticalpath.

    The trickistorealizethat theradiusinanel-

    lipseisnotconstanttheradiusforitsvertical

    proportions isdifferent from the radius for its

    horizontal proportions. For instance, the first

    ellipse inFigure 4 has a verticalradius of2,

    whichis halfof its horizontalradiusof4.We

    needtoaltertheradiusvaluesinouralgorithms

    toreflectthisdistortedrelationship.For thefirst

    ellipse, our expressions would look like this:

    For the second ellipse, our ex-

    pressions would look like this:

    Im sure that the relationships between the

    radii that you specify and the ellipses pro-

    portions are becoming crystal clear to you.

    Other than that, the code works in exact-

    ly the same way as with a regular circle.

    TECH WHEN MATHS GETS USEFUL

    DEV.MAG ISSUE 1620

    Figure 2: The humble circle

    Figure 3: Shazam! Trigd!

    GAME MAKER TIP:

    Game Maker makes things easy for you

    again by providing the lengthdir_x(len,dir)

    and lengthdir_y(len,dir) functions. These

    take your circle/ellipse radius (len) and di-

    rection (dir) and calculate the correct x and

    y values for you just like we did above. No

    mess, no fuss, and you can use them any

    time you need to resolve an angled line to

    x and y coordinates, not just with circles.

    Just remember to add the centreX andcentreY coordinates to the final answers!

    Figure 4: Ellipses gone wild

  • 8/14/2019 Dev.Mag - 16

    21/32

    Here are the algorithms you would use:

    Thesealgorithmsareactuallyverysimilartothe

    onesweuseforcircularpositioning.Asbefore,

    Radius will determine themaximum distance

    fromthecentreourobjectcanmove,andAngle

    willdetermineatwhatpointinthewaveourobject

    is.However,anessentialthingtonoteisthatwe

    nolongerhavetouseSinforverticaldisplace-

    mentandCosforhorizontaldisplacement,be-

    causewereonlydisplacingalongoneaxisnow.

    Lets back up abit. If we dont have to care

    about using Sin or Cos, whats with the big

    OR in there? Well, it depends on how you

    wantyourwavetobehave.OscillationusingSin

    orCosresultsinslightlydifferentwavepatterns:

    TheSingraphbeginsitsmotionatadisplace-

    mentof0.ThismeansthatusingSinasyour

    trigfunctionwillresultin yourobjectsmotion

    startingat the centre pointyou specify.Like-

    wise,theCos graphbegins its motion atthe

    maximum point, so usingCos as your func-

    tion for oscillation will result in your object

    starting at the maximum radius youve set.

    Wave Motion - Cowabunga!

    Forourfinal trick,weregoingto coveravery

    useful functionof trig creatingwavemotion

    (oroscillation),for gameobjects.Everplayed

    a scrolling shooter where the enemy ships

    move in a wavy pattern across the screen,

    or stood amazed at the helical particle trail

    leftby aweapon?Well,hereshowitsdone!

    All the time thatwevebeendoing trig,youll

    havenoticedthatwevebeenusing twoalgo-

    rithmsonetocalculatetheX(horizontal)co-

    ordinate,and another tocalculatethe Y (ver-

    tical).Asyoulearnedwhilewewerecovering

    circlesandellipses,wecanusethetwotocre-

    aterotationaroundan object.Alteringthe ra-

    diusvaluesforeitherequationletsuswarpthe

    circles proportions, creating ellipticalmotion.

    Have you asked yourself what would hap-

    pen if we left one of the calculations out?

    WhatifweneglectedtocalculatetheXvalue?

    What if we left the Y value out in the cold?

    Well, wed still get movement, but it would

    be exclusively on the axis for whichwe cal-

    culated it.Thats themagicbehindwavemo-

    tion. To demonstrate, yet another diagram:

    Thearrows in figure 5 illustratethe rotational

    motion.You should notice thataswe reduce

    the horizontal components radius to zero,

    therotationbecomeslesscircularandmore

    wavy,wobblingbetweentheradiuspointsand

    thecentre.ThepointthatImtryingtoconveyis

    that,usedalone,atrigfunctioncanbeusedto

    introduceoscillationto anobjectsmovement.

    Sohowdoesthistranslatetoourcode?Well,forexample,willresultinoscillationalongthexaxis

    startingatthecentre,whilewillresultinoscilla-

    tionalongtheyaxisstartingattheradius.Clear?

    Onefinal thing. Youmayalready havegath-

    ered this,butit ispossible toalterthespeed

    of oscillation by multiplying or dividing your

    Angle variable. You can use this to easily

    change how quickly the object moves along

    the wave. Multiplication will make your ob-

    ject oscillate faster, whiledivisionwill slow it

    down.Thiscan resultin quitea few interest-

    ingspecialeffectsorchallengesinyourgame.

    Its Over!

    This marks the end of this little introduction

    to game programming with trigonometry. As

    youve seenover thepast three installments,

    trig has anincredibly wide rangeofeffective

    uses when programming games. Hopefully

    youve not only grasped the techniques cov-

    ered here, but youve also gained the abil-

    ity to apply trig to whatever problems you

    may come across when coding inthe future.

    Properly applied, trig is a highly flexible, in-

    credibly powerful tool in your programming

    arsenal,especially ifyou plan oncreating3D

    gameslateron.Goodluck,andhappycoding!

    GAZZA_N

    TECH WHEN MATHS GETS USEFUL

    DEV.MAG ISSUE 1621

    Figure 5: Thinner and thinner

    Figure 6: Sin and Cos graphs

  • 8/14/2019 Dev.Mag - 16

    22/32

    Optimisingdata,optimisingcode ...it

    allsoundslikesuchawaste.Thisar-

    ticleoutlinessomesimpleandeffec-

    tivestrategiesonspottingandfixingbadcode

    concepts,whichslowaprogramdowninmore

    waysthanone.Wewilllookatthesestrategies

    andcoversomenewideaswhichareallrelativeto creating games, especially when stepping

    out into coding your own engine orevenjust

    coding.Regardless ofthe applicationorcode

    usage,optimisationisimportantyetoverlooked.

    Writingcutting-edgegamesisonallofourto-

    dolist,butarewereallyTRYINGtogetthere,

    orareweinafrenzytolearnasmuchaswe

    can as soon aswe can, skipping vital steps

    which get us to a better rounded end prod-

    uct? Im making this statement as it is one

    which resides in my mind whenever i step

    into any project. Rather take the time and

    makeamasterpiecethanskipafewstepsand

    end upwith anotherproject toreviseand fix.

    Lets see what we have here...

    Optimisation: Modifying a system to improve

    its efficiency whether its a single loop, a

    single program, or even the entire Internet.

    Profiling:Settinguppointsincodethatcountthe

    numberofclockcyclesand/ortimeittakesto

    executecertainblocksofcode.Thiseffectively

    singlesouttheslowcodeinyourprogram/sys-

    temandallowsyoutoreviseandimprovethe

    system.

    Code optimisation may be something out of

    yourreach,orsoyouthought.Wespendtime

    makinggamesandihaverunintocaseswhere

    iendupwithanon-viablesolutionwhichends

    upinthebin orintherevisefolder,whena

    simplelookatoptimisingDURINGaprojecthas

    savedmemorethanadozenwastedprojects.

    Optimisation must be approached with cau-

    tion.TonyHoarefirst said,andDonaldKnuth

    famously repeated, Premature optimizationis the root ofall evil. Itis important tohave

    soundalgorithmsandaworkingprototypefirst.

    Systemdesignandtheinternalarchitectureof

    thecodeisthelargestweightonperformanceof

    asystem.Thechoicesinthisstageaffecteffi-

    ciencymorethananyotherareaduringdesign.

    This was something i read recently which

    has quite the obvious pointed out to

    you to look carefully at optimisation:

    Premature optimization is a phrase used

    to describe a situation where a programmer

    lets performance considerations affect the

    design ofa pieceof code.This can result in

    adesignthat isnotascleanasitcouldhave

    been or code that is incorrect, because the

    code is complicated by the optimization and

    the programmer is distracted by optimizing.

    Sometimes, early optimisation over-

    throws benefits and can destroy the proj-

    ect core with sloppy or dangerous code.

    Optimisation is a subject many developers

    overlook,whichisafatalmistakeintheindus-

    try,especiallyonthegamedevelopmentside.

    Peoplethinkduetothefactthattechnologyis

    dailybecomingmoreandmorepowerful,code

    andotheroptimisationisnotreallysomething

    thatisnecessaryinprojects,buttheyforgetthe

    mainpointwhich theythemselveswould look

    atwhenevaluatingaproductorsolution:which

    one isfaster?If the nextcreatorof the same

    solution was marketing it as faster, whose

    solution would you pick up off the shelf?

    Optimisationdoesnotcomewithoutcosts,as

    it isusuallymoredifficulttomaintainan opti-mised program than an unoptimised one, as

    manyoptimisationssacrificemaintainabilityfor

    speed,orresources.Whenyouoptimiseeach

    pieceofcode,youneedtobeawareofafew

    things of importance.After I haveoptimised

    a piece of code, I must go back and check

    the correctness, where sometimes the code

    will cause incorrect output. Also, you should

    measuretheperformanceandcompareitwith

    thatbefore theoptimisation.Often enough, it

    will be slower due to compiler optimisations

    which you cancelled out, or other less obvi-

    ouschangesinthecompilationandexecution

    stages.OnceIhavesorteditoutandthereis

    anincrease,Imaychecktheperformanceac-

    cording to thegoal setout, andstop optimis-

    ingso I dont changeanythingunnecessarily.

    Theres a few simple tactics tooptimise your

    codeand not have torun throughahundred

    thousandlinesofcodesearchingforbottlenecks.

    Takethesestepspracticallyinyourcurrent/next

    projectandnoticehowlittletimeisspentonop-

    timisingsmall areas of codepost-completion.

    Optimisationhappensduringcodingaswellas

    design. Ifyou are inclinedtowardsspeed, it

    becomesamajorpartofthecodingstage.Be-

    low,youwillreadthestrategiesIemploywhen

    workingwitharelativelyslowactingprogram,

    andtheseapplytoallcodestrategiesandmeth-

    odsaswellasmostapplicationsofoptimisation

    not only games. For example, I use these

    commontechniqueswhenIworkonmobileap-

    FOR A SPEED SURPRISE, GO

    OPTIMISE!

    TECH OPTIMUS PRIME?

    DEV.MAG ISSUE 1622

  • 8/14/2019 Dev.Mag - 16

    23/32

    improve your code speed when employedaccurately and in context with the project.

    Loop hoisting

    Ifoundmyselfdoingthisalotinmycode,and

    afterlearningabouttheinefficiency,itbecame

    a habit toautomatically change it if I saw it,

    or straight-up code it as I go. The idea be-

    hind these loops is illustratedeasier through

    code,andwithtimeandfocusyoucouldeas-

    ilyusethefollowingtopreventuselessredun-

    dancy. Below is anexample in pseudo-code.

    for counter = 1 to 10

    if (thisIsTrue) then

    doThis(counter)

    plicationsdue tothe limitedprocessorpower,whichgreatlyspeeduptimeonthedevice,and

    onwebdevelopmentprojectswhereeffectively

    managing code and resources means less

    server-side overhead...less cost, less hassle.

    Code efficiency

    Creatingcodethat is fastAND portableAND

    functional is a considerable task and takes

    practice to be able to catch the dodgy code

    in its tracks and fix the bottlenecks. Code

    profilers are your friend run them and fil-

    tertheresultsforanythingthatisslowerthan

    itseemsit should be, thengo toyour source

    andoptimise it.Thisis where the techniques

    and ideas behind optimisation can greatly

    else doThat

    end if

    Lets analyse this code ourselves. The loop

    runstentimescheckingacertainvalue.You

    maynoticethatthecodeisinefficientbecause

    EVERYloopithastobreakoffintoconditional

    statements,whichisusingupCPUpower,as

    wellastheCPUtryingtoguesslogicaloutput

    whichifiswrong(+-50%ofthetime)itneeds

    tobacktracktocarryonwiththerightinstruc-

    tionandreloadit.Thissimpleproblemlooksnot

    sointense,untilitisbeingusedtopollortest

    everyframeofagame,andaimingforhigher

    framerateswillresultinevenmorework.Lets

    lookatthenewcode,whichusesloophoisting

    asaneffectivemeansto releasebottlenecks.

    TECH OPTIMUS PRIME?

    DEV.MAG ISSUE 1623

  • 8/14/2019 Dev.Mag - 16

    24/32

    timespenton thearray.Thesesituationsarecommonbutoftenunnoticedanddiscardedbe-

    causemorearrayspacemaybeneeded,which

    againthesedaysseemsmoreorlessirrelevant.

    Profiling and disassembling

    Runningprofilingprogramson yourcode can

    give you a large amount of feedback. This

    will help you pinpointvariousissues incode,

    and effectively eliminate the problem areas.

    Findingtheareaof problemis one thing, op-

    timising it is another. Another strategy I use

    is to disassemble the compiled code, which

    gives you the assembler representation of

    yourcode.Ifyouknoworlearnassembler,it

    helps youeasily seewasted instructions and

    findbetterways of removingredundant code.

    Data management

    Please, believe me when I say this: data is

    themostoftenoverlookedbottleneck.Itslows

    down almost every part of an application if

    implementedbadly.Lookingatrevisingadata

    moduleofsortscouldbeaheftytask,butweigh

    uphowmuchitwouldbeworthitifyourdata

    waswell-placed,alwaysreadytobeused,and

    alwaysefficientlynothoggingupmemory.The

    projectsstylesalwayshavesomerestrictionof

    sorts, andsomeconceptofsorts, andalmost

    alwaysusesadatasetupthatisbadlyimple-

    mented due to the itsdata, it just needs to

    betherewheni needit attitude.This,above

    all else, can speed an application up by a

    MASSIVEamount. Loadwhats needed, and

    removeitwhenitsnot.Theresnopointinkeep-

    ing thedatainmemory iftheuserdecidesto

    choose Quit tomenu. Theyreprobablynot

    goingbackintothatsectionofdataandmemory

    rightaway,sounloaditandloadwhatsneeded

    next,insteadofhavingtounloaditagainwhilehe

    isexpectingtoloadanewlevelordifferentsave

    game.Datamanagementandeffectivelyusing

    thedatawillbenefityouinanytypeofprogram.

    if (thisIsTrue) then

    for counter = 1 to 10

    doThis(counter)

    else doThat

    end if

    ThisisQUITEalargeimprovementitnowhan-

    dlestheifstatementonceandonceonly,not

    tentimeseveryframe.Whenitcomestocon-

    trolling larger structures,nested loops canbe

    hoistedtoavoidexcessiveuseoftheprocessor.

    Data types and sizes

    Backintheday,usingsmallerdatatypeswas

    betterbecauseofcertainimpactson thesys-

    tem and its processor. These days, we see

    thatusingsmallervariablesisoftennotanis-

    sueforthesizeofthematter,butmoreforthe

    speed. If youre using smaller sizedintegers,

    useONLYthatsizeinthatpieceofcodeorap-

    plication. For example, using a small integer

    value and a long or larger integer value re-

    quires a conversionto differentsizes EVERY

    time that code is used or accessed,wasting

    timeawayinthecyclesoftheprocessor.This

    has a largeimpact ontheprocessor inmore

    intenseapplications,suchasthosewithimage

    processing,videoencoding,largearrayusage

    and many areas in gamemap management.

    Thesetechniquesareespeciallyusefulwhenit

    mightbethatextraun-lagstrategyyouneed.

    Array sizes

    Remember that working inside your proces-

    sor is many instructions and commands all

    usuallywhichworka lotmoreeffectivelywith

    powersoftwo.Abasicunderstandingofwhat

    happensinsidetheprocessorwillshowthatit

    hastomakeextracalculationsfora3x4grid,

    becauseitneedstousemultiplicationandother

    meanstofindtheindexinthearray,whereas

    asimple4x4gridwouldusebinaryshiftswhich

    arealotfasterandmoreeffective,reducingthe

    Function sizes

    Ifyourfunctioncodeiscrossingboundariesas

    innotdoingitsSPECIFICfunctionitisbeing

    wastefullyimplemented.Ifyoucodeyourfunc-

    tionseffectively,theprofilingwillbeahundred

    timeseasier.Thisisbecauseithastofindthe

    bottlenecksinthecode,andifyouhavetwenty

    functions in one,the profiler (usuallyworking

    onaper-functionprofile)willtellyouitsslower.

    Parallel execution

    AmdahlsLawstates,Parallelexecutionisthe

    mostcommontechniqueforspeedinguplarge

    applications,butitaloneisnotsufficientforall

    cases.Inparticular,AmdahlsLawclaimsthat

    theinherentlysequentialportionofaprogramis

    thelimitingfactorofspeedimprovements.

    Theseareverybasicandnotin-depth,butwill

    get you started before you hit your favourite

    search engine and find more information on

    taking control of code and effectively speed-

    ing up a system. Game development is an

    important optimisation concern as the faster

    aframecanbeprocessed,themorethatcan

    bedoneinoneframe.Forexample,thishelps

    when speeding up the code for drawing the

    scenewill allowenough ofa speedincrease

    tointroduceanotherinterestingeffectorphys-

    icschangeinagameengine.Thisarticleisfar

    fromcomplete,butissufficientinmyviewsto

    takeyoutothelevelofunderstandingthatone

    needstowatchoutforsomecommonpitfallsin

    codepractices.Takethiswithapinchofsalt,

    andignorewhatyoudontneedorlike!Enjoy!

    FUZZYSPOON

    TECH OPTIMUS PRIME?

    DEV.MAG ISSUE 1624

  • 8/14/2019 Dev.Mag - 16

    25/32

    Astheendof2000approachedus,we

    werealreadywellunderwaywithour

    Xbox development of Chase. From

    whatIremember,ittookuslessthanaweek

    togetalmostallofthegameasitwasported

    fromPCtoXbox,whichisaterrifictestament

    to not only how comparable the basics of

    Xboxdevelopment were to PC development,

    butalsohowrobustandeasytousetheXbox

    SDKwas,aswellas how good theirsupport

    system was through not only their develop-

    mentNewsgroups, butalso through theirpri-

    vatetechniciansupport.Oncewehadfinished

    getting the game up and running for Xbox,

    webegan toperformvariousmajoroverhauls

    onit inorder totakeadvantage ofthesupe-

    riorhardwarethatwenowhadatourdisposal.

    We startedby completely throwingoutallart

    assetsthatwehadpreviouslycreatedandwent

    aboutmakingallnewworlds,props,andvehi-

    cleswithpolycountsthatapproachedbetween

    5and10timeswhatwehadpreviouslybeenus-

    ingforthePCversion.Wealsonowhadaccess

    toguaranteedshadertechnology(nomorewor-

    ryingaboutend-userspecs!),sowewereable

    tostartincorporatingsomespecialeffectssuch

    asbumpmapping,lightmapping,realtimecube-mapreflections,realtimeshadowsforobjects,

    andobjectself-shadowing.Whilethisgraphical

    overhaulwasbeingdone,additionalchangesto

    thegameitselfwerebeingincorporated.Dave

    added motorcyclephysics, completewith the

    abilitytodowheelies,tothegamewhichnow

    gaveusfourtypesofvehiclesthatwecoulduse

    (standard fourwheel vehicles, three wheeled

    vehicles, multi-body articulated vehicles, and

    motorcycles). Pedestrian and traffic AI were

    alsooverhauledinordertomakethembehave

    smarter as well as more realistically, and a

    dynamic replay systemwas addedwhich al-

    lowedlevelstoberecordedandplayedback.

    Unfortunately,allofthisexcitingstuffwasoffset

    bymoreunsettlingeventswithinourteam,the

    firstofwhichbeingMattswifemovingbackto

    theUSinearly2001.Shewastiredofnotbeing

    abletowork,duetothelackofaworkpermit,

    and she alsowas startingto miss her family

    backhome.Thisobviouslyputalotofstrainon

    Mattashereallywantedtostayandfinishthe

    developmentofChase,butintheend,hedid

    theonlythingthathecoulddoandalsoreturned

    totheUSsometimearoundAugustofthesame

    year.DaveandStacihadababyboyearlyin

    theyear,whichIthinkmadeStacimissherfam-

    ilyevenmore,andasaresult,shealsomoved

    backtotheUSwhenwewentoverseasforE3

    THE HISTORY OF I-IMAGINE

    Part 7: Enter the publisher

    HISTORY WHERE IT ALL BEGAN

    inMay.Asexpected,Davealsoleftusinorder

    tobewithhiswifeandchildatthestartofJuly,

    oncehehadcomebacktoSouthAfricanafter

    E3inordertotieupsomelooseends.Luckily,

    wewereabletofindtwoveryablereplacement

    programmers forthem inChris andMattwho

    alongwithathirdprogrammer,Andrew,helped

    us to complete the development of Chase.

    However,beforeDaveandMattwouldleaveus

    tobereplacedbyChris,Matt,andAndrew,we

    hadthesmallmatterofE32001topreparefor.

    The lead up to E3 was was pretty exciting

    forus aswewereaskedbyMicrosofttosub-

    mit somevideo footageof Chaseforthemto

    incorporate into their E3 promo video which

    would be running on the big screen in the

    middleoftheirstand.FromwhatIcanremem-

    DEV.MAG ISSUE 1625

    ( Who? What? Where? If youre lost concerning I-Imagine, check out Dev.Mag Issue 10 for the start of this article series! )

  • 8/14/2019 Dev.Mag - 16

    26/32

    ber,I thinkthat theyendedupusingthreeor

    fourclipsof thevideo footage,eachonerun-

    ningforbetweenthreeandfivesecondsorso.

    Itwas definitely quitean awesome feeling to

    bestandingintheMicrosoftboothatE3whilewatching footageofyour gameuponthe big

    screen!ButbeforeweevengottoLosAngeles

    forE3,Ihadtoendurethecraziestcrunchof

    mylife.Forthemostpart,thedeadlineleading

    uptoE3wasrelativelynormal.Wehadsome

    pretty goodstuff tobringwithus alreadydue

    tothepre-E3deadlinethatwehadimposedon

    ourselvesin ordertogetthevideofootage to

    Microsoft,buttherewasoneimportantfeature

    thatweneededtohaveworkingperfectlybefore

    goingtoE3,andthatwasourreplaysystem.

    Thesystemitselfwasbasicallyalistofinputs

    from the player, whichwhen played back at

    theirappropriatetime,wouldrecreateaprevi-

    ousgameplayexperienceperfectly.However,

    this means that the entire engine needs to

    behave ina deterministicmanner, and ifany

    codeis added thatgoes against thisphiloso-

    phy,itwillcausethereplaysystemtocometoa

    grindinghalt.Unfortunately,thisiswhatbegan

    tohappentousthedaybeforewewere due

    tofly toE3. Idont rememberthespecificsof

    whatcausedthesystemtobreak,butIthinkit

    wasanadditiontotheAIcodewhichwasus-

    ingtherandomfunctioninwaysthatitwasnt

    supposedto. I dohoweverrememberstaying

    awake at my desk for 21 hours while Dave

    worked his butt off trying to fix the problem.

    Whatmade this crunchevenmore important

    (andthereforestressful...)isthatDanhadleft

    forE3adayearlierthanuswithoutsomuchas

    asingleworkingcopyofthegame,soitwasup

    tousinordertogeteverythinginorderbefore

    welefttojoinhiminLA.Luckily,Davemanaged

    tosortouttheissueataround7amthenextday

    andweboardedtheplanetoLAwithawellput

    togetherdemoofourgame.Lookingback,Ican

    alwaysmanagetolaughaboutthesituation,but

    atthetime,itwasinsanelystressfulandscary

    forallofus.Unfortunately,yetagainallofthe

    hard work that we put into the game before

    headingtoE3didntpayoffforusaswewere

    still unable to attract a publisher for Chase,

    With yet another trade show gone past us

    wherewewereunabletosignadealforChase,

    wedecidedthatanotheroverhaulwasneeded

    forthegameinordertogeteverythingtothe

    level where we would be able to have pub-

    lishers interestedin signingus.We yetagainthrewoutallofourworlds(Ibelievethatthere

    were only threeat this time)andwent about

    redesigning them to be even better look-

    ing thanwe had indone uptonow.Wealso

    decided that we needed to make the game

    more than just A-to-B driving, and ended up

    coming up with a challenging yet rewarding

    systemforthegameplaytobebasedaround.

    Attheendoftheday,ourdesirewastomake

    thegamefuntoplaywhilelimitingthefrustration

    factorasmuchaspossible.Wetooktohearta

    lotofwhatwelearnedfromNoahFalsteinstime

    withusanddecidedtofocusonrewardingthe

    playerwhileatthesametimeremovingasmany

    formsofpunishmentaspossible.Weachieved

    thisbymakingeachlevelinthegamehavea

    certainnumberofobjectivestocomplete,where

    eachobjectivewasworthacertainnumberof

    pointsintheplayerscareer.Onceanobjective

    wascompleted ina particularmovie scene, it

    wouldstaycompletedandtheplayerwouldre-

    HISTORY WHERE IT ALL BEGAN

    ceivethepointsforit.Aplayercouldthenreplay

    the level, doing another take for the movie

    sceneandfocusoncompletingobjectivesthat

    hewasntabletoduringthepreviousattempt.

    Thissystemallowedustomakeitthatmostlev-

    elsactuallyrequiredthe player todomultiple

    takesiftheywishedtocompletealloftheobjec-

    tives,asitjustwasntpossibleforthemtocom-

    pleteeachandeveryobjectiveinasingletake.

    Thepointsthattheplayerreceivedwerenec-

    essaryinordertounlockthenextscenesin

    each movie, and ultimately the next movie

    in the players career. This meant that the

    player couldplaya levelandcomplete what-

    ever objectives hewas able to, then as long

    as they had earned enough points basedon

    thecompleted objectives,theywould beable

    to progress to the next scene in the movie.

    This enabled us tolower the frustrationlevel

    forplayerswhowerentnecessarilyhardcore

    gamersandpossiblywouldntbeskillfulenough

    tocompleteall objectivesfor eachand every

    level.However,aplayermayonlycompletethe

    bareminimumnumberobjectivesnecessaryto

    progressforawhileandthenreachasceneor

    movie that theywouldnthaveenough pointsto unlock. In these cases, the player could

    DEV.MAG ISSUE 1626

  • 8/14/2019 Dev.Mag - 16

    27/32

    backtrackto aprevioussceneandattemptto

    completeanyobjectivesthat still remained in

    ordertoearnenoughpointstounlockthenext

    sceneormovie.Inmostcases,playerswould

    haveincreased theirskill level withthegame

    comparedtowhattheyhadwhenattemptingtocompleteearlierscenes,soobjectivesinthese

    scenesthatmayhavebeentoodifficultearlier

    on,wouldnowbewithintheirabilitytocomplete.

    Asmentioned,notonlydidthissystemreduce

    theamountoffrustrationinourgamefornov-

    ice to intermediate players, it provided play-

    ers with a longer gaming experience without

    feeling punished for failure, as in each take

    theycouldfocusonachievinganobjectiveor

    objectivesthat theyfeltwerewithintheirabil-

    ity.Thisalsohad the beneficial sideeffectof

    allowingour small development teamto only

    havetobuildarelativelysmallnumberoflev-

    els for the game, and then reusing some of

    themtostagemorethanasinglemoviescene.

    Ontopofcreatingbetterlookinggraphicsand

    designing a more fun and interactive game-

    playsystem,wealsofeltthatinordertomake

    players feel as though they were involved in

    aHollywood actionmoviethatwe needed to

    havealotmoreactionhappeningaroundthem.

    Inorder toachievethis,wewent aboutmak-

    ing the game environments as interactive as

    wepossibly could. The firstpartof doingthis

    involved creating a more advanced vehicle

    damage system thathadper-vertexdamage,

    whichallowedustoblendbothvertexandtex-

    turesbetweennormalanddamagedversions

    of each vehicle in the game. We expanded

    this system to allow us to have parts of the

    vehicle detach and become interactive parts

    oftheworld oncetheyhadsustained enough

    damage.Thismeantthatbonnets,doors,and

    evenroofswouldeventuallybreakoffoftheve-

    hiclesoncetheyhadbeensufficientlybattered.

    The second part of creating a more interac-

    tiveworldwas forustomakeasmuchofthe

    environment as possible tobedestroyable in

    someway oranother.Wewereableto have

    prettymucheveryobjectinthegamethatcould

    be hit except for buildings (ie. fire hydrants,

    lampposts, telephonebooths, etc.) damage-

    able or destroyable in when interacted with.

    This meant that all of these items either

    swapped to damaged versions of them-

    selves, or broke up into multiple pieces,

    each one with their own physics (ie. a tele-

    phone boothwould break into its four sides

    plus the roof, a wooden fence sectionwould

    breakupintoindividualplanksofwood,etc.),

    Andon top ofthat,someobjectswouldeven

    have their own added effects (ie. a fire hy-

    drant would leave behind a shooting jet of

    water thatwouldapplya forceto anyobjects

    that hit it, including the players vehicle).

    HISTORY WHERE IT ALL BEGAN

    Whilewewerebusyimplementingallofthese

    changes,wewerecontactedprettymuchoutof

    thebluebyaproducerfromacompanycalled

    BAM!.Theywererelativelynewtotheworldof

    gamepublishingandtheywerelookingatadd-

    ingtitles to theirXbox lineup.Theproducers

    namewasJoeBoothandhelikedwhathesaw

    inChase from our website, so hewanted to

    comedowntoSouthAfricanandvisitusinor-

    dertoseehowourstudiowassetup.Sosome

    time inAugust 2001 I believe,Joemade his

    waytotheI-Imagineofficeswherehewasmore

    thanimpressedatwhathesaw.Notonlywas

    hehappywiththedirectionthatthegamewas

    takingandhowitlookedinperson,hewaseven

    DEV.MAG ISSUE 1627

  • 8/14/2019 Dev.Mag - 16

    28/32

    moreimpressedwiththeteamthatwehadput

    togetherandthetoolsandtechnologythatwe

    haddevelopedasthebackboneofthecompany.

    InthenextweekorsoafterJoehadreturnedto

    theUK,wewerealreadyincontactwiththem

    inregardstotheirinterestinpublishingChase.

    We began to negotiate with them via phone

    andemail,and thenheaded toECTS inLon-

    donatthestartofSeptemberinordertowork

    onthefinerdetails ofthepublishing deal.As

    thedealwasnt100%guaranteedyet,wealso

    metwithsomeotherpublisherswhilewewere

    inLondon,butallofourfocusandenergywas

    reallyspentongettingthedealwithBAM!done.

    Bythetime thatwe leftECTS,whichwas to-

    wardstheend ofthe firstweekofSeptember

    2001, we were quite confident that the deal

    wouldbefinalisedinthenextfewweeksorso.

    However,onlyafewdaysafterwegotbackto

    SouthAfrica,theunthinkablehappened.9/11.

    Aseveryoneknows,thefinancialclimateimme-

    diateaftertheeventsonSeptember11,2001

    wasnotverystable.Therewerebigdropsinthe

    stocksof virtuallyall companiesdue toworry

    aboutthestateofworldaffairs,andBAM!wasnotanexception.DuetothestockpriceofBAM!

    sufferingasitdid,theyunfortunatelyhadtopull

    out ofnegotiationswithusforthe timebeing

    astheyjustdidnthavethecapitalinorderto

    publishChaseavailabletothemanymore.As

    you can imagine,we were quiteupset about

    thisturnofevents,butluckilytowardstheend

    of the year, the stockmarkets stabilised and

    BAM!wasonceagaininapositiontopublish

    Chase,soJoeflewbackdowntoSouthAfrica

    afterChristmasinordertomeetwithusandour

    boardofdirectorsinordertofinalisethedeal.

    Once the deal was completed, we were as-

    signedaProducerbythenameofBarry.Atfirst,

    Barryworkedwithusremotelyinordertoget

    theproductionschedulefinalisedand towork

    onthefinaldirectionthatthegamewouldtake.

    Afewmonthsintotheschedule,hecamedown

    toourofficesandstayedwithusforacouple

    of weeks while he tested the game and we

    allworked togetheron ideas forfinalisingthe

    restofthegamelevels.Oncethiswasfinished

    however,werealisedthatwewerebehindon

    ourinitialtimeprojections,and thatwewould

    not beable tomakeBAM!sdeadlineforhav-

    ing the game to market. Unfortunately, this

    datecouldnotchangeastheyhadalreadyan-

    nouncedtheirfinancialprojectionsforthequar-

    terinwhichthegamewasduetobereleased,

    andtheydidnotwanttocauseunrestwiththeir

    shareholders. So, Barry came back down to

    SouthAfrica a shorttimelater and spentthe

    nextfewmonthscrunchingwithusinorderto

    notonlyhavetherestofthegamebuilt,butalso

    gameplaybalancedandbugtestedsothatwe

    wouldbebackontrackagain.Thisunfortunate-

    lymeantthatwehadtodrop1scenefromeach

    ofour4movies,soweendedupwith16differ-

    entmoviescenes insteadof ourintended 20.

    Evenwiththechangeofschedule,wemanaged

    tocompletethegamearound thestartof Au-

    gust2002,atwhichpointitwentintotheTRC

    (TechnicalRequirementCertification) process

    at Microsoft. It failed at least once, possibly

    twice,butitwasfinallyapprovedforgoldstatus

    aroundthemiddleofSeptember,andwasavail-

    ableinstoresinNorthAmericanandEuropein

    thelastweekofSeptember2002.Oncereviews

    for Chase: Hollywood StuntDriver (asit was

    nowknown)startedtocomein,weweresur-

    HISTORY WHERE IT ALL BEGAN

    prisedathowmixedtheywere.Thereseemed

    tobejustaboutasmanypeoplescoringusat

    80% and higher as therewere scoring usat

    50%andlower.Ultimately,Ithinkthatthiswas

    probably due to the pick-up-and-play design

    thatwehadforthegame.Alotofpeoplefound

    thegameveryfun,compelling,andaddictiveto

    play,whileawholerangeofotherpeoplefound

    thegametobetooeasy,bland,andrepetitive.

    Afterallofthereviewswerefinallydone,weend-

    edupaveragingaround65%orsoifyoulookat

    Metacritic (http://www.metacritic.com/games/

    platforms/xbx/chasehollywoodstuntdriver?q=c

    hase) andGameRankings (http://www.gamer-

    ankings.com/htmlpages2/518048.asp). While

    wewerentvery happywith thelower scores,

    wewerequiteproudofbeingable tomakea

    gamethatalotofpeoplefoundtobefuntoplay,

    whichafterallisprimarilywhatplayinggames

    shouldbeabout.Asforhowwellthegamesold,

    thelastsalesfiguresthatIwasmadeawareof

    indicated that about175 000 units had been

    soldworldwide.Thisisntatremendousamount

    atall,butwewereprettyhappywithitconsid-

    eringthatitwasourfirsttitle,thatBAM!didnt

    spendverymuchmoneyonmarketing it,and

    thatitwasavailableononlyasingleplatform.

    Overall,wewereprettyhappywithhowthings

    turnedoutwithChase:HollywoodStuntDriver.

    Wemade alot ofmistakesand learneda lot

    ofgood lessons.Welostalotof good,expe-

    rienced employees, but wewere able tofind

    manytalentedSouthAfricanswhowereready

    tojumpinandtaketheirplace.Inadditiontothe

    previousSouthAfricanswhowerehired,during

    thefinalyearorsoofourdevelopmentofChase

    wemangedtohireawholeslewofadditional

    3DartistswithSteven,Louis,Corlen,Gary,and

    Lee.Aroundthestartof 2001we alsobegan

    toputtogetherateamtofocusondeveloping

    titlesfortheGameboyAdvance.Toachievethis

    wehiredanadditionalprogrammernamedDio-

    rgotoworkwithDerek,andalsohiredMichael

    andDominiqueas2Dartiststoworkalongside

    Jeanine in developing the art for the game,

    whosstorywillhavetowaituntilanothertime.

    COOLHAND

    DEV.MAG ISSUE 1628

  • 8/14/2019 Dev.Mag - 16

    29/32

    One day, you stumble into your

    friendsroomandfindhimsittingin

    thecornerwithaGameboyAdvance,

    hunchedover itlikea guilty teenagercaught

    reading Playboy except the hunch isnt in-

    spiredbyguilt.Infact,yourfriendhasnteven

    noticedyouenteringtheroom.Hescompletely

    absorbed with the little machines electronic

    antics.Youbegintowonderwhattheheckis

    goingon.Afterall,thisfriendisnotagamer.

    Not by a long shot. He doesnt even know

    howtoplayQuake.Infact,youdbesurprised

    if heeven knew that the game existed. Yet

    there hes sitting, enthralled by a Gameboy.

    Surprising,butcute.Thepoorbuggerstrying

    todabbleinaworldhehasnoideaabout!At

    thispoint, a strangepaternal instinctkicks in

    (eitherthat,orasubconsciousurgetogolaughathim),soyougotoseehowhesdoingwith

    his forayintogaming. Then comesthenext

    surprise.

    Oh,thisoldthing?Ivehaditforages,playit

    everyday.

    TurnsouthelovesGameboy.Healsoshows

    youhiscollectionofbookmarkedwebgames,

    puzzle titles andmiscellaneous gaming doo-

    hickeys.Allthistime,hesbeengamingeven

    morethanyouhad,andyouneverhadaclue.

    YouvesatwithyourAAAtitlesandlarge-scale

    LAN events for all that timewithout ahintof

    whatlaybeyondyourownsmallgamingworl