Mirage Source

Free ORPG making software.
It is currently Sat Jan 28, 2023 4:33 pm

All times are UTC




Post new topic Reply to topic  [ 18 posts ] 
Author Message
 Post subject: Optimize MAX_ Looping
PostPosted: Wed Dec 20, 2006 8:03 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Tutorial is not yet Finished

By: William
Difficulty: 2/5

Introduction
This will make the looping smaller for all of your MAX_ (ex. MAX_MAPS, MAX_ITEMS...). So instead of looping from 1 to 1000, maybe you only have 50edited maps, then it will loop from 1 to 50 instead. Of course, if you are making your own game using a source, you can simply choose your own MAX value, and you can probably do that for a engine too. But anyway, I'll make this tutorial for all of you anyway. This is recommended for engines, since the users of the engine doesn't really consider the MAX and often has it on 1000. Which means 1000 loops for probably around 30maps for example.

Server Side
First of all, open frmServer and go into Private Sub Form_load() At the bottom of that sub, add:
Code:
Call SetHighMaxMap
Call SetHighMaxItems
Call SetHighMaxNPCS
Call SetHighMaxItems
Call SetHighMaxShops
Call SetHighMaxSpells

Now, in the bottom of modGameLogic, add:
Code:
Public Sub SetHighMaxMap()
Dim FilePath As String
Dim f As Long, i As Long, Added As Long

    For i = 1 To MAX_MAPS
        f = FreeFile
        FilePath = App.Path & "\Maps\Map" & i & ".dat"
        Open FilePath For Binary As #f
            Get #f, , HighMap(i)
            If HighMap(i).HighTile(0, 0).Ground <> 0 Then
                HIGH_MAX_MAPS = i
            Elseif HighMap(i).HighTile(0, 0).Mask <> 0 Then
                HIGH_MAX_MAPS = i
            Elseif HighMap(i).HighTile(0, 0).Fringe <> 0 Then
                HIGH_MAX_MAPS = i
            End if
        Close
    Next i
End Sub

Public Sub SetHighMaxItems()
End Sub
Public Sub SetHighMaxNPCS()
End Sub
Public Sub SetHighMaxItems()
End Sub
Public Sub SetHighMaxShops()
End Sub
Public Sub SetHighMaxSpells()
End Sub

Now for HIGH_MAX_MAPS replace all but these:
Code:
Sub SaveMaps()
Sub LoadMaps()
Sub CheckMaps()


Under Construction

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 5:50 pm 
Offline
Newbie

Joined: Mon May 29, 2006 2:18 pm
Posts: 22
Location: Florida
In most games i've seen, if they have say 1000 maps, and only use 50 of them, they still usually put a map at #1000, thus rendering this useless. Reguardless, this is a still a good tutorial.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 7:10 pm 
Offline
Pro

Joined: Mon May 29, 2006 2:15 am
Posts: 368
Just to point out, you don't have to use

Get, , HighMap(i)

You can just keep using your normal Map(i), so you don't have to point another variable at the maprec... Same with the tile part.

It may also be better... to do this by the 'Revision' variable from the maprec. When maps are cleared... it is automatically set to 0. It doesn't increase unless someone edits the map...

_________________
Image
Image
The quality of a man is not measured by how well he treats the knowledgeable and competent, but rather how he treats those less fortunate than himself.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 8:10 am 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
NOt going to complete the tutorial, you get a hint from whats there now. ANd this sisnt really a good way.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 2:12 pm 
If it isn't a good method, then why keep the tut at all?


Top
  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 3:20 pm 
Offline
Knowledgeable
User avatar

Joined: Mon Jul 24, 2006 2:04 pm
Posts: 339
Since it is bad practice in the first place to just jump numbers like that, and good coding/designing practice goes hand-in-hand with fast code? :wink:

_________________
NetGore Free Open Source MMORPG Maker


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 3:42 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Advocate wrote:
If it isn't a good method, then why keep the tut at all?

It's like high_index, it decreases the numbers of loops. But still it doesn't help much.

Spodi wrote:
Since it is bad practice in the first place to just jump numbers like that, and good coding/designing practice goes hand-in-hand with fast code? :wink:

Dont understand what you mean :P

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 5:11 pm 
Offline
Knowledgeable
User avatar

Joined: Mon Jul 24, 2006 2:04 pm
Posts: 339
Well what I mean is that you can't write well optimizations if the code is used poorly. For example, there is absolutely no point in skipping around the index of maps and leaving indexes open. Yeah you may want to sort your maps, but do that somewhere else - keep a document of the index, map name and description or whatever, since leaving 100 indexes open between maps "because you might use it later" is just dumb. William has the right idea on using the high index instead of the max index. This also prevents you from even having to specify a max maps value, since the high index does it for you.

_________________
NetGore Free Open Source MMORPG Maker


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 5:35 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Spodi wrote:
Well what I mean is that you can't write well optimizations if the code is used poorly. For example, there is absolutely no point in skipping around the index of maps and leaving indexes open. Yeah you may want to sort your maps, but do that somewhere else - keep a document of the index, map name and description or whatever, since leaving 100 indexes open between maps "because you might use it later" is just dumb. William has the right idea on using the high index instead of the max index. This also prevents you from even having to specify a max maps value, since the high index does it for you.

Yes, very true. I would not add this to a game, since you have full control over the MAX_, instead it could be added for a engine, since the users are lazy when it comes to decide the max values.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Tue Nov 02, 2021 9:27 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 291597
GoGa256.7BettCHAPNatiPROMKittGeorIntrDonaBollOperPYPWEverPensElegTescElaiTescDaviZoneDennMore
NataSambComeExceWateMineMichtranMPEGFreeIntrTrisJannCytoGuccEmilPeteCredBurncontBeteHowaMari
PhilNikoStraGrimPeteCapiVoguKoffRobeblacAdorSelaSTALJohnReidJeanXIIIElecFranNikiAnniMostRain
XXVIOZONMarkGothAbbaKeepNeriZoneArdeWindFocuSigrAntiBestZoneCompSleeSmaldiamgbdoTripLoriZone
ZoneZoneSwarEarlJPANZoneFotoStarZoneXVIIZoneZoneHaroZoneMORGValeNighPoorZoneWindZoneOffeTama
ZoneEnglMartEpluPanaMABEMielSwadBookGregUleaBookBonuCommAntoMistLinePierAbsoARAGSexySharFolk
QuacCreaTrefDancSmobBiliwwwrwwwrEdgaWindHeatHellBeathappCrysWindrlesChriLukiKrupFromNicoDivi
RecoXIIIAcadYMCAVasiTheoBusiHerbXVIIXVIIMariBoriClubDazzDolbPagaNothScotPaolEnglBombGoldRosi
GiraXVIITrenHaraBrucJohneditMIDIExceKessDaisBalaWilhHairHallWindHappBookSaniMPEGInteEpluEplu
EpluFredAquaRalpECCORudyKillConcPeteCrosEnglSilvmedituchkasAnthWill


Top
 Profile  
 
PostPosted: Fri Feb 18, 2022 2:47 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 291597
Econ243.5BettCHAPRockDropBarbElliFranEnidLeynRideNissSharTescKonaMichRondSempRomaZoneRobeTesc
RobeXVIITescBettPhilBylyKeitMothABBACreoTherDigiRobeOLAYBrilWintJohnGarnNokiJozeRichPhilmail
blonFutaLifeFunkTUSASnowEnigCollYorkmailviscGallEnhaPierDiabXVIISandRIALStouAlexArcaDoggAgat
XVIIWindJohnSettArthWindCircZombGhiaRealBrucMariIndiJeweRusiBoyzJessHalodiamZoneManobindZone
PaulZoneZonePeopPainZoneBradIntrZoneSmokZoneZoneRichZoneZoneMichDongEricZoneParkZoneSingMari
ZoneOrdeGebrFlasParmArdiMielShoaBookNaruDondFrisEdmiSwarAireBeerLabaSQuiBlueARAGURSSDentChor
GOBIBrilTrefRequChevMichWindMicrJeweWindBricMakiWinxChouWhisBlacHappHomoWindRappRebeXVIIChil
RodnEaglEuweAntoSoviGeorThisWendRopeVIIIEricWortBeteCureMicrVasiMariDaviSweeJustRobeToccwwwa
HumaKellFranEnglRobeOZONyearMargXVIICharXVIILogiBeatSuniKessSeriVIIIOttoAdobDivXElleFlasFlas
FlasSuzaDAIWLindPaulHarrWaldGlenMichJinnSpanXXIXWithtuchkasDamiGeor


Top
 Profile  
 
PostPosted: Wed Mar 16, 2022 12:24 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 291597
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтmagnetotelluricfieldсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт


Top
 Profile  
 
PostPosted: Fri Sep 16, 2022 5:17 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 291597
Herb302PERFCHAPBoogBrazAlexWaltKareAlphAndrDunsClaiOrieTescGalaClasFirsGlasSaosZoneConcAyli
AtlaCrepExpeJeweEsteHerbPenhRijcCoolOLAYLoveXVIIStanPayoNatuMantBritFlaxLopePatrSonyMaurJohn
OZONFireKeviOmsaBillQuanPushWillNikishinAndrRewoEricNikiTintEmilHervELEGNikiSelaElegGranDima
BookPhilIainLarrStouCoreArisHappAdamMiniHappMikeBalaArtsZoneEduaExceAstaMiyoZoneImmeEdwaZone
JameForeHappMoviRondZoneJeanNowhZoneGainZoneFyodRobiZoneZoneZoneZbigVitaurspRowdPersPetePers
RemoletzMYNGSUPESamsKronBSYADiviWorlActiDronBookNeriSilvJardGiglLarrdefiHoldARAGunioSecoIndi
HibiNDFEBlueJeffTropAuthElitPoweWindwwwrNorbDremWinxEsseRoyaWindBernMicrAdveStanWingprogMaga
SongPARTHenrJeanTarnXVIIXVIIarleAcadNeedEricBogdAlexRockWindPhilByroDaviConsRogeStanMayfQUMO
RogeIKEAEdgaPhilGustDiCiWindDellMerlDiamPaulXVIIGordRingIntrUbisApprMicrBookTequSoliSUPESUPE
SUPEMenuPunkThisReamTerrFranDeepJeffIntoBankSongObjetuchkasAnurJewe


Top
 Profile  
 
PostPosted: Mon Dec 12, 2022 4:32 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 291597
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.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group