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

I hit my head and got a really good idea... (seriously)
http://www.miragesource.net/forums/viewtopic.php?f=201&t=1119
Page 1 of 46

Author:  Obsidian [ Wed Jan 10, 2007 5:02 am ]
Post subject:  I hit my head and got a really good idea... (seriously)

Okay right now, for NPCs everytime they're supposed to start moving, the server does a for i = 1 to max_maps, then inside of that it does a for x = 1 to max_map_npcs (or something like that).... wouldn't it be much better... to use a multi-dimensional array, to store the NPCs location (map, x/y), so you could avoid those two loops altogether? Would it make more sense to constantly update memory with their locations rather than run thousands of loops every X amount of time? (2500 Maps x 20 Map Npcs... lots of loops just to MOVE them)

My thought was just, as soon as they spawn... store their location in an array. Then just update from there, rather than return hundreds and hundreds of 'exit subs/functions' because it ran through an unnecessary loop...

Author:  William [ Wed Jan 10, 2007 10:38 am ]
Post subject: 

But dont you still need to loop the same amount of times to run (map, x,y)?

Cause you still need to loop through Map, x and y.

Author:  Lea [ Wed Jan 10, 2007 1:09 pm ]
Post subject: 

I would give each and every NPC in the game an Index number. They would store the map/x/y on themselves. That way, you can see if someone talks to index, and you'd know that it's THAT NPC right away without looping.

Author:  Dragoons Master [ Wed Jan 10, 2007 11:07 pm ]
Post subject: 

Well, an array that side could work, but just imagine the memory. The stored value much be Byte(imagining you have 20 npcs each map). Now considering your 2500 maps and lets say a 0-15,0-11(16X12 map). So its 2500X16X12 bytes, each byte variable uses 1 byte(lol). That's 480000 bytes. Or 480k bytes. Is not that much, is almost nothing xD. Now, lets say you'll need to check if a players is close to a npc and looking at him. You'll have the player's map and then check if an npc's x is the player's x + 1, simple... Just do check the table and see it there is any npc over there. If there is, use the value stored as the mapnpcnum. It seams to work and seams to be faster, do a few tests and tell us about it. ^^

Author:  wanai [ Wed Dec 01, 2021 1:06 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruhttp://magnetotelluricfield.ruhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruинфоhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.rutaskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruсайтhttp://temperedmeasure.ruhttp://tenementbuilding.rutuchkashttp://ultramaficrock.ruhttp://ultraviolettesting.ru

Author:  wanai [ Sat Jan 29, 2022 10:19 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Esqu

Author:  wanai [ Sat Jan 29, 2022 10:20 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

196.1

Author:  wanai [ Sat Jan 29, 2022 10:21 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

PERF

Author:  wanai [ Sat Jan 29, 2022 10:22 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

PERF

Author:  wanai [ Sat Jan 29, 2022 10:24 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Jose

Author:  wanai [ Sat Jan 29, 2022 10:25 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Prop

Author:  wanai [ Sat Jan 29, 2022 10:26 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

remi

Author:  wanai [ Sat Jan 29, 2022 10:27 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Herb

Author:  wanai [ Sat Jan 29, 2022 10:28 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Larr

Author:  wanai [ Sat Jan 29, 2022 10:29 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Jean

Author:  wanai [ Sat Jan 29, 2022 10:30 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Gera

Author:  wanai [ Sat Jan 29, 2022 10:31 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Knut

Author:  wanai [ Sat Jan 29, 2022 10:33 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Crem

Author:  wanai [ Sat Jan 29, 2022 10:34 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Tesc

Author:  wanai [ Sat Jan 29, 2022 10:35 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Arth

Author:  wanai [ Sat Jan 29, 2022 10:36 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Vint

Author:  wanai [ Sat Jan 29, 2022 10:37 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

XVII

Author:  wanai [ Sat Jan 29, 2022 10:38 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Magn

Author:  wanai [ Sat Jan 29, 2022 10:39 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Pier

Author:  wanai [ Sat Jan 29, 2022 10:40 pm ]
Post subject:  Re: I hit my head and got a really good idea... (seriously)

Melo

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