www.ClassicTW.com
https://mail.black-squirrel.com/

TWX Proxy Scripting Clinic - Bubbles
https://mail.black-squirrel.com/viewtopic.php?f=15&t=19493
Page 1 of 3

Author:  ElderProphet [ Tue Jun 19, 2007 11:42 am ]
Post subject: 

Say, I was chatting with Muss the other night, and whipped up a bubble finding script based off of the new getNearestWarps function in 2.04. It works reasonably fast in a 5k sector game, which is all I tested it in. The thought occured to me that basic bubble finding might make a great subject for another TWX scripting clinic.

Give a shout out if this is of interest to you. This is a bit more advanced than previous sessions, but the amount of material to go over will be minimal, leaving lots of time to answer questions, and digress into tangents.

And hey, if you don't have a basic knowledge of arrays or twx scripting, there will still be some short interludes of unmanaged mic access for open dialog, which in the past have offered glimpses of MisB's Joysey accent and Jester's comically-noisy keystrokes. Good times.

+EP+

Author:  LoneStar [ Tue Jun 19, 2007 12:06 pm ]
Post subject: 

ElderProphet wrote:
Say, I was chatting with Muss the other night, and whipped up a bubble finding script based off of the new getNearestWarps function in 2.04. It works reasonably fast in a 5k sector game, which is all I tested it in. The thought occured to me that basic bubble finding might make a great subject for another TWX scripting clinic.

Give a shout out if this is of interest to you. This is a bit more advanced than previous sessions, but the amount of material to go over will be minimal, leaving lots of time to answer questions, and digress into tangents.

And hey, if you don't have a basic knowledge of arrays or twx scripting, there will still be some short interludes of unmanaged mic access for open dialog, which in the past have offered glimpses of MisB's Joysey accent and Jester's comically-noisy keystrokes. Good times.

+EP+

Funny you should mention bubble finding script.. i've started working on one myself. I'm deffinately interested in participating if my schedule permits.
 

Author:  Singularity [ Tue Jun 19, 2007 12:14 pm ]
Post subject: 

I wrote this a while back...

Code:
setVar $file GAMENAME & "_bubble_gates.txt"
delete $file
getNearestWarps $terra_stack 1
setArray $checked SECTORS
setArray $bfsdone SECTORS
setVar $gate_idx 1
while ($gate_idx <= $terra_stack)
     setVar $gate_test $terra_stack[$gate_idx]
     if (SECTOR.WARPCOUNT[$gate_test] > 1) AND ($checked[$gate_test] = FALSE)
           setAvoid $gate_test
           setVar $bubble_loop_idx 1
           while ($bubble_loop_idx <= SECTOR.WARPCOUNT[$gate_test])
                setVar $bubble_test SECTOR.WARPS[$gate_test][$bubble_loop_idx]
                if (SECTOR.WARPCOUNT[$bubble_test] > 1) AND ($bfsdone[$bubble_test] = FALSE)
                      setVar $bfsdone[$bubble_test] TRUE
                     getNearestWarps $bubble_stack $bubble_test
                     if ($bubble_stack <= 300)
                            setVar $mark_idx 1
                            while ($mark_idx <= $bubble_stack)
                                 setVar $checked[$bubble_stack[$mark_idx]] TRUE
                                 setVar $bfsdone[$bubble_stack[$mark_idx]] TRUE
                                 add $mark_idx 1
                            end
                            write $file $gate_test
                       end
                end
                add $bubble_loop_idx 1
           end
           clearAvoid $gate_test
     end
     add $gate_idx 1
end


Which was fast in a 5k, but slow as dirt in a 20k. I'm sure it's improveable, but really most of this code could be made obsolete if we gave twxproxy a way to spit out it's bubble results into an array. I doubt there's a way to improve over native pointers.

Author:  Muss [ Tue Jun 19, 2007 12:38 pm ]
Post subject: 

Ive also found that the build in list of bubbles that twx gives out is not quite as accurate as a swath bubble list. I had Alieron come in an a game to run his swath version of a bubble list then compared it my twx generated list. Most results were the same.. although.. the largest bubble was not detected by twx. The swath version did pick it up though.

This is after I had explored all 20k sectors. Not just a ztm.

Im sure many know this.. but.. why?

Author:  Singularity [ Tue Jun 19, 2007 1:12 pm ]
Post subject: 

There's a max bubble setting in twxproxy you have to change if you want the larger bubbles. This is because larger bubble sizes take nearly exponential amounts of processing time... so setting it to just the size you need helps to reduce the processing time a lot.

Then there is, as you mentioned, the ztm. If that's a factor.

I don't think the twx proxy algo handles multiple doors, either. Swath's does.

Author:  LoneStar [ Tue Jun 19, 2007 1:49 pm ]
Post subject: 

Singularity wrote:
Which was fast in a 5k, but slow as dirt in a 20k. I'm sure it's improveable, but really most of this code could be made obsolete if we gave twxproxy a way to spit out it's bubble results into an array. I doubt there's a way to improve over native pointers.

Interesting approachl. will be intersting to compare routines when I get mine finished

Author:  Mind Dagger [ Tue Jun 19, 2007 9:59 pm ]
Post subject: 

I can't wait to do another one of these. The last one was a lot of fun to listen to.

MD

Author:  Muss [ Tue Jun 19, 2007 11:13 pm ]
Post subject: 

I usually have my max bubble size in Twx set to 500 or so. Seems to work well.. and Ive never seen anything much above 250 or so using twx.

Concerning a ztm.. last I used was ZTMSupG with middle passes set to the highest setting, which is 5 I believe.    

Any other ztm scripts that would give me a better reading?

Author:  ElderProphet [ Wed Jun 20, 2007 12:24 am ]
Post subject: 

Muss wrote:
Concerning a ztm.. last I used was ZTMSupG with middle passes set to the highest setting, which is 5 I believe.    

Any other ztm scripts that would give me a better reading?


None that are open source
But hey, maybe in a future script clinic...

Besides, to make a ZTM more accurate than rev's 6 pass method + one-way check, you need a bubble finder.

See, it's all connected. The bubble bone's connected to the... ztm bone. But the cheese stands alone.

+EP+

Author:  Cerne [ Wed Jun 20, 2007 1:19 am ]
Post subject: 

Prom's ZTM (14a, I think) is really accurate, I use it and the swath bubble checker.

Cerne

Author:  Singularity [ Wed Jun 20, 2007 2:57 pm ]
Post subject: 

Prome's is very similar to supg's in method. It still can miss certain warps tho.

EP, the reason I've wanted twxproxy to be able to dump out bubble info is to build a fast and accurate ztm. I rarely play 5k, so all of my tests are in 20k... and I have yet to find a decent way of testing for large bubbles in a 20k.

Author:  Xentropy [ Wed Jun 20, 2007 3:41 pm ]
Post subject: 

If anyone would know, it's you guys...
I assume TW uses A* (well, Dijkstra's to be exact, since there's really no heuristic for how close a sector is to another sector in a random mapping like this) to determine pathing, but if two paths are the same length, which does TW itself return?  Does it preference lowest sector number, highest sector number, does it appear entirely random, or is there some other pattern?

Author:  Singularity [ Wed Jun 20, 2007 3:53 pm ]
Post subject: 

No, simple breadth-first search. This can be easily emulated using an array that holds checked sectors. Mark off any avoids you have and it'll automatically find the shortest route between 2 points, that's what a BFS does.

It doesn't need to check all paths, if 2 paths are identical in distance to the destination then it'd go by the layout of the nodes, along the earliest set of edges (lowest doors first).

Author:  Xentropy [ Wed Jun 20, 2007 6:32 pm ]
Post subject: 

So preferences lower sector number.  Thanks.

Author:  Singularity [ Wed Jun 20, 2007 7:06 pm ]
Post subject: 

Well no, not neccessarily. It goes by order of doors, not destination sector number. Once it finds the first valid path (starting with the left most, lower most, door number on each sector it hits) the routine is done. Because in a BFS the first path you find will be the shortest possible path, it's done there. It might be possible for another path to be at the same distance tho, in that case (the one you asked about) it would simply pull out the first one it found.

Page 1 of 3 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/