Log in

View Full Version : [Code] Random waypoint generation



XtrmJosh
11-08-2013, 01:32 AM
Hi all,

It's been discussed a fair amount, and I feel it's high time we put some of this shit into practice. To get the ball rolling, here's a sample of how to use random waypoint generation:

First step, take your waypoint file and create several waypoint paths from A to B. You should do this for several sections of paths, and for any long distances you might need to travel. Bare in mind the "final" step of a path should be varied a lot on long walks, so pick 10-20 different tiles to land on at least, and you'll get a decent quantity of randomisation.

Between each of your "groups" of waypoints, each of which being a slightly different path from A to B, you should create a label in this format:

ToTown1
ToTown2
ToTown3

and so on, the number being at the end.

Now you can create a label before the groups, call it ToTown or something. In that label you can run code similar to this to "randomly" select a set of waypoints to follow:

if labelName == "ToTown" then
townRnd = math.random(1, 3)
Walker.GotoLabel("ToTown" .. townRnd)
end

After each set of waypoints you will need a second label, which should send the walker to the "next" waypoint after the variable waypoint path. This should be easy for any of you to do :)

This should get you started, please give it a crack folks, this could be a good method of evading detection for a large part. All the scripts I will produce from now on will use this method, and will contain numerous paths split over a variety of end tiles.

The fact is, we simply can't continue to ignore the deletions that are happening around us. We as a community need to work together and try to do something about it. If enough effort goes in, we should be able to see if there is any benefit from doing this.

Thanks
Josh

shadowseka
11-08-2013, 01:43 AM
This is cool man, a very good way to make the machine more "human" as posible but
Ok you mean this can be set in the waypoints/nodes or in a hunt?
wont affect like not getting the most exp/hr? or will it go to some random leaving nodes?

Thanks.

XtrmJosh
11-08-2013, 01:48 AM
This is cool man, a very good way to make the machine more "human" as posible but
Ok you mean this can be set in the waypoints/nodes or in a hunt?
wont affect like not getting the most exp/hr? or will it go to some random leaving nodes?

Thanks.

This will be very difficult to configure for existing scripts, as it will likely require both Lua and XBST editing. You'll need to create multiple groups of nodes, each group being assigned to a specific path from point A to B, then randomly select one of those using the code I posted above. The Lua will do random number generation, pay attention to the fact that math.random(min, max) selects a number from min to max inclusive (meaning it can select min, max, or any number in between the two).

Regarding exp/h, if anything this might increase it. The fact is when you take the same path, you cover less ground, and pull less mobs. When you begin to vary that path, depending on how drastic you are you may draw more monsters in, increasing the amount of the spawn you reach out to, also increasing the time one circle of the spawn takes. The increased time means more respawn the next time you circle, and the increased spawn coverage generally means you'll find more creatures. All in all, it's a win win situation, unless you happen to be hunting in a spawn where you can guarantee that you won't find any creatures off from a certain path (possible in caves such as rotworms, since the cave is too narrow for spawn to be outside of the regular catchment area.

Here's a sample from XBST and Lua:



<item text="ToShopRnd:" tag="255"/>
<item text="ToShopRnd1:" tag="255"/>
<item text="WNode (32831, 31247, 7)" tag="5"/>
<item text="WNode (32829, 31236, 7)" tag="5"/>
<item text="WNode (32817, 31234, 7)" tag="5"/>
<item text="WNode (32807, 31234, 7)" tag="5"/>
<item text="WNode (32797, 31234, 7)" tag="5"/>
<item text="!cdataread" tag="254"><![CDATA[Walker.GotoLabel("AtShopRnd")]]></item>
<item text="ToShopRnd2:" tag="255"/>
<item text="WNode (32828, 31254, 7)" tag="5"/>
<item text="WNode (32816, 31254, 7)" tag="5"/>
<item text="WNode (32806, 31254, 7)" tag="5"/>
<item text="WNode (32800, 31244, 7)" tag="5"/>
<item text="WNode (32793, 31233, 7)" tag="5"/>
<item text="!cdataread" tag="254"><![CDATA[Walker.GotoLabel("AtShopRnd")]]></item>
<item text="ToShopRnd3:" tag="255"/>
<item text="Node (32790, 31237, 7)" tag="0"/>
<item text="!cdataread" tag="254"><![CDATA[Walker.GotoLabel("AtShopRnd")]]></item>
<item text="ToShopRnd4:" tag="255"/>
<item text="Node (32789, 31237, 7)" tag="0"/>
<item text="!cdataread" tag="254"><![CDATA[Walker.GotoLabel("AtShopRnd")]]></item>
<item text="ToShopRnd5:" tag="255"/>
<item text="Node (32791, 31239, 7)" tag="0"/>
<item text="!cdataread" tag="254"><![CDATA[Walker.GotoLabel("AtShopRnd")]]></item>
<item text="ToShopRnd6:" tag="255"/>
<item text="Node (32790, 31240, 7)" tag="0"/>
<item text="!cdataread" tag="254"><![CDATA[Walker.GotoLabel("AtShopRnd")]]></item>
<item text="ToShopRnd7:" tag="255"/>
<item text="Node (32792, 31238, 7)" tag="0"/>
<item text="!cdataread" tag="254"><![CDATA[Walker.GotoLabel("AtShopRnd")]]></item>
<item text="AtShopRnd:" tag="255"/>


elseif (labelName == "ToShopRnd" then
shoprnd = math.random(1, 7)
print "Going to random shop spot number " .. shoprnd
Walker.GotoLabel("ToShopRnd" .. shoprnd)


And allow me to explain a little what happens here.

The walker reaches the waypoint "ToShopRnd", which triggers the Lua event above. At this point, a random number is generated between 1 and 7, it then prints the output to inform the end user which path will be taken, and Walker.GotoLabel sends the walker to the waypoint "ToShopRnd"..RandomNumber, where RandomNumber is the number between 1 and 7 which we have generated.

Pretty simple, right? Why the hell didn't anyone do it sooner? lol

dinmamma
11-08-2013, 02:24 AM
I have been doing it since it was first discussed on these forums, while I'm around atleast :D

Imo it's good for stairs/ladders/sewers where there are several possibilities.
I got a rook script which was the first I made with this "system" which was abit pain in the ass, as I had to make shitloads of double waypoints for each caving, as I wanted it to have 2 random spots in each, to avoid that the character would step on the same tile incase of no resp etc.

XtrmJosh
11-08-2013, 01:30 PM
I have been doing it since it was first discussed on these forums, while I'm around atleast :D

Imo it's good for stairs/ladders/sewers where there are several possibilities.
I got a rook script which was the first I made with this "system" which was abit pain in the ass, as I had to make shitloads of double waypoints for each caving, as I wanted it to have 2 random spots in each, to avoid that the character would step on the same tile incase of no resp etc.

Good to hear someone adapted it, I know it's been in the pipeline for a while but wasn't aware of it's implementation to date. Keep at it, I'm gonna try look into a generic system whereby you can simply declare a list in Lua, and it will scan it whenever a label is reached, then randomise that waypoint specifically based on that list. Would mean maybe 4-5 lines of code or so which can cover all randomisation...

dinmamma
11-08-2013, 06:56 PM
Good to hear someone adapted it, I know it's been in the pipeline for a while but wasn't aware of it's implementation to date. Keep at it, I'm gonna try look into a generic system whereby you can simply declare a list in Lua, and it will scan it whenever a label is reached, then randomise that waypoint specifically based on that list. Would mean maybe 4-5 lines of code or so which can cover all randomisation...

Sounds promising :)

Eion
11-09-2013, 01:09 PM
I have also been doing the same thing for about 6 months now. Every script I have made since then uses this method. I have yet to take a ban on these scripts with randomization. It also helps to not follow or be followed by another botter around the cave the entire time. :P

The only downfall is the time it takes to go back and place randomization into a script. You are much better off just rebuilding it from scratch.

kornik22
11-10-2013, 05:00 AM
The fact is, we simply can't continue to ignore the deletions that are happening around us. We as a community need to work together and try to do something about it. If enough effort goes in, we should be able to see if there is any benefit from doing this.

true

you might wanna check my thread, its basically about the same thing you are talking about, but from different angle, less time consuming and more efficient. Maybe you could help
http://forums.xenobot.net/showthread.php?19327-HELP-Dynamic-Node-Randomization

Hypn0ticKi11er
08-26-2014, 02:10 AM
Why make it so hard and create unnecessary labels, etc. Simplify it down, man.

Put a one-liner to choose the path (Walker.Goto("Path" .. tostring(math.random(1,5))) *This would be for 5 paths*
Then, put a label before each path.

Simple.
Nothing in your LUA file.
Enjoy :)
If examples are needed, I'll provide them.

and XtrmJosh :
What do you think? :)
And someone did in fact do it sooner. Just haven't released my new scripts yet :P