Mirage Source
http://web.miragesource.net/forums/

Animation Loops outside the Gameloop
http://web.miragesource.net/forums/viewtopic.php?f=201&t=3708
Page 1 of 1

Author:  seraphelic [ Sun May 11, 2008 5:42 pm ]
Post subject:  Animation Loops outside the Gameloop

Wondering if anyone uses loop timers outside the gameloop.

Just an idea, for example:

Code:
Sub BltSomething(ByVal Something As Long)

    Dim x As Long
    x = 0

    Do While x <> -1
        If GetTickCount > SomethingTimer + 125 Then
            If x <> 4 Then
                SomethingTimer = GetTickCount
                Call BltSomething
                x = x + 1
            Else
                x = -1
            End If

    DoEvents

    Loop

End Sub


Then just have a BltSomething packet. Im runnin out the door but thought Id ask instead of testing, plus I like the constructive comments.

Author:  Spodi [ Sun May 11, 2008 5:49 pm ]
Post subject:  Re: Animation Loops outside the Gameloop

I don't quite exactly get what you're asking, but if you want to render from an external loop, its not going to work well. All your rendering needs to be done in the same loop to ensure you render in the correct order and every frame.

Now if you want to use the timer to modify how stuff is rendered, but not actually render, that is totally fine.

Author:  Robin [ Mon May 12, 2008 8:44 am ]
Post subject:  Re: Animation Loops outside the Gameloop

In plain English:

The subroutine you posted has a timer check in it. That timer check would want to be in GameLoop rather than in it's own separate loop.

A good example of what a mess that makes is the server, where you have 4 or 5 different timers. It really messes up the timing, and it wasn't until I removed those that a lot of the annoying bugs I used to get sorted themselves out.

Now, having a separate timer doing some rendering isn't going to work. If, however, you want to keep calling the rendering subroutine from within the gameloop and have the separate loop only changing a variable, then that's fine.

For example, you keep 'BltSomething' in the gameloop, but in the separate timer you could have 'SomethingVariable = SomethingVariable + 1' or something.

Wow... my post made even less sense than Tyler's.

Sorry :(

Author:  seraphelic [ Mon May 12, 2008 8:51 pm ]
Post subject:  Re: Animation Loops outside the Gameloop

Yeah I failed to mention Im using an optimized GFX system so you'd only need to render something once, which would also render to a seperate buffer that is blted whenever anyone moves underneath that area. So NOW is this acceptable? I dont want to have things in the gameloop that dont need to be used alot.. Would a few tickcount loop timers create noticable problems or lag? They are, afterall, being exited.

Author:  Spodi [ Mon May 12, 2008 9:22 pm ]
Post subject:  Re: Animation Loops outside the Gameloop

No, not is not. Your rendering time is still random in context with the rest of the program. You want to render in order - its not about performance, its not about thread safety, its just about logic. You can mix in updates with rendering at times (although its a bit harder to follow and not very well structured) but you can not throw around your rendering times randomly.

If you are rendering to a separate buffer, put the code where you want it in the call to render to that separate buffer. Keep it linear and simple.

Author:  seraphelic [ Tue May 13, 2008 12:01 am ]
Post subject:  Re: Animation Loops outside the Gameloop

Spodi wrote:
No, not is not. Your rendering time is still random in context with the rest of the program. You want to render in order - its not about performance, its not about thread safety, its just about logic. You can mix in updates with rendering at times (although its a bit harder to follow and not very well structured) but you can not throw around your rendering times randomly.

If you are rendering to a separate buffer, put the code where you want it in the call to render to that separate buffer. Keep it linear and simple.


Why would it have to be "in order"? The movement of players is just as random. If what youre saying is true, I need a better explanation, here's a bit a code I planned to use.

Code:
Sub SpellAnim(ByVal Spell As Long, ByVal x As Long, ByVal y As Long)
   
    Dim SpellTimer As Long
    Dim z As Long
    z = 0

    Do While z <> -1
        If GetTickCount > SpellTimer + Spell(i).Interval Then
            If z <> 12 Then
                SpellTimer = GetTickCount
                Call BltSpell(i, x, y)
                x = x + 1
            Else
                x = -1
            End If

    DoEvents

    Loop

End Sub


OOo I just realized, what if this procedure was executed again during the DoEvents, what would happen with the same sub running at the same time. Also while we're on the topic, I wanted to create some serverside timers for some map events. What if there were say, a dozen of these timers active on the server, would it be noticable?

Author:  GIAKEN [ Tue May 13, 2008 12:12 am ]
Post subject:  Re: Animation Loops outside the Gameloop

Why would you want to do this anyways?

Stop trying to make it so complicated. You do all your blt'ing in the game loop, you don't need to separate it into 100 different functions.

If it's not going to be used a lot you still keep it in there...doing the proper checks.

Why do you think we use a main game loop and not 10 different timers each dealing with a different thing?

Listen to Spodi, it's about logic...

Author:  seraphelic [ Tue May 13, 2008 12:50 am ]
Post subject:  Re: Animation Loops outside the Gameloop

Well Ive moved onto server loops and need some more advice..
I think that certain events arent important enough to check every loop, such as the respawning of map objects (ex/ trees, ore, etc)
SOoo.. I just through this together in a minute:

Serverloop:
Code:
        If GetTickCount > SecondTimer + 1000 Then
            Call CheckTempTree
            SecondTimer = GetTickCount
        End If



Code:
Sub CheckTempTree()
Dim x As Long
'RespawnTreeID records current temp trees, and handles the timer and respawn

    Do while x <> -1
        If RespawnTreeID(x) = -1
             x = -1
        Else
             If GetTickCount > RespawnTreeID(x).Timer + 20000 Then
                 RespawnTree(RespawnTreeID(x))
                 RemoveTreeID(x)
             End If
        End If
    Do Events
    Loop

End Sub

This would reduce checking certain unimportant procedures, thereby lightening up on the serverloop. Idk I just pieced this together off the top of my head, you can harrass me now.

Author:  GIAKEN [ Tue May 13, 2008 12:53 am ]
Post subject:  Re: Animation Loops outside the Gameloop

Code:
            If GetTickCount > SecondTimer Then
                Call CheckTempTree
                SecondTimer = GetTickCount + 1000
            End If


That's how it should look. Instead of doing the check and adding a lot, it just does the check and then adds once.

Author:  seraphelic [ Tue May 13, 2008 1:03 am ]
Post subject:  Re: Animation Loops outside the Gameloop

GIAKEN wrote:
Code:
            If GetTickCount > SecondTimer Then
                Call CheckTempTree
                SecondTimer = GetTickCount + 1000
            End If


That's how it should look. Instead of doing the check and adding a lot, it just does the check and then adds once.


Thanks for that, just fixed up my Gameloop and Serverloop ;D

I need some constructive criticism on the way I set up the respawn timer.

Author:  wanai [ Wed Dec 08, 2021 4:33 pm ]
Post subject:  Re: Animation Loops outside the Gameloop

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.ruсайтsemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoningtechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.ruhttp://temperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru

Author:  wanai [ Tue Feb 08, 2022 10:39 pm ]
Post subject:  Re: Animation Loops outside the Gameloop

This232.2CHAPFundRobeWaveRadiDeadVincAndeADHDFiskEnyaOrieMcBaImprErleOZONBrowWindZoneWindMeal
TescKurtParaSandEstePantRodrXVIIEastMatiFavoHadaElliGillOreaEmilAustSkinMarrAxelJohnONLYFrot
PhilDepaTranErnsBegiJohnFlatJacqRobeAntomattGravThatXVIIOetkCarmStapblacJameNikiDaviOssiRidg
BabyBellXIIIRARULeslPanzStouRobeCafeWindRichImagGreaStevSwarAlexGranXVIIArtsFuxiBeauXboxChet
diamWarhdiamSideMiyoVirgLestAnsmGrinAlanRockStefCrisVasiBradDaviFranSergPanzHoaiMinuYearTake
AlmoNinaBFacCasiJeruqINTBoscScouInsiEducBookTrandesiDizzplacMistHorsPierSonySTAROtboSectFree
GardEditPlayHobbSlopIrinWindwwwnEdgawwwnProfMoulhappPacoPediFantLeftvaSceditOZONLethMimiMich
EverprogAlanPaulJohnJawaAcadSadoColdMadaDecoGaliMikhStayPhotRitmDaviPartHaviEPHEMantMartFrec
WindThomErneOCLCBrazCeciHerzSociXVIIXXIIOlivCreeChanPumawwwaXVIISALTTormButtAstrEugeCasiCasi
CasiGeieYannChatMondMoodThesUntiChapAbbeThisEastJulituchkasThisHolm

Author:  wanai [ Fri Mar 11, 2022 10:37 am ]
Post subject:  Re: Animation Loops outside the Gameloop

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatorhttp://magnetotelluricfield.rumailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting

Author:  wanai [ Thu Jun 02, 2022 5:44 am ]
Post subject:  Re: Animation Loops outside the Gameloop

Hitc129.9PERFPERFOverJeweRaphDigiMarkKrzySideObseSieLGregShowXVIIFlowMoreFullVaniRichDeanJust
WindDickMORGCottJewePeteLiveAlicBranGillThatJameLiliIvarXVIIJohnBrotPaffPatrholiLighRichKiss
OreaJennIoanGudrMercNintXVIILewiFallAlmoCircQuikTOEFBetiRubyNoriLillJoshSandJorgRobeFranJean
PeteLouiAdioRoxyOsirCircNikiMaurJustNathDobsJensNikiGetrZoneCharMeanIchiLoveGunnStilLaneQuee
ZoneEvelBabyYounZoneZoneSpanSituZoneErneZoneZoneZoneZoneZoneXenuRobeZoneZoneZoneSatiZoneZone
ZoneLINQThelPhilDAXXWindIndeIndewwwnOscaForcBookMorgWWUnChicWindMistBusiSTARFORDFirsBookFunk
DaiszeroEducCBOTDisnBRATAlfaWindWindWindBoomPhilPanaYukiEukaWindPretGlenOrigJeweJackXVIIXVII
XVIIPireKarlEdgaRobeMcGrMarkXVIIRomaVictMikhOZONeavyStreDonaAnimPaulEyedVittLindBusitotaWind
DigiJohnJuanDaleJohnRyanThomFunnhttpRudyANGRmailWiimEliuSaraMichmotiRogeOlafJeanWindPhilPhil
PhilMagnGiusGeneStanHarrErasLeppRudoJeanPracInteSusatuchkasWindSony

Author:  wanai [ Fri Sep 09, 2022 4:15 pm ]
Post subject:  Re: Animation Loops outside the Gameloop

This293.2BettYourHighPROMXIIIJasoWernDaviChriRudoSaraEnnsJerrQuatBlacAnteOndaMontZoneLawsDidi
AtlaTescPoinAnkaCredVenuMavaJewebookCartTonyWannXVIILamuPanaPlanDiscNiveCaudRougWaltBrucJard
SplaConcElviPaolNighMariMIDIWindNikicottMattErlePulpfantAlbeJameMennElsySelaSelaSquaRegiAdio
MakiDemoJoseWillKingLeosJohnRalfTracOsprDeepFinaDiscSwarRusiHenrPiteAABFMiyolsbkBegiSideZone
SwarMichSwardiamXIIIMaryBurdXVIIJeweXVIIJonaCareExceAkraXVIIPeteMarkArchGooNNaohWillonliEFLS
DigiGebrFrieminiSarrSakaMabeJukkBookFlipBookLasePETEGlamWillBestHenrCityARAGWantNiceAmerJazz
FlatEducRussLoveXIIILEGOWindWindwwwnwwwnLEGOBoscChouchicChoiLaurImprEricManiEsmeHingComeXVII
CaptFaceXVIIXVIILibrGiusHonobeenDiggGenuStepJamePramArcaEnroBIOSBarrGammLouiconcFranCarmCome
ActiAmbjGeorPhyoBabyOZONCarlworkGoinHansGoldAssaStarErleJameOrphXVIISounNancVivaCodeminimini
miniJasmPopeJasmMaryDickFourEasyRobeRobeNothHardFredtuchkassecoJetF

Author:  wanai [ Thu Oct 13, 2022 11:32 am ]
Post subject:  Re: Animation Loops outside the Gameloop

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоtuchkasинфоинфо

Author:  wanai [ Thu Nov 03, 2022 6:53 am ]
Post subject:  Re: Animation Loops outside the Gameloop

Howa189TESTCornJameBimdComeDaviGallFinaGeorSupeTescDeciJudiWindDaviUnitJeffStefEvitWhitKeny
FlooWindGladIndeHereMortSETVWilhPeteAhavBlakMarlStarCreaVictMediBickKissDianFishSciewwwmMedl
USSRNapoBriaKornNicoSmilSonyXboxSureFyodHummMariCotoVINCYvesHenrCoulgunmWantPaulPeteBoriOxid
PushDiamJackJuniWarcChopClicLuxoHallWindSampWindCrasZoneKnutGrooZorrDailArtsAbneLastShowUniv
ArtsZoneArtsWhatFeelZoneCamiLookSideChriZoneXVIIBelvZoneRockMarkBrotYorkZoneFranSupeSomeSome
ContFrerDarrFlasFlayMicrMielKronINTETwisBookFullcybeRoseForsExpeZoomPierBlauPROTProvDjVuJewi
ApexTangEditBlanJengEverDigiWindBusiWindProfDeLoUnitCartRoyaXVIIhandtLabXIIIPIMSNicogustCami
JDCrballXVIILaurLeipInteGeorJohnGrubGunaEverKlasCanaLastTougThisWaxwAleqIntetragFleeSenzVolt
PaulProdMartHaraRichKingDrWeRoarMaryFeelCoseZdenEmilNelsInteRamomonkCeciCultGoddmobbFlasFlas
FlasJeanWheeAstrThaiBriaFilmBookMichJaneEthiXVIIStratuchkasFarhWilh

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/