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 15:16 Go to previous messageGo to previous message
Kotk

 
Commander

Messages: 1227
Registered: May 2003
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.

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

Do not forget that minefields scan (SD) and are discovered bit differently than usual.


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.

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

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



[Updated on: Thu, 08 February 2007 15:17]

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 09:49:04 EDT 2024