Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » Efficient Algorithm for Scanning planets/fleets/etc.
Re: Efficient Algorithm for Scanning planets/fleets/etc. Thu, 08 February 2007 17:20 Go to previous messageGo to previous message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
Kotk wrote on Thu, 08 February 2007 15:16

there are basically 3 different scanning types
point blank scanning, non-penetrating scanning, penetrating scanning.

First one is important since scannerless ships see opponent ships and orbitals at same location. Also SS special scanners have improved abilities at same location.


Good to know. For some reason I was under the impression that ships without scanners didn't see any ships unless they engage in battle with them.

Quote:

Do not use squre root in range/distance calculations (its slow), instead compare the square of range with square of distance. Do not forget to apply squares of cloak/tachylon modifiers too. Wink


Well my philosophy of coding has always been readability over efficiency, within reason. I don't tend to implement things that execute but are confusing to code browsers. Especially in a future open source project. Smile

Quote:


Algorithm i would use would consist roughly of those steps:

1) Make 3 lists of scanners. Note that if JOAT did split out 100 chaff in some location, then it is bad idea to have 100 equal scanners there, have just one.

2) Make a list of all objects that do not belong to player. QSort that list by coordinates (by x if x is same then by y). That way you get the same location effect that Leit described.

3) apply point-blank scanners first to the list (because these involve no ranges or cloaks). Everything that was scanned move to scanned objects list.

4) split the remaining list into two lists, orbiting objects and deep space objects.

5) apply non-pen scanners to deep space objects. Everything that is scanned move to scanned objects list.


For step 5, don't pen scanners scan hull designs, but non pen scanners don't scan hull designs (or planets, for that matter). I can't really move an object into the scanned list unless it's been pen scanned. I could keep two lists of scanned objects, penned and non penned...

Quote:


6) apply pen scanners to orbiting objects. Everything that is scanned move to scanned objects list.

7) do what you want with scanned objects. Wink



Quote:


If it is still slow then switch to C++ or something. Very Happy


Ooooh a little C# jab there. Smile C# has been tested to be about 95% as speedy as C++. However, C# does not make a crappy programmer a good one, which is something that constantly jabs me. heh heh.

I have done enough C++ in my life. C# is like a angelic light warming my soul and making me happy. Ok, maybe not that nice, but it sure is more fun than clunking around in C. Smile

Report message to a moderator

 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: New stars! server clone proposal
Next Topic: 3D tool
Goto Forum:
  


Current Time: Mon Apr 29 05:27:26 EDT 2024