Sie sind auf Seite 1von 8

26/9/2016

GamasutraMicrosoftExcel:Revolutionary3DGameEngine?

MicrosoftExcel:Revolutionary3DGameEngine?
ByPeterRakos

Introduction
Cuttingedgecomputergamesusedifferentgraphicssubsystemsso
called3Dgraphicsengines.Source(usedinHalfLife2),UnrealEngine
(UnrealTournament),idTech4(Doom3),CryENGINE2(Crysis)or
Clever'sParadoxenginearewellknownamongtheplayersandthegame
industryexperts.
It'stimetolearnanew3Dgameenginename:MicrosoftExcel.
ItisunderstoodthatExcelisanallroundofficetool,butprobablyitisunknownthatithasabunchoffeaturesthatmakes
Excelahighclass3Dgraphicsengine.
InthisarticleIwilldemonstrateExcel'sarithmeticalfacilities,theembeddedrenderingsubsystems(therearetwoofthem!)
andtherevolutionaryapproachwhichmightjustcauseaparadigmshift.IhopeyouwilldiscoverthatExceleffectivelyand
efficientlyincorporatespracticality,tonsoffeatures,themultiplatformportabilityandthehighperformancewiththeunique
andfuturistic3Denginefeatures.
ThechaptersevenhavedemoprogramsandmoviescreatedwiththeExcel3Dengine.
Warning:Onlyfordeterminedexperts!

Arithmetic
MaybeExcel'sarithmeticfunctionsneedademonstrationleastofall.Thecorefunctionsofthe3Dobjectmanipulation(e.g.
thefourrulesofarithmetic,trigonometricfunctions,matrixalgebra)meantheessenceofExcelbutitisworthexamining
thembecauseoftheirunequalledcompactnessanditsmagnificentelegancewithwhichExceltowersabovethecurrent
entire3Denginefield.

Compactness
Itisverylikelythatnottoomanygameenginessolvethewhole3Darithmeticinahalfscreensize.TheupperpartofFigure
1containsthespatialshift,therotationaroundX,Y,Zaxisandtheperspectiveprojectionaswell.Asitcanbeseeninthe
demoapplications,thepolygonvisibility,theZbufferingandthereflectioncalculationrequireaboutthesamesize.

http://www.gamasutra.com/view/feature/131968/microsoft_excel_revolutionary_3d_.php?print=1

1/8

26/9/2016

GamasutraMicrosoftExcel:Revolutionary3DGameEngine?

Figure1:Essenceofthe3Dengine

Theyellowcolormarkstheuserdefinedparametersandgreencolorindicatestheenginecalculatedvalues.Numberedareas
containthefollowingdata:
1.Parametersoftheperspectiveprojection
2.3Dcoordinatesoftheobjects'points(relativetotheircenter)
3.Shiftandrotationmatrix(furtherdetailscanbefounde.g.athttp://en.wikipedia.org/wiki/3D_projection)
4.Parametersoftherotation
5.3Dabsolutecoordinatesofthepointsaftertheshiftandrotation
6.2Dcoordinatesofthepointsaftertheperspectiveprojection
7.Screencoordinatesofthepoints
8.Endpointsoftheobjects'edges
9.Formulaofanelementintheshiftandrotationmatrix.Simplicityandcompactnessareclearlyvisible.

Elegance
ThedevelopmentenvironmentofExcelnotonlyallowstheprogrammerstoeditaplainorsyntaxhighlightedsourcecode,
butitalsoprovidesallofitswellknownformattingfunctionsfortheenginedevelopers:severalfontscanbeused
simultaneously(withdifferenttypesandsizes),thecellsandtextscolored,popupnotesadded,andsitdown!soundsor
evenentiremoviesinsertedifrequired.

Rendering
Developerscanchoosebetweentworenderingsubsystems:
1.ExcelnativeCellGraphics(ECG)
2.OfficelevelGraphicsAbstractionLayer(OGAL)

ExcelnativeCellGraphics
ForgetforaninstantthatafterstartingExcelwecanseeaworksheetonthescreenwhichconsistsofcells,andthatthecells
containourdata,textsandformulas.Considerthisworksheetasthescreenoftheengineandthecellsasthepixelsofthis
screen.Basedonthisunusualapproach:
Worksheet=Screenoftheengine
Cells=Pixels
Nodoubtitisanastoundingapproach,anditwouldonlybepropertoaskhowthesebulkrectangleshapedcellscanbe

http://www.gamasutra.com/view/feature/131968/microsoft_excel_revolutionary_3d_.php?print=1

2/8

26/9/2016

GamasutraMicrosoftExcel:Revolutionary3DGameEngine?

consideredaspixelsbutwewillseethattheserectanglesareonlydemonstratingauniquefeatureofthecellgraphics,in
fact,andtheusualsmall,oldschool,squareshapedpixelscanbeusedaswellifrequired.
PutawayyouraversionandhavealookattheECGfeatures:
Pixelscanberesized,soifsomeonewantstotravelbackintimeandwouldliketousethesmall,oldschoolsquaresized
pixelsofthetraditional3Denginesthenhe/shecandoiteasily(pleaseseeFigure2and3).

Figure2:Excel'sdefaultpixel

Figure3:Resized(andtinted)pixels

Itshouldbenotedthatthisinnovationissuchanorganicpartofthesystemthatitispossibletousepixelswithdifferent
sizesineachrowandcolumn,ascanbeseeninFigure4.

Figure4:Pixelsizecanbesetdifferentlyineachrows

ThebestexampleofthisexceptionalresizeabilityisExcel'sdefaultsetting,wherethepixelsaresodistortedandrectangle
shapedthatitisveryeasytoconfusethemwithadataentryfield.
Mostusersdonotevenrealizethesearepixels,andseeonlydataentryfields!

Figure5:Renderingwithoutgridlines

Figure6:Renderingwithgridlines

Subpixelsizegridlinescanbeusedifneeded.Itisaveryusefulfeatureifrowsandcolumnshavedifferentsizes.You
cancheckthegridlinesfunctionshowninFigure5and6.
Colorofthepixelscanbesetby24bits.
255x65535screenresolutionwhichresultstheuniquelyhigh16.7megapixelresolutionnotfoundinother3D
engines.
Astounding1:256aspectratio,whichcanbesetbytheHide/Unhidefunctionsto4:4,16:9orotherarbitraryratios.
255screensinanapplication,sonotonlytheusual2butmorescreenbufferscanbeusedtogether.
Builtinzoomfunctiontoenlargeordiminishthepixelsatwill.
ItcanbesaidthattheExcelnativeCellGraphicssurpassesitstimeandcontainsalotofuniqueandunmatchedfeatures
whicharenotaccessibleinother3Dengines:resizeablepixels,arbitrarilyvariableaspectratio,16.7megapixelresolution,
switchablesubpixelsizegridlines.
Onthefigurebelow(Figure7)theenginecanbeseeninaction(withrenderedgridlines).Youcanstartthedemobygrabbing
ourexampleExcelenginefiles(enablethemacroswhenExcelasks),pressingtheALT+F8keysandrunningtheECG_Demo.

http://www.gamasutra.com/view/feature/131968/microsoft_excel_revolutionary_3d_.php?print=1

3/8

26/9/2016

GamasutraMicrosoftExcel:Revolutionary3DGameEngine?

Figure7:Engineinaction(withtheECGrenderingsubsystem)

ThedrawbackoftheECGisthespeedandtheabsenceofsomecommongraphicalfunctions(e.g.linedrawing,texture
mapping,etc)thatmustbeimplementedbythedevelopers.

OfficelevelGraphicsAbstractionLayer
http://www.gamasutra.com/view/feature/131968/microsoft_excel_revolutionary_3d_.php?print=1

4/8

26/9/2016

GamasutraMicrosoftExcel:Revolutionary3DGameEngine?

IfthereisnoneedforECG'sadvancedfeatures,likeresizablepixelsandvariableaspectratiothenExcel'sotherrendering
subsystemtheOfficelevelGraphicsAbstractionLayerisapossiblechoice.
OGALprovidesadditionalfunctions(polygondrawing,filling,etc),higherperformanceandcompatibilitywithother
applicationsoftheMSOfficepackage.Thiscompatibilitycanbeextremelyusefulifthe3Dapplicationhastobeportedto
(e.g.)Word.
Acuriosityoftherenderingprocessisthatrenderingisperformedonaseparatelayerinfrontoftheworksheet,sothe
subsystemcanworkwithoutmodifyingtheexistingcontentoftheworksheet.
ThisfeaturemakesitpossibletorunOGALandECGsidebyside,orshowthebackgroundcalculationsandtheirresultson
thesamescreenwhichhelpsthedebugprocess.AscreenshotoftherunningOGALsubsystemcanbeseenbelow(Figure
8).
Theseparaterenderinglayerinfrontoftheworksheetiseasilyobservableonthepicture:whiletherotatingcubeisrendered
onthislayer,the3Dcalculationsperformedbytheenginecanbeseeninthebackground.

Figure8:Engineinaction(withOfficelevelGraphicsAbstractionLayer)

AtypicalexampleoftheOGALsubsystem'srefinementistheavailablepolygons:whereasthecurrent3Denginesoperate
withtriangles,theOGALsupportsotherpolygons(likequadrangles,pentagons,etc.)aswell.
ThereisnoneedforaseparatebackgroundbufferbecauseitishandledbyOGAL.Colorscanbesetbytheusual24bitsand
thesubsystemprovidesanadditionalalphachannelforthetransparencyaswell.Again,thedemonstrationfileisavailablein
ourexampleExcelenginefilesforthosewhoshunrealtime,here'savideoofitinaction:

http://www.gamasutra.com/view/feature/131968/microsoft_excel_revolutionary_3d_.php?print=1

5/8

26/9/2016

GamasutraMicrosoftExcel:Revolutionary3DGameEngine?

Warning:Onlyforveryverydeterminedexperts!

Paradigmshift
Sequentialityessentiallyinfluencesouractualprogrammingparadigm.Itcanbefoundineverycorneroftheprogramming
vocation:daybydaythousandsofprogrammerscodetheiralgorithmsrowbyrow,createtheexecutablesstepbystep(as
definedinthemakefiles),debugtheexecutablescommandbycommand.
Thousandsofdifferentprogramsandbillionsofsourcecodelineswerecreatedwiththissequentialapproach.Sequentiality
pervadesourcurrentprogrammingparadigmsomuchthatprogrammersdon'tquestionitsreasonforexistenceandtakeits
limitationsforgranted.
Note:Pleasedon'tunderestimatethepowerofhabit!ProbablyyouhaveaQWERTYkeyboardinfrontofyouwhichhas
intentionallythemostuncomfortablebuttonlayout!
It'snotajoke:theQWERTYlayoutwasoriginallycreatedforthetypewritersinthe1860swhenthejamwasadifficult
technologicalproblem.TheQWERTYlayoutensuresthatsuccessivekeystrokesalternatebetweensidesofthekeyboard.This
layouthelpstosolvethetypewriters'jamproblembutitcausesthegreatestpossibledemandsonyourfingersandjoints.
Thewindofchangehasblownawaythetypewritersandtheir150yearoldtechnologicalproblemsbutwestillusethemost
uncomfortablekeyboardlayoutthesedays!
Itisthepowerofhabit.
(Forfurtherinformationvisithttp://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard)
Excelbreakswiththishabitandexceedssequentiality.Itsrevolutionaryapproachcanbeobservedinthefollowingfields:
Nontraditionalsourcecode
Nonsequentialdebugging
Instantfeedback(withoutasequentialmakeprocess)

Nontraditionalsourcecode
Itiscommonlyacceptedamongdevelopersthatsourcecode(andthealgoritmsencodedinsourcecode)handledbythe
currentdevelopmenttoolsrequireasequentialtopdownreadingandinterpretation.Figure9illustratesthissequentialtop
downinterpretation.

http://www.gamasutra.com/view/feature/131968/microsoft_excel_revolutionary_3d_.php?print=1

6/8

26/9/2016

GamasutraMicrosoftExcel:Revolutionary3DGameEngine?

Figure9:Traditional,topdowninterpretedsourcecode

Weacceptedthissequential,topdownmentalitysomuchthatinterpretationofanunusuallyformatted(butsyntactically
correct)sourcecodecanbeimmenselyhard.Ifyouwouldliketotestyourthinkingthenyoucanfindsomechallenging
examplesathttp://www.textrush.com/codeformatting.htm.Theseexamplesaresuitableonlyfortheverydetermined
readers,astheycontainunusuallinebreaksandtabulatorsaswell.
ExcelsupportsthistraditionalsequentialtopdownapproachintheVBAcodes(seetheexampleonthepreviouspage)and
additionallyitprovidesaverynew,freshandrevolutionaryopportunityaswell.Workingontheworksheets,programmers
canusethetwodimensionsofthesheets,andtheycanusethedirectionsabsolutelyfreely.
Thismeansthatthealgorithmscanbeencodedhorizontally(seethe1stfigurewherethestepsofthe3Dtransformationis
interpretedfromlefttoright)orfrombottomtotoporeveninLshapedknight'smove.Exceldoesnotforceyouinto
traditionaltopdownsequentialcodingthereforeitprovidesexceptionalfreedomforprogrammers.
ItcanbesaidthatExcelopenstotallynewdimensionsintherepresentationofalgorithms.Wecannotevenseetheborders
ofthesenewopportunities!Soonwemaymeasurenotonlythelengthofthesourcecode(seeSLOC)butthewidthofitas
well(whatwillcomplementtheSLOCnumbers?).Furthermore,itmayopenthewaytondimensionalsourcecode,andwe
mighttalkaboutthedepthorheightofthesourcecode,too.
Excelbreakswiththesequentialityofthesourcecodeinterpretationwithanothernewfeatureaswell:withcellreferences
programmerscanseethedependenciesofthesourcecodeseasier,notonlyrowbyrowbutsimultaneously,andcanquikly
overviewthesourcecode.
Cellreferencesallowtheprogrammertocheckwhatotherdataaffectsaselectedvariable(e.g.Figure10showshowthe3D
transformationmatrixisdeterminedbythecosinusoftheXandYrotationangles)andtheycancheckwhatothervariables
areaffectedbyselecteddata(e.g.theselectedtransformationmatrixelementaffectsallthe3Dvalues).Ifitisneededthen
thechainoftheimpactsdefinedinthealgorithmscanbeshowninbothdirections.

Figure10:Cellreferenceshelptocreateanoverviewofthedependencies

Nonsequentialdebugging
Terminationofthesequentialitycanbeobservedduringthedebuggingprocessaswell.Withthecurrentdevelopmenttools
programmersmustfollowtheexecutionoftheprogramstepbysteptoobservethereal(andnotonlytheintended)
behaviouroftheprogramandthealgorithms.

http://www.gamasutra.com/view/feature/131968/microsoft_excel_revolutionary_3d_.php?print=1

7/8

26/9/2016

GamasutraMicrosoftExcel:Revolutionary3DGameEngine?

Theycanusesomeusefultools(breakpoints,stepin/stepout,etc.)tomakethisprocessfasterandmorecomfortablebut
sequentialityisbuiltintoourprogrammingparadigmanditslowsdownthedebuggingprocess.
OpposingtothisExcel'sAutocalcfunctionshowstheexecutionofthealgorithmsunfoldedandtheeffectsofallstepsinall
variablescanbeseenimmediatelywithouttheneedofstepbystepdebugging.Thisfeaturedrasticallydecreasesthe
overheadtimesandincreasestheproductivityoftheprogrammers.

Instantfeedback
Probablyallprogrammersexperiencedthatannoyingandobsoletetraitofactualdevelopmenttoolsliketheresultsofthe
modificationscannotbeseenimmediately,andsomesequentialstepsmustbeperformedtogettheseresults.
Inatypicalsituationaprogrammerhasto...
1.Savethemodifications
2.Compilethesavedfiles
3.Linkthecompiledfiles
4.Runtheexecutablebytypinginacommandline,clickingonanicon,orrunningabrowserandtypingaURL,etc.
...andwillgettheresultonlyafterthesesteps.
Thesestepscanconsumesuchahugeamountoftimethatspecializedtoolsincreasingthespeedofthecompilation(e.g.
Incredibuild)becameverypopular.Incaseofsmallandfrequentmodificationsthisworkflowcanleadtoahugeamountof
overheadcomparedtothesubstantiveandusefulwork.
Wearesousedtothisworkflowthatwedonotevenexpectittobeeasier.
NotsurprisinglyExcelbreakswiththisworkflowandusesarevolutionaryapproachagain.ThankstoitsAutocalcfunctionthe
editor,thecompiler,thelinkerandtheruntimeenvironmentareintegratedonsuchahighlevelthatisunpairedamong
currenttools.
Afterchangingaformulainacelltheresultisvisibleimmediatelywithouttheneedforperformingthestepsmentioned
above.Programmersdon'thavetosave,compile,linkandruntheexecutableandthereisnoneedeventoswitchtheactive
window.
Thereisnomiracleofcourse:Excelworkssequentiallyinthebackgroundbuthidesthissequentialityfromtheprogrammers.
InthepreviouschapterswehavereviewedhowExcelqueriesthejustificationofthesequentialityandwhatarevolutionary
answeritgivesfortheproblem.Noticethateliminatingsequentialityisnotonlyabuzzwordbutaradicallynewapproach
whichcanchangeourprogrammingparadigminthefuture.

Afterword
Integrationofcomputergamesandspreadsheetshastightenedduringtheevolutionofcomputertechnology.
Atanearlystagethisintegrationamongthethegamesandspreadsheetswascomical,e.g.theywereinstalledonthesame
harddisk,orthepurchasedgameswerelistedinanExcelsheet.Latertheintegrationhastightened,assomegames
introducedabuiltinspreadsheet(accessiblebythe"bosskey"feature)orExcelcontainedsomebuiltin3Dgamesas
EasterEggs.
Nowwehavearrivedatthenextstepofthisintegration,asExcel'scuttingedge3DfunctionalityisnothiddeninEasterEggs
anymorebutcanbeaccessiblepubliclyandeasily.Excelhasgrownupandstarteditsconquestasarevolutionary3Dgame
engine.

Returntothefullversionofthisarticle
Copyright2016UBMTech,Allrightsreserved

http://www.gamasutra.com/view/feature/131968/microsoft_excel_revolutionary_3d_.php?print=1

8/8

Das könnte Ihnen auch gefallen