From 3194ffdab8d54723ad1546846c1d45472d6a8464 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 7 Aug 2013 08:01:59 -0700
Subject: Fixed incomplete commit r/23317 -- see_into_region. Put the guard
around estate bans also, and delete the obsolete config var.
---
OpenSim/Tools/Configger/ConfigurationLoader.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs
index 28bcc99..72ba185 100644
--- a/OpenSim/Tools/Configger/ConfigurationLoader.cs
+++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs
@@ -239,7 +239,6 @@ namespace OpenSim.Tools.Configger
config.Set("physics", "OpenDynamicsEngine");
config.Set("meshing", "Meshmerizer");
config.Set("physical_prim", true);
- config.Set("see_into_this_sim_from_neighbor", true);
config.Set("serverside_object_permissions", true);
config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
--
cgit v1.1
From e5b1688913d0fb9e72f67d0b476778a733ddb4b5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Aug 2013 18:48:18 +0100
Subject: Add none behaviour to pCampbot when one wants bots to just stand
around
---
OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs | 43 ++++++++++++++++++++++
OpenSim/Tools/pCampBot/BotManager.cs | 17 +++++----
OpenSim/Tools/pCampBot/pCampBot.cs | 7 ++--
3 files changed, 57 insertions(+), 10 deletions(-)
create mode 100644 OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
new file mode 100644
index 0000000..9cf8a54
--- /dev/null
+++ b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using OpenMetaverse;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using pCampBot.Interfaces;
+
+namespace pCampBot
+{
+ ///
+ /// Do nothing
+ ///
+ public class NoneBehaviour : AbstractBehaviour
+ {
+ public NoneBehaviour() { Name = "None"; }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index d615b3f..1a46380 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -177,18 +177,21 @@ namespace pCampBot
// We must give each bot its own list of instantiated behaviours since they store state.
List behaviours = new List();
- // Hard-coded for now
- if (behaviourSwitches.Contains("p"))
- behaviours.Add(new PhysicsBehaviour());
-
+ // Hard-coded for now
+ if (behaviourSwitches.Contains("c"))
+ behaviours.Add(new CrossBehaviour());
+
if (behaviourSwitches.Contains("g"))
behaviours.Add(new GrabbingBehaviour());
+
+ if (behaviourSwitches.Contains("n"))
+ behaviours.Add(new NoneBehaviour());
+
+ if (behaviourSwitches.Contains("p"))
+ behaviours.Add(new PhysicsBehaviour());
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
-
- if (behaviourSwitches.Contains("c"))
- behaviours.Add(new CrossBehaviour());
StartBot(this, behaviours, firstName, lastName, password, loginUri);
}
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 9e82577..2707a49 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -123,9 +123,10 @@ namespace pCampBot
" -password password for the bots\n" +
" -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" +
" current options are:\n" +
- " p (physics)\n" +
- " g (grab)\n" +
- " t (teleport)\n" +
+ " p (physics - bots constantly move and jump around)\n" +
+ " g (grab - bots randomly click prims whether set clickable or not)\n" +
+ " n (none - bots do nothing)\n" +
+ " t (teleport - bots regularly teleport between regions on the grid)\n" +
// " c (cross)" +
" -wear set appearance folder to load from (default: no)\n" +
" -h, -help show this message");
--
cgit v1.1
From c49ea491a3d081ff788cc33ca29030690db3a939 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 12 Aug 2013 22:49:17 +0100
Subject: Make show bots pCampbot console command print connected, connecting,
etc. bot totals at end.
---
OpenSim/Tools/pCampBot/BotManager.cs | 13 +++++++++++++
1 file changed, 13 insertions(+)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 1a46380..74bd36a 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -330,17 +330,30 @@ namespace pCampBot
string outputFormat = "{0,-30} {1, -30} {2,-14}";
MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status");
+ Dictionary totals = new Dictionary();
+ foreach (object o in Enum.GetValues(typeof(ConnectionState)))
+ totals[(ConnectionState)o] = 0;
+
lock (m_lBot)
{
foreach (Bot pb in m_lBot)
{
Simulator currentSim = pb.Client.Network.CurrentSim;
+ totals[pb.ConnectionState]++;
MainConsole.Instance.OutputFormat(
outputFormat,
pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState);
}
}
+
+ ConsoleDisplayList cdl = new ConsoleDisplayList();
+
+ foreach (KeyValuePair kvp in totals)
+ cdl.AddRow(kvp.Key, kvp.Value);
+
+
+ MainConsole.Instance.OutputFormat("\n{0}", cdl.ToString());
}
/*
--
cgit v1.1
From 5933f9448d839b9f6db391dedc493bb5cc951d66 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Aug 2013 23:54:50 +0100
Subject: Add a SendAgentUpdates setting to a new pCampbot.ini.example file
which can control whether bots send agent updates
pCampbot.ini.example is used by copying to pCampbot.ini, like other ini files
---
OpenSim/Tools/pCampBot/Bot.cs | 20 +-------------------
OpenSim/Tools/pCampBot/BotManager.cs | 35 ++++++++++++++++++++---------------
OpenSim/Tools/pCampBot/pCampBot.cs | 35 +++++++++++++++++++++++++++++------
3 files changed, 50 insertions(+), 40 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 9821180..c56d29b 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -64,11 +64,6 @@ namespace pCampBot
public BotManager Manager { get; private set; }
///
- /// Bot config, passed from BotManager.
- ///
- private IConfig startupConfig;
-
- ///
/// Behaviours implemented by this bot.
///
///
@@ -153,9 +148,6 @@ namespace pCampBot
LoginUri = loginUri;
Manager = bm;
- startupConfig = bm.Config;
- readconfig();
-
Behaviours = behaviours;
}
@@ -177,14 +169,6 @@ namespace pCampBot
}
///
- /// Read the Nini config and initialize
- ///
- public void readconfig()
- {
- wear = startupConfig.GetString("wear", "no");
- }
-
- ///
/// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes.
///
public void shutdown()
@@ -207,6 +191,7 @@ namespace pCampBot
Client.Settings.AVATAR_TRACKING = false;
Client.Settings.OBJECT_TRACKING = false;
Client.Settings.SEND_AGENT_THROTTLE = true;
+ Client.Settings.SEND_AGENT_UPDATES = false;
Client.Settings.SEND_PINGS = true;
Client.Settings.STORE_LAND_PATCHES = false;
Client.Settings.USE_ASSET_CACHE = false;
@@ -481,9 +466,6 @@ namespace pCampBot
public void Objects_NewPrim(object sender, PrimEventArgs args)
{
-// if (Name.EndsWith("4"))
-// throw new Exception("Aaargh");
-
Primitive prim = args.Prim;
if (prim != null)
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 74bd36a..16b02b9 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -63,6 +63,11 @@ namespace pCampBot
protected CommandConsole m_console;
///
+ /// Controls whether bots start out sending agent updates on connection.
+ ///
+ public bool BotsInitSendAgentUpdates { get; set; }
+
+ ///
/// Created bots, whether active or inactive.
///
protected List m_lBot;
@@ -73,11 +78,6 @@ namespace pCampBot
public Random Rng { get; private set; }
///
- /// Overall configuration.
- ///
- public IConfig Config { get; private set; }
-
- ///
/// Track the assets we have and have not received so we don't endlessly repeat requests.
///
public Dictionary AssetsReceived { get; private set; }
@@ -92,6 +92,8 @@ namespace pCampBot
///
public BotManager()
{
+ BotsInitSendAgentUpdates = true;
+
LoginDelay = DefaultLoginDelay;
Rng = new Random(Environment.TickCount);
@@ -148,18 +150,17 @@ namespace pCampBot
///
/// How many bots to start up
/// The configuration for the bots to use
- public void dobotStartup(int botcount, IConfig cs)
+ public void dobotStartup(int botcount, IConfig startupConfig)
{
- Config = cs;
-
- string firstName = cs.GetString("firstname");
- string lastNameStem = cs.GetString("lastname");
- string password = cs.GetString("password");
- string loginUri = cs.GetString("loginuri");
+ string firstName = startupConfig.GetString("firstname");
+ string lastNameStem = startupConfig.GetString("lastname");
+ string password = startupConfig.GetString("password");
+ string loginUri = startupConfig.GetString("loginuri");
+ string wearSetting = startupConfig.GetString("wear", "no");
HashSet behaviourSwitches = new HashSet();
Array.ForEach(
- cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
+ startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting {0} bots connecting to {1}, named {2} {3}_",
@@ -169,6 +170,7 @@ namespace pCampBot
lastNameStem);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay);
+ MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", BotsInitSendAgentUpdates);
for (int i = 0; i < botcount; i++)
{
@@ -193,7 +195,7 @@ namespace pCampBot
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
- StartBot(this, behaviours, firstName, lastName, password, loginUri);
+ StartBot(this, behaviours, firstName, lastName, password, loginUri, wearSetting);
}
}
@@ -226,15 +228,18 @@ namespace pCampBot
/// Last name
/// Password
/// Login URI
+ ///
public void StartBot(
BotManager bm, List behaviours,
- string firstName, string lastName, string password, string loginUri)
+ string firstName, string lastName, string password, string loginUri, string wearSetting)
{
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}",
firstName, lastName, string.Join(",", behaviours.ConvertAll(b => b.Name).ToArray()));
Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri);
+ pb.wear = wearSetting;
+ pb.Client.Settings.SEND_AGENT_UPDATES = BotsInitSendAgentUpdates;
pb.OnConnected += handlebotEvent;
pb.OnDisconnected += handlebotEvent;
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 2707a49..e43037d 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -26,6 +26,7 @@
*/
using System;
+using System.IO;
using System.Reflection;
using System.Threading;
using log4net;
@@ -50,28 +51,50 @@ namespace pCampBot
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ public const string ConfigFileName = "pCampbot.ini";
+
[STAThread]
public static void Main(string[] args)
{
XmlConfigurator.Configure();
- IConfig config = ParseConfig(args);
- if (config.Get("help") != null || config.Get("loginuri") == null)
+ IConfig commandLineConfig = ParseConfig(args);
+ if (commandLineConfig.Get("help") != null || commandLineConfig.Get("loginuri") == null)
{
Help();
}
- else if (config.Get("firstname") == null || config.Get("lastname") == null || config.Get("password") == null)
+ else if (
+ commandLineConfig.Get("firstname") == null
+ || commandLineConfig.Get("lastname") == null
+ || commandLineConfig.Get("password") == null)
{
Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots.");
}
else
{
- int botcount = config.GetInt("botcount", 1);
-
BotManager bm = new BotManager();
+ string iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), ConfigFileName));
+
+ if (File.Exists(iniFilePath))
+ {
+ m_log.InfoFormat("[PCAMPBOT]: Reading configuration settings from {0}", iniFilePath);
+
+ IConfigSource configSource = new IniConfigSource(iniFilePath);
+
+ IConfig botConfig = configSource.Configs["Bot"];
+
+ if (botConfig != null)
+ {
+ bm.BotsInitSendAgentUpdates
+ = botConfig.GetBoolean("SendAgentUpdates", bm.BotsInitSendAgentUpdates);
+ }
+ }
+
+ int botcount = commandLineConfig.GetInt("botcount", 1);
+
//startup specified number of bots. 1 is the default
- Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, config));
+ Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, commandLineConfig));
startBotThread.Name = "Initial start bots thread";
startBotThread.Start();
--
cgit v1.1
From 2146b201694a128764e66680d151b68d83610880 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Aug 2013 16:51:51 +0100
Subject: Add the ability to explicitly specify a login start location to
pCampbot via the -start parameter
---
OpenSim/Tools/pCampBot/Bot.cs | 7 +++--
OpenSim/Tools/pCampBot/BotManager.cs | 60 +++++++++++++++++++++++++++++++-----
OpenSim/Tools/pCampBot/pCampBot.cs | 36 ++++++++++++----------
3 files changed, 76 insertions(+), 27 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index c56d29b..79344e8 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -97,6 +97,8 @@ namespace pCampBot
public string Name { get; private set; }
public string Password { get; private set; }
public string LoginUri { get; private set; }
+ public string StartLocation { get; private set; }
+
public string saveDir;
public string wear;
@@ -132,7 +134,7 @@ namespace pCampBot
///
public Bot(
BotManager bm, List behaviours,
- string firstName, string lastName, string password, string loginUri)
+ string firstName, string lastName, string password, string startLocation, string loginUri)
{
ConnectionState = ConnectionState.Disconnected;
@@ -146,6 +148,7 @@ namespace pCampBot
Name = string.Format("{0} {1}", FirstName, LastName);
Password = password;
LoginUri = loginUri;
+ StartLocation = startLocation;
Manager = bm;
Behaviours = behaviours;
@@ -209,7 +212,7 @@ namespace pCampBot
ConnectionState = ConnectionState.Connecting;
- if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name"))
+ if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", StartLocation, "Your name"))
{
ConnectionState = ConnectionState.Connected;
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 16b02b9..57bd737 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -65,7 +65,7 @@ namespace pCampBot
///
/// Controls whether bots start out sending agent updates on connection.
///
- public bool BotsInitSendAgentUpdates { get; set; }
+ public bool InitBotSendAgentUpdates { get; set; }
///
/// Created bots, whether active or inactive.
@@ -92,7 +92,7 @@ namespace pCampBot
///
public BotManager()
{
- BotsInitSendAgentUpdates = true;
+ InitBotSendAgentUpdates = true;
LoginDelay = DefaultLoginDelay;
@@ -156,21 +156,25 @@ namespace pCampBot
string lastNameStem = startupConfig.GetString("lastname");
string password = startupConfig.GetString("password");
string loginUri = startupConfig.GetString("loginuri");
+ string startLocation = startupConfig.GetString("start", "last");
string wearSetting = startupConfig.GetString("wear", "no");
+ string startUri = ParseInputStartLocationToUri(startLocation);
+
HashSet behaviourSwitches = new HashSet();
Array.ForEach(
startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
MainConsole.Instance.OutputFormat(
- "[BOT MANAGER]: Starting {0} bots connecting to {1}, named {2} {3}_",
+ "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_",
botcount,
loginUri,
+ startUri,
firstName,
lastNameStem);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay);
- MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", BotsInitSendAgentUpdates);
+ MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates);
for (int i = 0; i < botcount; i++)
{
@@ -195,8 +199,47 @@ namespace pCampBot
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
- StartBot(this, behaviours, firstName, lastName, password, loginUri, wearSetting);
+ StartBot(this, behaviours, firstName, lastName, password, loginUri, startUri, wearSetting);
+ }
+ }
+
+ ///
+ /// Parses the command line start location to a start string/uri that the login mechanism will recognize.
+ ///
+ ///
+ /// The input start location to URI.
+ ///
+ ///
+ /// Start location.
+ ///
+ private string ParseInputStartLocationToUri(string startLocation)
+ {
+ if (startLocation == "home" || startLocation == "last")
+ return startLocation;
+
+ string regionName;
+
+ // Just a region name or only one (!) extra component. Like a viewer, we will stick 128/128/0 on the end
+ Vector3 startPos = new Vector3(128, 128, 0);
+
+ string[] startLocationComponents = startLocation.Split('/');
+
+ regionName = startLocationComponents[0];
+
+ if (startLocationComponents.Length >= 2)
+ {
+ float.TryParse(startLocationComponents[1], out startPos.X);
+
+ if (startLocationComponents.Length >= 3)
+ {
+ float.TryParse(startLocationComponents[2], out startPos.Y);
+
+ if (startLocationComponents.Length >= 4)
+ float.TryParse(startLocationComponents[3], out startPos.Z);
+ }
}
+
+ return string.Format("uri:{0}&{1}&{2}&{3}", regionName, startPos.X, startPos.Y, startPos.Z);
}
// ///
@@ -228,18 +271,19 @@ namespace pCampBot
/// Last name
/// Password
/// Login URI
+ /// Location to start the bot. Can be "last", "home" or a specific sim name.
///
public void StartBot(
BotManager bm, List behaviours,
- string firstName, string lastName, string password, string loginUri, string wearSetting)
+ string firstName, string lastName, string password, string loginUri, string startLocation, string wearSetting)
{
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}",
firstName, lastName, string.Join(",", behaviours.ConvertAll(b => b.Name).ToArray()));
- Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri);
+ Bot pb = new Bot(bm, behaviours, firstName, lastName, password, startLocation, loginUri);
pb.wear = wearSetting;
- pb.Client.Settings.SEND_AGENT_UPDATES = BotsInitSendAgentUpdates;
+ pb.Client.Settings.SEND_AGENT_UPDATES = InitBotSendAgentUpdates;
pb.OnConnected += handlebotEvent;
pb.OnDisconnected += handlebotEvent;
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index e43037d..9c9ed3b 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -86,8 +86,8 @@ namespace pCampBot
if (botConfig != null)
{
- bm.BotsInitSendAgentUpdates
- = botConfig.GetBoolean("SendAgentUpdates", bm.BotsInitSendAgentUpdates);
+ bm.InitBotSendAgentUpdates
+ = botConfig.GetBoolean("SendAgentUpdates", bm.InitBotSendAgentUpdates);
}
}
@@ -119,6 +119,7 @@ namespace pCampBot
cs.AddSwitch("Startup", "botcount", "n");
cs.AddSwitch("Startup", "loginuri", "l");
+ cs.AddSwitch("Startup", "start", "s");
cs.AddSwitch("Startup", "firstname");
cs.AddSwitch("Startup", "lastname");
cs.AddSwitch("Startup", "password");
@@ -137,22 +138,23 @@ namespace pCampBot
// name, to load an specific folder, or save, to save an avatar with some already existing wearables
// worn to the folder MyAppearance/FirstName_LastName, and the load it.
Console.WriteLine(
- "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +
- "Spawns a set of bots to test an OpenSim region\n\n" +
- " -l, -loginuri loginuri for sim to log into (required)\n" +
- " -n, -botcount number of bots to start (default: 1)\n" +
- " -firstname first name for the bots\n" +
- " -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n" +
- " -password password for the bots\n" +
- " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" +
- " current options are:\n" +
- " p (physics - bots constantly move and jump around)\n" +
- " g (grab - bots randomly click prims whether set clickable or not)\n" +
- " n (none - bots do nothing)\n" +
- " t (teleport - bots regularly teleport between regions on the grid)\n" +
+ "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n"
+ + "Spawns a set of bots to test an OpenSim region\n\n"
+ + " -l, -loginuri loginuri for grid/standalone (required)\n"
+ + " -s, -start start location for bots. Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
+ + " -n, -botcount number of bots to start (default: 1)\n"
+ + " -firstname first name for the bots\n"
+ + " -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n"
+ + " -password password for the bots\n"
+ + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n"
+ + " current options are:\n"
+ + " p (physics - bots constantly move and jump around)\n"
+ + " g (grab - bots randomly click prims whether set clickable or not)\n"
+ + " n (none - bots do nothing)\n"
+ + " t (teleport - bots regularly teleport between regions on the grid)\n"
// " c (cross)" +
- " -wear set appearance folder to load from (default: no)\n" +
- " -h, -help show this message");
+ + " -wear set appearance folder to load from (default: no)\n"
+ + " -h, -help show this message.\n");
}
}
}
--
cgit v1.1
From 3a62f39044403e7bf453c7b5b1fe825a48e908f3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Aug 2013 18:26:11 +0100
Subject: Add a -form switch to pCampbot to allow one to login a sequence of
bots starting from numbers other than 0
---
OpenSim/Tools/pCampBot/BotManager.cs | 3 ++-
OpenSim/Tools/pCampBot/pCampBot.cs | 9 ++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 57bd737..0fdfa0e 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -157,6 +157,7 @@ namespace pCampBot
string password = startupConfig.GetString("password");
string loginUri = startupConfig.GetString("loginuri");
string startLocation = startupConfig.GetString("start", "last");
+ int fromBotNumber = startupConfig.GetInt("from", 0);
string wearSetting = startupConfig.GetString("wear", "no");
string startUri = ParseInputStartLocationToUri(startLocation);
@@ -178,7 +179,7 @@ namespace pCampBot
for (int i = 0; i < botcount; i++)
{
- string lastName = string.Format("{0}_{1}", lastNameStem, i);
+ string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber);
// We must give each bot its own list of instantiated behaviours since they store state.
List behaviours = new List();
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 9c9ed3b..c8b6304 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -118,6 +118,7 @@ namespace pCampBot
ArgvConfigSource cs = new ArgvConfigSource(args);
cs.AddSwitch("Startup", "botcount", "n");
+ cs.AddSwitch("Startup", "from", "f");
cs.AddSwitch("Startup", "loginuri", "l");
cs.AddSwitch("Startup", "start", "s");
cs.AddSwitch("Startup", "firstname");
@@ -137,15 +138,17 @@ namespace pCampBot
// You can either say no, to not load anything, yes, to load one of the default wearables, a folder
// name, to load an specific folder, or save, to save an avatar with some already existing wearables
// worn to the folder MyAppearance/FirstName_LastName, and the load it.
+
Console.WriteLine(
"usage: pCampBot <-loginuri loginuri> [OPTIONS]\n"
+ "Spawns a set of bots to test an OpenSim region\n\n"
+ " -l, -loginuri loginuri for grid/standalone (required)\n"
- + " -s, -start start location for bots. Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
- + " -n, -botcount number of bots to start (default: 1)\n"
+ + " -s, -start optional start location for bots. Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
+ " -firstname first name for the bots\n"
+ " -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n"
+ " -password password for the bots\n"
+ + " -n, -botcount optional number of bots to start (default: 1)\n"
+ + " -f, -from optional starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0)"
+ " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n"
+ " current options are:\n"
+ " p (physics - bots constantly move and jump around)\n"
@@ -153,7 +156,7 @@ namespace pCampBot
+ " n (none - bots do nothing)\n"
+ " t (teleport - bots regularly teleport between regions on the grid)\n"
// " c (cross)" +
- + " -wear set appearance folder to load from (default: no)\n"
+ + " -wear optional folder from which to load appearance data, \"no\" if there is no such folder (default: no)\n"
+ " -h, -help show this message.\n");
}
}
--
cgit v1.1
From 97c514daa5a3b4e4137bf01b7bee3fffc13a75d7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Aug 2013 19:21:07 +0100
Subject: Shutdown a bot's actions by making it check for disconnecting state
rather than aborting the thread.
Aborting the thread appears to be causing shutdown issues.
---
OpenSim/Tools/pCampBot/Bot.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 79344e8..dac8ccb 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -158,7 +158,7 @@ namespace pCampBot
//add additional steps and/or things the bot should do
private void Action()
{
- while (true)
+ while (ConnectionState != ConnectionState.Disconnecting)
lock (Behaviours)
Behaviours.ForEach(
b =>
@@ -178,8 +178,8 @@ namespace pCampBot
{
ConnectionState = ConnectionState.Disconnecting;
- if (m_actionThread != null)
- m_actionThread.Abort();
+// if (m_actionThread != null)
+// m_actionThread.Abort();
Client.Network.Logout();
}
--
cgit v1.1
From 225cf0d0102d05721bd01120928b9d1d85c811a7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Aug 2013 19:53:10 +0100
Subject: Add pCampbot RequestObjectTextures ini setting to control whether
textures are requested for received objects.
---
OpenSim/Tools/pCampBot/BotManager.cs | 7 +++++++
OpenSim/Tools/pCampBot/pCampBot.cs | 2 ++
2 files changed, 9 insertions(+)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 0fdfa0e..5988584 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -68,6 +68,11 @@ namespace pCampBot
public bool InitBotSendAgentUpdates { get; set; }
///
+ /// Controls whether bots request textures for the object information they receive
+ ///
+ public bool InitBotRequestObjectTextures { get; set; }
+
+ ///
/// Created bots, whether active or inactive.
///
protected List m_lBot;
@@ -93,6 +98,7 @@ namespace pCampBot
public BotManager()
{
InitBotSendAgentUpdates = true;
+ InitBotRequestObjectTextures = true;
LoginDelay = DefaultLoginDelay;
@@ -176,6 +182,7 @@ namespace pCampBot
MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates);
+ MainConsole.Instance.OutputFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures);
for (int i = 0; i < botcount; i++)
{
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index c8b6304..b02f917 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -88,6 +88,8 @@ namespace pCampBot
{
bm.InitBotSendAgentUpdates
= botConfig.GetBoolean("SendAgentUpdates", bm.InitBotSendAgentUpdates);
+ bm.InitBotRequestObjectTextures
+ = botConfig.GetBoolean("RequestObjectTextures", bm.InitBotRequestObjectTextures);
}
}
--
cgit v1.1
From 2c67aa0f41193bf2271b75f060093f44819cdeae Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Aug 2013 21:07:29 +0100
Subject: If pCampbot has been asked to shutdown, don't carry on logging in
queued bots
---
OpenSim/Tools/pCampBot/BotManager.cs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 5988584..397a98e 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -52,6 +52,11 @@ namespace pCampBot
public const int DefaultLoginDelay = 5000;
///
+ /// True if pCampbot is in the process of shutting down.
+ ///
+ public bool ShuttingDown { get; private set; }
+
+ ///
/// Delay between logins of multiple bots.
///
/// TODO: This value needs to be configurable by a command line argument.
@@ -186,6 +191,9 @@ namespace pCampBot
for (int i = 0; i < botcount; i++)
{
+ if (ShuttingDown)
+ break;
+
string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber);
// We must give each bot its own list of instantiated behaviours since they store state.
@@ -363,7 +371,9 @@ namespace pCampBot
private void HandleShutdown(string module, string[] cmd)
{
- m_log.Info("[BOTMANAGER]: Shutting down bots");
+ MainConsole.Instance.Output("Shutting down");
+
+ ShuttingDown = true;
doBotShutdown();
}
--
cgit v1.1
From 5011c657b5b8127927c75c4e1db496c15a394b3a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Aug 2013 23:37:07 +0100
Subject: Actually implement the bot request object textures switch started in
225cf0d.
Forgot to propogate it down to bot level.
---
OpenSim/Tools/pCampBot/Bot.cs | 8 ++++++++
OpenSim/Tools/pCampBot/BotManager.cs | 1 +
2 files changed, 9 insertions(+)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index dac8ccb..32bf32b 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -59,6 +59,11 @@ namespace pCampBot
public delegate void AnEvent(Bot callbot, EventType someevent); // event delegate for bot events
///
+ /// Controls whether bots request textures for the object information they receive
+ ///
+ public bool RequestObjectTextures { get; set; }
+
+ ///
/// Bot manager.
///
public BotManager Manager { get; private set; }
@@ -469,6 +474,9 @@ namespace pCampBot
public void Objects_NewPrim(object sender, PrimEventArgs args)
{
+ if (!RequestObjectTextures)
+ return;
+
Primitive prim = args.Prim;
if (prim != null)
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 397a98e..dee02c3 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -300,6 +300,7 @@ namespace pCampBot
Bot pb = new Bot(bm, behaviours, firstName, lastName, password, startLocation, loginUri);
pb.wear = wearSetting;
pb.Client.Settings.SEND_AGENT_UPDATES = InitBotSendAgentUpdates;
+ pb.RequestObjectTextures = InitBotRequestObjectTextures;
pb.OnConnected += handlebotEvent;
pb.OnDisconnected += handlebotEvent;
--
cgit v1.1
From a90a5f52dd5f053a83a09fdd70ca08148ef641ce Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 19 Aug 2013 19:38:20 +0100
Subject: Show number of connections each bot has established in "show bots"
command.
---
OpenSim/Tools/pCampBot/Bot.cs | 15 ++++++++++++++-
OpenSim/Tools/pCampBot/BotManager.cs | 17 ++++++++++-------
2 files changed, 24 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 32bf32b..be7a5a1 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -97,6 +97,19 @@ namespace pCampBot
///
public ConnectionState ConnectionState { get; private set; }
+ ///
+ /// The number of connections that this bot has to different simulators.
+ ///
+ /// Includes both root and child connections.
+ public int ConnectionsCount
+ {
+ get
+ {
+ lock (Client.Network.Simulators)
+ return Client.Network.Simulators.Count;
+ }
+ }
+
public string FirstName { get; private set; }
public string LastName { get; private set; }
public string Name { get; private set; }
@@ -144,7 +157,7 @@ namespace pCampBot
ConnectionState = ConnectionState.Disconnected;
behaviours.ForEach(b => b.Initialize(this));
-
+
Client = new GridClient();
Random = new Random(Environment.TickCount);// We do stuff randomly here
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index dee02c3..8f31bdf 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -395,8 +395,11 @@ namespace pCampBot
private void HandleShowStatus(string module, string[] cmd)
{
- string outputFormat = "{0,-30} {1, -30} {2,-14}";
- MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status");
+ ConsoleDisplayTable cdt = new ConsoleDisplayTable();
+ cdt.AddColumn("Name", 30);
+ cdt.AddColumn("Region", 30);
+ cdt.AddColumn("Status", 14);
+ cdt.AddColumn("Connections", 11);
Dictionary totals = new Dictionary();
foreach (object o in Enum.GetValues(typeof(ConnectionState)))
@@ -409,19 +412,19 @@ namespace pCampBot
Simulator currentSim = pb.Client.Network.CurrentSim;
totals[pb.ConnectionState]++;
- MainConsole.Instance.OutputFormat(
- outputFormat,
- pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState);
+ cdt.AddRow(
+ pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.ConnectionsCount);
}
}
+ MainConsole.Instance.Output(cdt.ToString());
+
ConsoleDisplayList cdl = new ConsoleDisplayList();
foreach (KeyValuePair kvp in totals)
cdl.AddRow(kvp.Key, kvp.Value);
-
- MainConsole.Instance.OutputFormat("\n{0}", cdl.ToString());
+ MainConsole.Instance.Output(cdl.ToString());
}
/*
--
cgit v1.1
From 49b7cbda72cdaae8b5a7a89c94915851997b0b13 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 19 Aug 2013 20:29:17 +0100
Subject: Create a separate pCampbot "disconnect" console command which
disconnects connected bots.
"quit" console command now requires bots to be separate disconnected first before quitting.
This is to prepare the way for disconnecting/reconnecting different numbers of bots in a pCampbot session.
And hopefully resolves bug where console appears not to be reset if Environment.Exit(0) is called on a different thread
---
OpenSim/Tools/pCampBot/BotManager.cs | 110 +++++++++++++++++++++--------------
1 file changed, 67 insertions(+), 43 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 8f31bdf..5c0dc81 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -52,9 +52,9 @@ namespace pCampBot
public const int DefaultLoginDelay = 5000;
///
- /// True if pCampbot is in the process of shutting down.
+ /// Is pCampbot in the process of disconnecting bots?
///
- public bool ShuttingDown { get; private set; }
+ public bool DisconnectingBots { get; private set; }
///
/// Delay between logins of multiple bots.
@@ -139,6 +139,11 @@ namespace pCampBot
"Shutdown bots and exit",
HandleShutdown);
+ m_console.Commands.AddCommand("bot", false, "disconnect",
+ "disconnect",
+ "Disconnect all bots",
+ HandleDisconnect);
+
m_console.Commands.AddCommand("bot", false, "show regions",
"show regions",
"Show regions known to bots",
@@ -191,31 +196,37 @@ namespace pCampBot
for (int i = 0; i < botcount; i++)
{
- if (ShuttingDown)
- break;
+ lock (m_lBot)
+ {
+ if (DisconnectingBots)
+ break;
+
+ string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber);
- string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber);
+ // We must give each bot its own list of instantiated behaviours since they store state.
+ List behaviours = new List();
+
+ // Hard-coded for now
+ if (behaviourSwitches.Contains("c"))
+ behaviours.Add(new CrossBehaviour());
- // We must give each bot its own list of instantiated behaviours since they store state.
- List behaviours = new List();
-
- // Hard-coded for now
- if (behaviourSwitches.Contains("c"))
- behaviours.Add(new CrossBehaviour());
+ if (behaviourSwitches.Contains("g"))
+ behaviours.Add(new GrabbingBehaviour());
- if (behaviourSwitches.Contains("g"))
- behaviours.Add(new GrabbingBehaviour());
+ if (behaviourSwitches.Contains("n"))
+ behaviours.Add(new NoneBehaviour());
- if (behaviourSwitches.Contains("n"))
- behaviours.Add(new NoneBehaviour());
+ if (behaviourSwitches.Contains("p"))
+ behaviours.Add(new PhysicsBehaviour());
+
+ if (behaviourSwitches.Contains("t"))
+ behaviours.Add(new TeleportBehaviour());
- if (behaviourSwitches.Contains("p"))
- behaviours.Add(new PhysicsBehaviour());
-
- if (behaviourSwitches.Contains("t"))
- behaviours.Add(new TeleportBehaviour());
+ StartBot(this, behaviours, firstName, lastName, password, loginUri, startUri, wearSetting);
+ }
- StartBot(this, behaviours, firstName, lastName, password, loginUri, startUri, wearSetting);
+ // Stagger logins
+ Thread.Sleep(LoginDelay);
}
}
@@ -305,17 +316,13 @@ namespace pCampBot
pb.OnConnected += handlebotEvent;
pb.OnDisconnected += handlebotEvent;
- lock (m_lBot)
- m_lBot.Add(pb);
+ m_lBot.Add(pb);
Thread pbThread = new Thread(pb.startup);
pbThread.Name = pb.Name;
pbThread.IsBackground = true;
pbThread.Start();
-
- // Stagger logins
- Thread.Sleep(LoginDelay);
}
///
@@ -328,18 +335,16 @@ namespace pCampBot
switch (eventt)
{
case EventType.CONNECTED:
+ {
m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected");
break;
+ }
+
case EventType.DISCONNECTED:
+ {
m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected");
-
- lock (m_lBot)
- {
- if (m_lBot.TrueForAll(b => b.ConnectionState == ConnectionState.Disconnected))
- Environment.Exit(0);
-
- break;
- }
+ break;
+ }
}
}
@@ -349,15 +354,12 @@ namespace pCampBot
///
/// We launch each shutdown on its own thread so that a slow shutting down bot doesn't hold up all the others.
///
- public void doBotShutdown()
+ private void ShutdownBots()
{
- lock (m_lBot)
+ foreach (Bot bot in m_lBot)
{
- foreach (Bot bot in m_lBot)
- {
- Bot thisBot = bot;
- Util.FireAndForget(o => thisBot.shutdown());
- }
+ Bot thisBot = bot;
+ Util.FireAndForget(o => thisBot.shutdown());
}
}
@@ -370,12 +372,34 @@ namespace pCampBot
return new LocalConsole("pCampbot");
}
+ private void HandleDisconnect(string module, string[] cmd)
+ {
+ MainConsole.Instance.Output("Disconnecting bots");
+
+ lock (m_lBot)
+ {
+ DisconnectingBots = true;
+
+ ShutdownBots();
+ }
+ }
+
private void HandleShutdown(string module, string[] cmd)
{
+ lock (m_lBot)
+ {
+ int connectedBots = m_lBot.Count(b => b.ConnectionState == ConnectionState.Connected);
+
+ if (connectedBots > 0)
+ {
+ MainConsole.Instance.OutputFormat("Please disconnect {0} connected bots first", connectedBots);
+ return;
+ }
+ }
+
MainConsole.Instance.Output("Shutting down");
- ShuttingDown = true;
- doBotShutdown();
+ Environment.Exit(0);
}
private void HandleShowRegions(string module, string[] cmd)
--
cgit v1.1
From 2fa42f24fd0e80adc16320a404e3e85ca6d1baa1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 19 Aug 2013 21:00:31 +0100
Subject: Make it possible to disconnected a specified number of bots via the
pCampbot console command "disconnect []"
Bots disconnected are ascending from last in numeric order.
Temporarily no way to reconnect bots.
---
OpenSim/Tools/pCampBot/BotManager.cs | 101 +++++++++++++++++++----------------
1 file changed, 55 insertions(+), 46 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 5c0dc81..157c69c 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -80,7 +80,7 @@ namespace pCampBot
///
/// Created bots, whether active or inactive.
///
- protected List m_lBot;
+ protected List m_bots;
///
/// Random number generator.
@@ -130,35 +130,30 @@ namespace pCampBot
}
}
- m_console.Commands.AddCommand("bot", false, "shutdown",
- "shutdown",
- "Shutdown bots and exit", HandleShutdown);
+ m_console.Commands.AddCommand(
+ "bot", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);
- m_console.Commands.AddCommand("bot", false, "quit",
- "quit",
- "Shutdown bots and exit",
- HandleShutdown);
+ m_console.Commands.AddCommand(
+ "bot", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);
- m_console.Commands.AddCommand("bot", false, "disconnect",
- "disconnect",
- "Disconnect all bots",
- HandleDisconnect);
+ m_console.Commands.AddCommand(
+ "bot", false, "disconnect", "disconnect []", "Disconnect bots",
+ "Disconnecting bots will interupt any bot connection process, including connection on startup.\n"
+ + "If an is given, then the last connected bots by postfix number are disconnected.\n"
+ + "If no is given, then all currently connected bots are disconnected.",
+ HandleDisconnect);
- m_console.Commands.AddCommand("bot", false, "show regions",
- "show regions",
- "Show regions known to bots",
- HandleShowRegions);
+ m_console.Commands.AddCommand(
+ "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
- m_console.Commands.AddCommand("bot", false, "show bots",
- "show bots",
- "Shows the status of all bots",
- HandleShowStatus);
+ m_console.Commands.AddCommand(
+ "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowStatus);
// m_console.Commands.AddCommand("bot", false, "add bots",
// "add bots ",
// "Add more bots", HandleAddBots);
- m_lBot = new List();
+ m_bots = new List();
}
///
@@ -196,7 +191,7 @@ namespace pCampBot
for (int i = 0; i < botcount; i++)
{
- lock (m_lBot)
+ lock (m_bots)
{
if (DisconnectingBots)
break;
@@ -316,7 +311,7 @@ namespace pCampBot
pb.OnConnected += handlebotEvent;
pb.OnDisconnected += handlebotEvent;
- m_lBot.Add(pb);
+ m_bots.Add(pb);
Thread pbThread = new Thread(pb.startup);
pbThread.Name = pb.Name;
@@ -349,21 +344,6 @@ namespace pCampBot
}
///
- /// Shut down all bots
- ///
- ///
- /// We launch each shutdown on its own thread so that a slow shutting down bot doesn't hold up all the others.
- ///
- private void ShutdownBots()
- {
- foreach (Bot bot in m_lBot)
- {
- Bot thisBot = bot;
- Util.FireAndForget(o => thisBot.shutdown());
- }
- }
-
- ///
/// Standard CreateConsole routine
///
///
@@ -374,21 +354,50 @@ namespace pCampBot
private void HandleDisconnect(string module, string[] cmd)
{
- MainConsole.Instance.Output("Disconnecting bots");
-
- lock (m_lBot)
+ lock (m_bots)
{
+ int botsToDisconnect;
+ int connectedBots = m_bots.Count(b => b.ConnectionState == ConnectionState.Connected);
+
+ if (cmd.Length == 1)
+ {
+ botsToDisconnect = connectedBots;
+ }
+ else
+ {
+ if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[1], out botsToDisconnect))
+ return;
+
+ botsToDisconnect = Math.Min(botsToDisconnect, connectedBots);
+ }
+
DisconnectingBots = true;
- ShutdownBots();
+ MainConsole.Instance.OutputFormat("Disconnecting {0} bots", botsToDisconnect);
+
+ int disconnectedBots = 0;
+
+ for (int i = m_bots.Count - 1; i >= 0; i--)
+ {
+ if (disconnectedBots >= botsToDisconnect)
+ break;
+
+ Bot thisBot = m_bots[i];
+
+ if (thisBot.ConnectionState == ConnectionState.Connected)
+ {
+ Util.FireAndForget(o => thisBot.shutdown());
+ disconnectedBots++;
+ }
+ }
}
}
private void HandleShutdown(string module, string[] cmd)
{
- lock (m_lBot)
+ lock (m_bots)
{
- int connectedBots = m_lBot.Count(b => b.ConnectionState == ConnectionState.Connected);
+ int connectedBots = m_bots.Count(b => b.ConnectionState == ConnectionState.Connected);
if (connectedBots > 0)
{
@@ -429,9 +438,9 @@ namespace pCampBot
foreach (object o in Enum.GetValues(typeof(ConnectionState)))
totals[(ConnectionState)o] = 0;
- lock (m_lBot)
+ lock (m_bots)
{
- foreach (Bot pb in m_lBot)
+ foreach (Bot pb in m_bots)
{
Simulator currentSim = pb.Client.Network.CurrentSim;
totals[pb.ConnectionState]++;
--
cgit v1.1
From 079cd4e94f820bad83fcbf8373ef268ecb82d9a6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 19 Aug 2013 21:17:59 +0100
Subject: refactor: restructure pCampbot multi-bot connection code.
---
OpenSim/Tools/pCampBot/BotManager.cs | 70 ++++++++++++++++++++++++++++++------
1 file changed, 60 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 157c69c..2cbadef 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -98,6 +98,46 @@ namespace pCampBot
public Dictionary RegionsKnown { get; private set; }
///
+ /// First name for bots
+ ///
+ private string m_firstName;
+
+ ///
+ /// Last name stem for bots
+ ///
+ private string m_lastNameStem;
+
+ ///
+ /// Password for bots
+ ///
+ private string m_password;
+
+ ///
+ /// Login URI for bots.
+ ///
+ private string m_loginUri;
+
+ ///
+ /// Start location for bots.
+ ///
+ private string m_startUri;
+
+ ///
+ /// Postfix bot number at which bot sequence starts.
+ ///
+ private int m_fromBotNumber;
+
+ ///
+ /// Wear setting for bots.
+ ///
+ private string m_wearSetting;
+
+ ///
+ /// Behaviour switches for bots.
+ ///
+ private HashSet m_behaviourSwitches = new HashSet();
+
+ ///
/// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
///
public BotManager()
@@ -163,20 +203,26 @@ namespace pCampBot
/// The configuration for the bots to use
public void dobotStartup(int botcount, IConfig startupConfig)
{
- string firstName = startupConfig.GetString("firstname");
- string lastNameStem = startupConfig.GetString("lastname");
- string password = startupConfig.GetString("password");
- string loginUri = startupConfig.GetString("loginuri");
- string startLocation = startupConfig.GetString("start", "last");
- int fromBotNumber = startupConfig.GetInt("from", 0);
- string wearSetting = startupConfig.GetString("wear", "no");
+ m_firstName = startupConfig.GetString("firstname");
+ m_lastNameStem = startupConfig.GetString("lastname");
+ m_password = startupConfig.GetString("password");
+ m_loginUri = startupConfig.GetString("loginuri");
+ m_fromBotNumber = startupConfig.GetInt("from", 0);
+ m_wearSetting = startupConfig.GetString("wear", "no");
- string startUri = ParseInputStartLocationToUri(startLocation);
+ m_startUri = ParseInputStartLocationToUri(startupConfig.GetString("start", "last"));
- HashSet behaviourSwitches = new HashSet();
Array.ForEach(
- startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
+ startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => m_behaviourSwitches.Add(b));
+
+ ConnectBots(
+ botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches);
+ }
+ private void ConnectBots(
+ int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting,
+ HashSet behaviourSwitches)
+ {
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_",
botcount,
@@ -194,7 +240,11 @@ namespace pCampBot
lock (m_bots)
{
if (DisconnectingBots)
+ {
+ MainConsole.Instance.Output(
+ "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection");
break;
+ }
string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber);
--
cgit v1.1
From ea3f024b8a546608fce825d4aa9f165eaecfeed5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 19 Aug 2013 21:25:17 +0100
Subject: refactor: start bot connection thread within BotManager rather than
externally
---
OpenSim/Tools/pCampBot/BotManager.cs | 27 ++++++++++++++++++++++++++-
OpenSim/Tools/pCampBot/pCampBot.cs | 5 +----
2 files changed, 27 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 2cbadef..fe6048a 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -52,6 +52,11 @@ namespace pCampBot
public const int DefaultLoginDelay = 5000;
///
+ /// Is pCampbot in the process of connecting bots?
+ ///
+ public bool ConnectingBots { get; private set; }
+
+ ///
/// Is pCampbot in the process of disconnecting bots?
///
public bool DisconnectingBots { get; private set; }
@@ -219,7 +224,25 @@ namespace pCampBot
botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches);
}
- private void ConnectBots(
+ private bool ConnectBots(
+ int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting,
+ HashSet behaviourSwitches)
+ {
+ ConnectingBots = true;
+
+ Thread startBotThread
+ = new Thread(
+ o => ConnectBotsInternal(
+ botcount, firstName, lastNameStem, password, loginUri, startUri, fromBotNumber, wearSetting,
+ behaviourSwitches));
+
+ startBotThread.Name = "Bots connection thread";
+ startBotThread.Start();
+
+ return true;
+ }
+
+ private void ConnectBotsInternal(
int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting,
HashSet behaviourSwitches)
{
@@ -273,6 +296,8 @@ namespace pCampBot
// Stagger logins
Thread.Sleep(LoginDelay);
}
+
+ ConnectingBots = false;
}
///
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index b02f917..e58b130 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -95,10 +95,7 @@ namespace pCampBot
int botcount = commandLineConfig.GetInt("botcount", 1);
- //startup specified number of bots. 1 is the default
- Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, commandLineConfig));
- startBotThread.Name = "Initial start bots thread";
- startBotThread.Start();
+ bm.dobotStartup(botcount, commandLineConfig);
while (true)
{
--
cgit v1.1
From 589b1a2eaf9058c3577b17ae76580a79ba855978 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 19 Aug 2013 23:50:18 +0100
Subject: Make it possible to reconnect pCampbots with the console command
"connect []".
If no n is given then all available bots are connected
---
OpenSim/Tools/pCampBot/Bot.cs | 96 ++++++++++++++++++-------
OpenSim/Tools/pCampBot/BotManager.cs | 136 +++++++++++++++++++++--------------
OpenSim/Tools/pCampBot/pCampBot.cs | 3 +-
3 files changed, 155 insertions(+), 80 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index be7a5a1..f7af26e 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -158,8 +158,6 @@ namespace pCampBot
behaviours.ForEach(b => b.Initialize(this));
- Client = new GridClient();
-
Random = new Random(Environment.TickCount);// We do stuff randomly here
FirstName = firstName;
LastName = lastName;
@@ -170,6 +168,59 @@ namespace pCampBot
Manager = bm;
Behaviours = behaviours;
+
+ // Only calling for use as a template.
+ CreateLibOmvClient();
+ }
+
+ private void CreateLibOmvClient()
+ {
+ GridClient newClient = new GridClient();
+
+ if (Client != null)
+ {
+ newClient.Settings.LOGIN_SERVER = Client.Settings.LOGIN_SERVER;
+ newClient.Settings.ALWAYS_DECODE_OBJECTS = Client.Settings.ALWAYS_DECODE_OBJECTS;
+ newClient.Settings.AVATAR_TRACKING = Client.Settings.AVATAR_TRACKING;
+ newClient.Settings.OBJECT_TRACKING = Client.Settings.OBJECT_TRACKING;
+ newClient.Settings.SEND_AGENT_THROTTLE = Client.Settings.SEND_AGENT_THROTTLE;
+ newClient.Settings.SEND_AGENT_UPDATES = Client.Settings.SEND_AGENT_UPDATES;
+ newClient.Settings.SEND_PINGS = Client.Settings.SEND_PINGS;
+ newClient.Settings.STORE_LAND_PATCHES = Client.Settings.STORE_LAND_PATCHES;
+ newClient.Settings.USE_ASSET_CACHE = Client.Settings.USE_ASSET_CACHE;
+ newClient.Settings.MULTIPLE_SIMS = Client.Settings.MULTIPLE_SIMS;
+ newClient.Throttle.Asset = Client.Throttle.Asset;
+ newClient.Throttle.Land = Client.Throttle.Land;
+ newClient.Throttle.Task = Client.Throttle.Task;
+ newClient.Throttle.Texture = Client.Throttle.Texture;
+ newClient.Throttle.Wind = Client.Throttle.Wind;
+ newClient.Throttle.Total = Client.Throttle.Total;
+ }
+ else
+ {
+ newClient.Settings.LOGIN_SERVER = LoginUri;
+ newClient.Settings.ALWAYS_DECODE_OBJECTS = false;
+ newClient.Settings.AVATAR_TRACKING = false;
+ newClient.Settings.OBJECT_TRACKING = false;
+ newClient.Settings.SEND_AGENT_THROTTLE = true;
+ newClient.Settings.SEND_PINGS = true;
+ newClient.Settings.STORE_LAND_PATCHES = false;
+ newClient.Settings.USE_ASSET_CACHE = false;
+ newClient.Settings.MULTIPLE_SIMS = true;
+ newClient.Throttle.Asset = 100000;
+ newClient.Throttle.Land = 100000;
+ newClient.Throttle.Task = 100000;
+ newClient.Throttle.Texture = 100000;
+ newClient.Throttle.Wind = 100000;
+ newClient.Throttle.Total = 400000;
+ }
+
+ newClient.Network.LoginProgress += this.Network_LoginProgress;
+ newClient.Network.SimConnected += this.Network_SimConnected;
+ newClient.Network.Disconnected += this.Network_OnDisconnected;
+ newClient.Objects.ObjectUpdate += Objects_NewPrim;
+
+ Client = newClient;
}
//We do our actions here. This is where one would
@@ -192,7 +243,7 @@ namespace pCampBot
///
/// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes.
///
- public void shutdown()
+ public void Disconnect()
{
ConnectionState = ConnectionState.Disconnecting;
@@ -202,34 +253,27 @@ namespace pCampBot
Client.Network.Logout();
}
+ public void Connect()
+ {
+ Thread connectThread = new Thread(ConnectInternal);
+ connectThread.Name = Name;
+ connectThread.IsBackground = true;
+
+ connectThread.Start();
+ }
+
///
/// This is the bot startup loop.
///
- public void startup()
+ private void ConnectInternal()
{
- Client.Settings.LOGIN_SERVER = LoginUri;
- Client.Settings.ALWAYS_DECODE_OBJECTS = false;
- Client.Settings.AVATAR_TRACKING = false;
- Client.Settings.OBJECT_TRACKING = false;
- Client.Settings.SEND_AGENT_THROTTLE = true;
- Client.Settings.SEND_AGENT_UPDATES = false;
- Client.Settings.SEND_PINGS = true;
- Client.Settings.STORE_LAND_PATCHES = false;
- Client.Settings.USE_ASSET_CACHE = false;
- Client.Settings.MULTIPLE_SIMS = true;
- Client.Throttle.Asset = 100000;
- Client.Throttle.Land = 100000;
- Client.Throttle.Task = 100000;
- Client.Throttle.Texture = 100000;
- Client.Throttle.Wind = 100000;
- Client.Throttle.Total = 400000;
- Client.Network.LoginProgress += this.Network_LoginProgress;
- Client.Network.SimConnected += this.Network_SimConnected;
- Client.Network.Disconnected += this.Network_OnDisconnected;
- Client.Objects.ObjectUpdate += Objects_NewPrim;
-
ConnectionState = ConnectionState.Connecting;
+ // Current create a new client on each connect. libomv doesn't seem to process new sim
+ // information (e.g. EstablishAgentCommunication events) if connecting after a disceonnect with the same
+ // client
+ CreateLibOmvClient();
+
if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", StartLocation, "Your name"))
{
ConnectionState = ConnectionState.Connected;
@@ -474,6 +518,8 @@ namespace pCampBot
// || args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
// && OnDisconnected != null)
+
+
if (
(args.Reason == NetworkManager.DisconnectType.ClientInitiated
|| args.Reason == NetworkManager.DisconnectType.ServerInitiated
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index fe6048a..f40a84d 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -182,6 +182,12 @@ namespace pCampBot
"bot", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);
m_console.Commands.AddCommand(
+ "bot", false, "connect", "connect []", "Connect bots",
+ "If an is given, then the first disconnected bots by postfix number are connected.\n"
+ + "If no is given, then all currently disconnected bots are connected.",
+ HandleConnect);
+
+ m_console.Commands.AddCommand(
"bot", false, "disconnect", "disconnect []", "Disconnect bots",
"Disconnecting bots will interupt any bot connection process, including connection on startup.\n"
+ "If an is given, then the last connected bots by postfix number are disconnected.\n"
@@ -206,7 +212,7 @@ namespace pCampBot
///
/// How many bots to start up
/// The configuration for the bots to use
- public void dobotStartup(int botcount, IConfig startupConfig)
+ public void CreateBots(int botcount, IConfig startupConfig)
{
m_firstName = startupConfig.GetString("firstname");
m_lastNameStem = startupConfig.GetString("lastname");
@@ -220,39 +226,55 @@ namespace pCampBot
Array.ForEach(
startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => m_behaviourSwitches.Add(b));
- ConnectBots(
- botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches);
+ for (int i = 0; i < botcount; i++)
+ {
+ lock (m_bots)
+ {
+ string lastName = string.Format("{0}_{1}", m_lastNameStem, i + m_fromBotNumber);
+
+ // We must give each bot its own list of instantiated behaviours since they store state.
+ List behaviours = new List();
+
+ // Hard-coded for now
+ if (m_behaviourSwitches.Contains("c"))
+ behaviours.Add(new CrossBehaviour());
+
+ if (m_behaviourSwitches.Contains("g"))
+ behaviours.Add(new GrabbingBehaviour());
+
+ if (m_behaviourSwitches.Contains("n"))
+ behaviours.Add(new NoneBehaviour());
+
+ if (m_behaviourSwitches.Contains("p"))
+ behaviours.Add(new PhysicsBehaviour());
+
+ if (m_behaviourSwitches.Contains("t"))
+ behaviours.Add(new TeleportBehaviour());
+
+ CreateBot(this, behaviours, m_firstName, lastName, m_password, m_loginUri, m_startUri, m_wearSetting);
+ }
+ }
}
- private bool ConnectBots(
- int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting,
- HashSet behaviourSwitches)
+ public void ConnectBots(int botcount)
{
ConnectingBots = true;
- Thread startBotThread
- = new Thread(
- o => ConnectBotsInternal(
- botcount, firstName, lastNameStem, password, loginUri, startUri, fromBotNumber, wearSetting,
- behaviourSwitches));
-
- startBotThread.Name = "Bots connection thread";
- startBotThread.Start();
+ Thread connectBotThread = new Thread(o => ConnectBotsInternal(botcount));
- return true;
+ connectBotThread.Name = "Bots connection thread";
+ connectBotThread.Start();
}
- private void ConnectBotsInternal(
- int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting,
- HashSet behaviourSwitches)
+ private void ConnectBotsInternal(int botcount)
{
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_",
botcount,
- loginUri,
- startUri,
- firstName,
- lastNameStem);
+ m_loginUri,
+ m_startUri,
+ m_firstName,
+ m_lastNameStem);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates);
@@ -269,28 +291,7 @@ namespace pCampBot
break;
}
- string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber);
-
- // We must give each bot its own list of instantiated behaviours since they store state.
- List behaviours = new List();
-
- // Hard-coded for now
- if (behaviourSwitches.Contains("c"))
- behaviours.Add(new CrossBehaviour());
-
- if (behaviourSwitches.Contains("g"))
- behaviours.Add(new GrabbingBehaviour());
-
- if (behaviourSwitches.Contains("n"))
- behaviours.Add(new NoneBehaviour());
-
- if (behaviourSwitches.Contains("p"))
- behaviours.Add(new PhysicsBehaviour());
-
- if (behaviourSwitches.Contains("t"))
- behaviours.Add(new TeleportBehaviour());
-
- StartBot(this, behaviours, firstName, lastName, password, loginUri, startUri, wearSetting);
+ m_bots[i].Connect();
}
// Stagger logins
@@ -360,7 +361,7 @@ namespace pCampBot
// }
///
- /// This starts up the bot and stores the thread for the bot in the thread array
+ /// This creates a bot but does not start it.
///
///
/// Behaviours for this bot to perform.
@@ -370,12 +371,12 @@ namespace pCampBot
/// Login URI
/// Location to start the bot. Can be "last", "home" or a specific sim name.
///
- public void StartBot(
+ public void CreateBot(
BotManager bm, List behaviours,
string firstName, string lastName, string password, string loginUri, string startLocation, string wearSetting)
{
MainConsole.Instance.OutputFormat(
- "[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}",
+ "[BOT MANAGER]: Creating bot {0} {1}, behaviours are {2}",
firstName, lastName, string.Join(",", behaviours.ConvertAll(b => b.Name).ToArray()));
Bot pb = new Bot(bm, behaviours, firstName, lastName, password, startLocation, loginUri);
@@ -387,12 +388,6 @@ namespace pCampBot
pb.OnDisconnected += handlebotEvent;
m_bots.Add(pb);
-
- Thread pbThread = new Thread(pb.startup);
- pbThread.Name = pb.Name;
- pbThread.IsBackground = true;
-
- pbThread.Start();
}
///
@@ -427,6 +422,37 @@ namespace pCampBot
return new LocalConsole("pCampbot");
}
+ private void HandleConnect(string module, string[] cmd)
+ {
+ if (ConnectingBots)
+ {
+ MainConsole.Instance.Output("Still connecting bots. Please wait for previous process to complete.");
+ return;
+ }
+
+ lock (m_bots)
+ {
+ int botsToConnect;
+ int disconnectedBots = m_bots.Count(b => b.ConnectionState == ConnectionState.Disconnected);
+
+ if (cmd.Length == 1)
+ {
+ botsToConnect = disconnectedBots;
+ }
+ else
+ {
+ if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[1], out botsToConnect))
+ return;
+
+ botsToConnect = Math.Min(botsToConnect, disconnectedBots);
+ }
+
+ MainConsole.Instance.OutputFormat("Connecting {0} bots", botsToConnect);
+
+ ConnectBots(botsToConnect);
+ }
+ }
+
private void HandleDisconnect(string module, string[] cmd)
{
lock (m_bots)
@@ -461,10 +487,12 @@ namespace pCampBot
if (thisBot.ConnectionState == ConnectionState.Connected)
{
- Util.FireAndForget(o => thisBot.shutdown());
+ Util.FireAndForget(o => thisBot.Disconnect());
disconnectedBots++;
}
}
+
+ DisconnectingBots = false;
}
}
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index e58b130..ada39ee 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -95,7 +95,8 @@ namespace pCampBot
int botcount = commandLineConfig.GetInt("botcount", 1);
- bm.dobotStartup(botcount, commandLineConfig);
+ bm.CreateBots(botcount, commandLineConfig);
+ bm.ConnectBots(botcount);
while (true)
{
--
cgit v1.1
From a3dd7db4a341f34e0df5b7fa4bddda4049e50acd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Aug 2013 00:08:47 +0100
Subject: Add -connect (-c) switch to pCampbot command line options.
Now, bots will only connect at startup if this switch is specified.
If it is not specified, then a separate "connect" command is required on the pCampbot command line
---
OpenSim/Tools/pCampBot/pCampBot.cs | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index ada39ee..fc67398 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -94,9 +94,12 @@ namespace pCampBot
}
int botcount = commandLineConfig.GetInt("botcount", 1);
+ bool startConnected = commandLineConfig.Get("connect") != null;
bm.CreateBots(botcount, commandLineConfig);
- bm.ConnectBots(botcount);
+
+ if (startConnected)
+ bm.ConnectBots(botcount);
while (true)
{
@@ -117,6 +120,7 @@ namespace pCampBot
//Set up our nifty config.. thanks to nini
ArgvConfigSource cs = new ArgvConfigSource(args);
+ cs.AddSwitch("Startup", "connect", "c");
cs.AddSwitch("Startup", "botcount", "n");
cs.AddSwitch("Startup", "from", "f");
cs.AddSwitch("Startup", "loginuri", "l");
@@ -143,20 +147,21 @@ namespace pCampBot
"usage: pCampBot <-loginuri loginuri> [OPTIONS]\n"
+ "Spawns a set of bots to test an OpenSim region\n\n"
+ " -l, -loginuri loginuri for grid/standalone (required)\n"
- + " -s, -start optional start location for bots. Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
- + " -firstname first name for the bots\n"
- + " -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n"
- + " -password password for the bots\n"
- + " -n, -botcount optional number of bots to start (default: 1)\n"
- + " -f, -from optional starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0)"
- + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n"
+ + " -s, -start start location for bots (optional). Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
+ + " -firstname first name for the bots (required)\n"
+ + " -lastname lastname for the bots (required). Each lastname will have _ appended, e.g. Ima Bot_0\n"
+ + " -password password for the bots (required)\n"
+ + " -n, -botcount number of bots to start (default: 1) (optional)\n"
+ + " -f, -from starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0) (optional)\n"
+ + " -c, -connect connect all bots at startup (optional)\n"
+ + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p (required)\n"
+ " current options are:\n"
+ " p (physics - bots constantly move and jump around)\n"
+ " g (grab - bots randomly click prims whether set clickable or not)\n"
+ " n (none - bots do nothing)\n"
+ " t (teleport - bots regularly teleport between regions on the grid)\n"
-// " c (cross)" +
- + " -wear optional folder from which to load appearance data, \"no\" if there is no such folder (default: no)\n"
+// " c (cross)\n" +
+ + " -wear folder from which to load appearance data, \"no\" if there is no such folder (default: no) (optional)\n"
+ " -h, -help show this message.\n");
}
}
--
cgit v1.1
From 56d1d67a34bbd3e597168ab9bfa43be6a34e580a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Aug 2013 17:01:12 +0100
Subject: Add pCampbot console commands to sit all bots on ground and stand all
bots
---
OpenSim/Tools/pCampBot/Bot.cs | 24 ++++++++++++
OpenSim/Tools/pCampBot/BotManager.cs | 74 +++++++++++++-----------------------
2 files changed, 51 insertions(+), 47 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index f7af26e..27c086e 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -318,6 +318,30 @@ namespace pCampBot
}
}
+ ///
+ /// Sit this bot on the ground.
+ ///
+ public void SitOnGround()
+ {
+ if (ConnectionState == ConnectionState.Connected)
+ Client.Self.SitOnGround();
+ }
+
+ ///
+ /// Stand this bot
+ ///
+ public void Stand()
+ {
+ if (ConnectionState == ConnectionState.Connected)
+ {
+ // Unlike sit on ground, here libomv checks whether we have SEND_AGENT_UPDATES enabled.
+ bool prevUpdatesSetting = Client.Settings.SEND_AGENT_UPDATES;
+ Client.Settings.SEND_AGENT_UPDATES = true;
+ Client.Self.Stand();
+ Client.Settings.SEND_AGENT_UPDATES = prevUpdatesSetting;
+ }
+ }
+
public void SaveDefaultAppearance()
{
saveDir = "MyAppearance/" + FirstName + "_" + LastName;
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index f40a84d..f5b5256 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -195,14 +195,18 @@ namespace pCampBot
HandleDisconnect);
m_console.Commands.AddCommand(
- "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
+ "bot", false, "sit", "sit", "Sit all bots on the ground.",
+ HandleSit);
+
+ m_console.Commands.AddCommand(
+ "bot", false, "stand", "stand", "Stand all bots.",
+ HandleStand);
m_console.Commands.AddCommand(
- "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowStatus);
+ "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
-// m_console.Commands.AddCommand("bot", false, "add bots",
-// "add bots ",
-// "Add more bots", HandleAddBots);
+ m_console.Commands.AddCommand(
+ "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
m_bots = new List();
}
@@ -340,26 +344,6 @@ namespace pCampBot
return string.Format("uri:{0}&{1}&{2}&{3}", regionName, startPos.X, startPos.Y, startPos.Z);
}
-// ///
-// /// Add additional bots (and threads) to our bot pool
-// ///
-// /// How Many of them to add
-// public void addbots(int botcount)
-// {
-// int len = m_td.Length;
-// Thread[] m_td2 = new Thread[len + botcount];
-// for (int i = 0; i < len; i++)
-// {
-// m_td2[i] = m_td[i];
-// }
-// m_td = m_td2;
-// int newlen = len + botcount;
-// for (int i = len; i < newlen; i++)
-// {
-// startupBot(Config);
-// }
-// }
-
///
/// This creates a bot but does not start it.
///
@@ -496,6 +480,22 @@ namespace pCampBot
}
}
+ private void HandleSit(string module, string[] cmd)
+ {
+ lock (m_bots)
+ {
+ m_bots.ForEach(b => b.SitOnGround());
+ }
+ }
+
+ private void HandleStand(string module, string[] cmd)
+ {
+ lock (m_bots)
+ {
+ m_bots.ForEach(b => b.Stand());
+ }
+ }
+
private void HandleShutdown(string module, string[] cmd)
{
lock (m_bots)
@@ -529,7 +529,7 @@ namespace pCampBot
}
}
- private void HandleShowStatus(string module, string[] cmd)
+ private void HandleShowBotsStatus(string module, string[] cmd)
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Name", 30);
@@ -563,26 +563,6 @@ namespace pCampBot
MainConsole.Instance.Output(cdl.ToString());
}
- /*
- private void HandleQuit(string module, string[] cmd)
- {
- m_console.Warn("DANGER", "This should only be used to quit the program if you've already used the shutdown command and the program hasn't quit");
- Environment.Exit(0);
- }
- */
-//
-// private void HandleAddBots(string module, string[] cmd)
-// {
-// int newbots = 0;
-//
-// if (cmd.Length > 2)
-// {
-// Int32.TryParse(cmd[2], out newbots);
-// }
-// if (newbots > 0)
-// addbots(newbots);
-// }
-
internal void Grid_GridRegion(object o, GridRegionEventArgs args)
{
lock (RegionsKnown)
@@ -602,4 +582,4 @@ namespace pCampBot
}
}
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From a3e1b278a1d82e231f85bf0bf181ed79bbdaa7f2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Aug 2013 18:41:09 +0100
Subject: Add pCampbot "show bot" console command to show more detailed
information on a particular bot (e.g. what sims they are connected to)
---
OpenSim/Tools/pCampBot/Bot.cs | 11 +++++++-
OpenSim/Tools/pCampBot/BotManager.cs | 49 +++++++++++++++++++++++++++++++++++-
2 files changed, 58 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 27c086e..d418288 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -97,11 +97,20 @@ namespace pCampBot
///
public ConnectionState ConnectionState { get; private set; }
+ public List Simulators
+ {
+ get
+ {
+ lock (Client.Network.Simulators)
+ return new List(Client.Network.Simulators);
+ }
+ }
+
///
/// The number of connections that this bot has to different simulators.
///
/// Includes both root and child connections.
- public int ConnectionsCount
+ public int SimulatorsCount
{
get
{
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index f5b5256..303c8dd 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -208,6 +208,10 @@ namespace pCampBot
m_console.Commands.AddCommand(
"bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
+ m_console.Commands.AddCommand(
+ "bot", false, "show bot", "show bot ",
+ "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);
+
m_bots = new List();
}
@@ -549,7 +553,7 @@ namespace pCampBot
totals[pb.ConnectionState]++;
cdt.AddRow(
- pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.ConnectionsCount);
+ pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.SimulatorsCount);
}
}
@@ -563,6 +567,49 @@ namespace pCampBot
MainConsole.Instance.Output(cdl.ToString());
}
+ private void HandleShowBotStatus(string module, string[] cmd)
+ {
+ if (cmd.Length != 4)
+ {
+ MainConsole.Instance.Output("Usage: show bot ");
+ return;
+ }
+
+ string name = string.Format("{0} {1}", cmd[2], cmd[3]);
+
+ Bot bot;
+
+ lock (m_bots)
+ bot = m_bots.Find(b => b.Name == name);
+
+ if (bot == null)
+ {
+ MainConsole.Instance.Output("No bot found with name {0}", name);
+ return;
+ }
+
+ ConsoleDisplayList cdl = new ConsoleDisplayList();
+ cdl.AddRow("Name", bot.Name);
+ cdl.AddRow("Status", bot.ConnectionState);
+
+ Simulator currentSim = bot.Client.Network.CurrentSim;
+ cdl.AddRow("Region", currentSim != null ? currentSim.Name : "(none)");
+
+ List connectedSimulators = bot.Simulators;
+ List simulatorNames = connectedSimulators.ConvertAll(cs => cs.Name);
+ cdl.AddRow("Connections", string.Join(", ", simulatorNames));
+
+ MainConsole.Instance.Output(cdl.ToString());
+
+ MainConsole.Instance.Output("Settings");
+
+ ConsoleDisplayList statusCdl = new ConsoleDisplayList();
+ GridClient botClient = bot.Client;
+ statusCdl.AddRow("SEND_AGENT_UPDATES", botClient.Settings.SEND_AGENT_UPDATES);
+
+ MainConsole.Instance.Output(statusCdl.ToString());
+ }
+
internal void Grid_GridRegion(object o, GridRegionEventArgs args)
{
lock (RegionsKnown)
--
cgit v1.1
From 4a81465b91b6506200157f8679ae9192cd43b45f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Aug 2013 18:47:52 +0100
Subject: Fix build break from last commit a3e1b27 on mono 2.4.3
Looks like this level of mono doesn't have a string.Join() which will take a list rather than an array (or some implicit conversion isn't happening)
---
OpenSim/Tools/pCampBot/BotManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 303c8dd..13912ae 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -597,7 +597,7 @@ namespace pCampBot
List connectedSimulators = bot.Simulators;
List simulatorNames = connectedSimulators.ConvertAll(cs => cs.Name);
- cdl.AddRow("Connections", string.Join(", ", simulatorNames));
+ cdl.AddRow("Connections", string.Join(", ", simulatorNames.ToArray()));
MainConsole.Instance.Output(cdl.ToString());
--
cgit v1.1
From 66a7dc3a0de599068ea257cc2cefbbe4b95599c7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Aug 2013 20:12:14 +0100
Subject: In pCampbot, don't try and reconnect bots that are already connected
on console "connect" command
---
OpenSim/Tools/pCampBot/BotManager.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 13912ae..245c460 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -299,7 +299,8 @@ namespace pCampBot
break;
}
- m_bots[i].Connect();
+ if (m_bots[i].ConnectionState == ConnectionState.Disconnected)
+ m_bots[i].Connect();
}
// Stagger logins
--
cgit v1.1
From 51c7fb1969f4850750de4b37827e5e2e9d85f3e0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Aug 2013 23:11:05 +0100
Subject: Add "set bots" command to make it possible to set SEND_AGENT_UPDATES
on all bots whilst pCampbot is running
---
OpenSim/Tools/pCampBot/BotManager.cs | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 245c460..c335a6e 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -203,6 +203,9 @@ namespace pCampBot
HandleStand);
m_console.Commands.AddCommand(
+ "bot", false, "set bots", "set bots ", "Set a setting for all bots.", HandleSetBots);
+
+ m_console.Commands.AddCommand(
"bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
m_console.Commands.AddCommand(
@@ -519,6 +522,30 @@ namespace pCampBot
Environment.Exit(0);
}
+ private void HandleSetBots(string module, string[] cmd)
+ {
+ string key = cmd[2];
+ string rawValue = cmd[3];
+
+ if (key == "SEND_AGENT_UPDATES")
+ {
+ bool newSendAgentUpdatesSetting;
+
+ if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newSendAgentUpdatesSetting))
+ return;
+
+ MainConsole.Instance.OutputFormat(
+ "Setting SEND_AGENT_UPDATES to {0} for all bots", newSendAgentUpdatesSetting);
+
+ lock (m_bots)
+ m_bots.ForEach(b => b.Client.Settings.SEND_AGENT_UPDATES = newSendAgentUpdatesSetting);
+ }
+ else
+ {
+ MainConsole.Instance.Output("Error: Only setting currently available is SEND_AGENT_UPDATES");
+ }
+ }
+
private void HandleShowRegions(string module, string[] cmd)
{
string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}";
--
cgit v1.1
From 70f89ae65b09e9c2f0dc63cb416fea4cceb7dd13 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Aug 2013 23:43:33 +0100
Subject: Make it possible to adjust the pCampbot login delay via the
[BotManager] LoginDelay parameter of pCampbot.ini
---
OpenSim/Tools/pCampBot/pCampBot.cs | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index fc67398..aee5864 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -82,6 +82,13 @@ namespace pCampBot
IConfigSource configSource = new IniConfigSource(iniFilePath);
+ IConfig botManagerConfig = configSource.Configs["BotManager"];
+
+ if (botManagerConfig != null)
+ {
+ bm.LoginDelay = botManagerConfig.GetInt("LoginDelay", bm.LoginDelay);
+ }
+
IConfig botConfig = configSource.Configs["Bot"];
if (botConfig != null)
--
cgit v1.1
From 13556cf1296d3c928d6eb286a6a1c9058c9ab5e7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Aug 2013 23:49:19 +0100
Subject: Fix a further bug in pCampbot connect where ignoring already
connected bots was wrongly counted as a connect
Also, only sleep when we actually perform a connection
---
OpenSim/Tools/pCampBot/BotManager.cs | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index c335a6e..50a77ed 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -277,11 +277,11 @@ namespace pCampBot
connectBotThread.Start();
}
- private void ConnectBotsInternal(int botcount)
+ private void ConnectBotsInternal(int botCount)
{
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_",
- botcount,
+ botCount,
m_loginUri,
m_startUri,
m_firstName,
@@ -291,7 +291,9 @@ namespace pCampBot
MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures);
- for (int i = 0; i < botcount; i++)
+ int connectedBots = 0;
+
+ for (int i = 0; i < m_bots.Count; i++)
{
lock (m_bots)
{
@@ -303,11 +305,17 @@ namespace pCampBot
}
if (m_bots[i].ConnectionState == ConnectionState.Disconnected)
+ {
m_bots[i].Connect();
- }
+ connectedBots++;
- // Stagger logins
- Thread.Sleep(LoginDelay);
+ if (connectedBots >= botCount)
+ break;
+
+ // Stagger logins
+ Thread.Sleep(LoginDelay);
+ }
+ }
}
ConnectingBots = false;
--
cgit v1.1
From 050617ae0ec13075db36449e8e5a4616c8bcd96e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 23 Aug 2013 01:13:19 +0100
Subject: Make pCampbot "show bot" command take the bot number instead of the
full bot name
Shorter and can do this because bot names are uniform
---
OpenSim/Tools/pCampBot/BotManager.cs | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 50a77ed..5c3835b 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -212,7 +212,7 @@ namespace pCampBot
"bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
m_console.Commands.AddCommand(
- "bot", false, "show bot", "show bot ",
+ "bot", false, "show bot", "show bot ",
"Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);
m_bots = new List();
@@ -605,13 +605,18 @@ namespace pCampBot
private void HandleShowBotStatus(string module, string[] cmd)
{
- if (cmd.Length != 4)
+ if (cmd.Length != 3)
{
- MainConsole.Instance.Output("Usage: show bot ");
+ MainConsole.Instance.Output("Usage: show bot ");
return;
}
- string name = string.Format("{0} {1}", cmd[2], cmd[3]);
+ int botNumber;
+
+ if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, cmd[2], out botNumber))
+ return;
+
+ string name = string.Format("{0} {1}_{2}", m_firstName, m_lastNameStem, botNumber);
Bot bot;
--
cgit v1.1
From 1a623bb266e78c9dc2648038de7b67d81b5a417e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 23 Aug 2013 20:58:22 +0100
Subject: Rename pCampbot.ini -> pCampBot.ini (and example file) to be
consistent with other capitalizations of pCampBot
---
OpenSim/Tools/pCampBot/pCampBot.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index aee5864..781bb00 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -51,7 +51,7 @@ namespace pCampBot
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- public const string ConfigFileName = "pCampbot.ini";
+ public const string ConfigFileName = "pCampBot.ini";
[STAThread]
public static void Main(string[] args)
--
cgit v1.1
From 9c652079361f496c46640ed67e964ee6164ce06e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 17:07:57 +0100
Subject: Show behaviours of pCampbot bots in "show bots" and "show bot"
console commands
---
.../Tools/pCampBot/Behaviours/AbstractBehaviour.cs | 5 +++++
.../Tools/pCampBot/Behaviours/CrossBehaviour.cs | 6 +++++-
.../Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | 6 +++++-
OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs | 6 +++++-
.../Tools/pCampBot/Behaviours/PhysicsBehaviour.cs | 1 +
.../Tools/pCampBot/Behaviours/TeleportBehaviour.cs | 6 +++++-
OpenSim/Tools/pCampBot/BotManager.cs | 22 ++++++++++++++--------
OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs | 5 +++++
8 files changed, 45 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
index 9a9371d..66d5542 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
@@ -35,6 +35,11 @@ namespace pCampBot
{
public class AbstractBehaviour : IBehaviour
{
+ ///
+ /// Abbreviated name of this behaviour.
+ ///
+ public string AbbreviatedName { get; protected set; }
+
public string Name { get; protected set; }
public Bot Bot { get; protected set; }
diff --git a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
index 1e01c64..4d806fc 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
@@ -47,7 +47,11 @@ namespace pCampBot
public const int m_regionCrossingTimeout = 1000 * 60;
- public CrossBehaviour() { Name = "Cross"; }
+ public CrossBehaviour()
+ {
+ AbbreviatedName = "c";
+ Name = "Cross";
+ }
public override void Action()
{
diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
index 66a336a..6acc27d 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
@@ -41,7 +41,11 @@ namespace pCampBot
///
public class GrabbingBehaviour : AbstractBehaviour
{
- public GrabbingBehaviour() { Name = "Grabbing"; }
+ public GrabbingBehaviour()
+ {
+ AbbreviatedName = "g";
+ Name = "Grabbing";
+ }
public override void Action()
{
diff --git a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
index 9cf8a54..9a3075c 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
@@ -38,6 +38,10 @@ namespace pCampBot
///
public class NoneBehaviour : AbstractBehaviour
{
- public NoneBehaviour() { Name = "None"; }
+ public NoneBehaviour()
+ {
+ AbbreviatedName = "n";
+ Name = "None";
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
index daa7485..47b4d46 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
@@ -46,6 +46,7 @@ namespace pCampBot
public PhysicsBehaviour()
{
+ AbbreviatedName = "p";
Name = "Physics";
talkarray = readexcuses();
}
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
index fbb4e96..5f7edda 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
@@ -42,7 +42,11 @@ namespace pCampBot
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- public TeleportBehaviour() { Name = "Teleport"; }
+ public TeleportBehaviour()
+ {
+ AbbreviatedName = "t";
+ Name = "Teleport";
+ }
public override void Action()
{
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 5c3835b..35a24d1 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -572,10 +572,11 @@ namespace pCampBot
private void HandleShowBotsStatus(string module, string[] cmd)
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
- cdt.AddColumn("Name", 30);
- cdt.AddColumn("Region", 30);
- cdt.AddColumn("Status", 14);
- cdt.AddColumn("Connections", 11);
+ cdt.AddColumn("Name", 24);
+ cdt.AddColumn("Region", 24);
+ cdt.AddColumn("Status", 13);
+ cdt.AddColumn("Conns", 5);
+ cdt.AddColumn("Behaviours", 20);
Dictionary totals = new Dictionary();
foreach (object o in Enum.GetValues(typeof(ConnectionState)))
@@ -583,13 +584,17 @@ namespace pCampBot
lock (m_bots)
{
- foreach (Bot pb in m_bots)
+ foreach (Bot bot in m_bots)
{
- Simulator currentSim = pb.Client.Network.CurrentSim;
- totals[pb.ConnectionState]++;
+ Simulator currentSim = bot.Client.Network.CurrentSim;
+ totals[bot.ConnectionState]++;
cdt.AddRow(
- pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.SimulatorsCount);
+ bot.Name,
+ currentSim != null ? currentSim.Name : "(none)",
+ bot.ConnectionState,
+ bot.SimulatorsCount,
+ string.Join(",", bot.Behaviours.ConvertAll(behaviour => behaviour.AbbreviatedName)));
}
}
@@ -645,6 +650,7 @@ namespace pCampBot
MainConsole.Instance.Output("Settings");
ConsoleDisplayList statusCdl = new ConsoleDisplayList();
+ statusCdl.AddRow("Behaviours", string.Join(", ", bot.Behaviours.ConvertAll(b => b.Name)));
GridClient botClient = bot.Client;
statusCdl.AddRow("SEND_AGENT_UPDATES", botClient.Settings.SEND_AGENT_UPDATES);
diff --git a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
index 9c984be..f8a661b 100644
--- a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
@@ -32,6 +32,11 @@ namespace pCampBot.Interfaces
public interface IBehaviour
{
///
+ /// Abbreviated name of this behaviour.
+ ///
+ string AbbreviatedName { get; }
+
+ ///
/// Name of this behaviour.
///
string Name { get; }
--
cgit v1.1
From a89c56dcf1e2645554f8b81b6f1e517b829cc3a4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 17:53:29 +0100
Subject: Fix build break from last commit 9c65207. Mono 2.4 lacks
string.join(string, List), or some auto casting is missing
---
OpenSim/Tools/pCampBot/BotManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 35a24d1..7d4af13 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -594,7 +594,7 @@ namespace pCampBot
currentSim != null ? currentSim.Name : "(none)",
bot.ConnectionState,
bot.SimulatorsCount,
- string.Join(",", bot.Behaviours.ConvertAll(behaviour => behaviour.AbbreviatedName)));
+ string.Join(",", bot.Behaviours.ConvertAll(behaviour => behaviour.AbbreviatedName).ToArray()));
}
}
--
cgit v1.1
From 01cb8033a42514728835a18a38f2a18349e83638 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 17:55:20 +0100
Subject: And fix break in "show bot" from commit 9c65207
---
OpenSim/Tools/pCampBot/BotManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 7d4af13..3e446af 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -650,7 +650,7 @@ namespace pCampBot
MainConsole.Instance.Output("Settings");
ConsoleDisplayList statusCdl = new ConsoleDisplayList();
- statusCdl.AddRow("Behaviours", string.Join(", ", bot.Behaviours.ConvertAll(b => b.Name)));
+ statusCdl.AddRow("Behaviours", string.Join(", ", bot.Behaviours.ConvertAll(b => b.Name).ToArray()));
GridClient botClient = bot.Client;
statusCdl.AddRow("SEND_AGENT_UPDATES", botClient.Settings.SEND_AGENT_UPDATES);
--
cgit v1.1
From 9bd62715704685738c55c6de8127b16cc6695bdb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 18:51:55 +0100
Subject: Add ability to adjust pCampbot bot behaviours whilst running with
"add behaviour " console commad
---
OpenSim/Tools/pCampBot/Bot.cs | 51 ++++++++----
OpenSim/Tools/pCampBot/BotManager.cs | 147 ++++++++++++++++++++++++++++-------
2 files changed, 157 insertions(+), 41 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index d418288..6037516 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -72,9 +72,10 @@ namespace pCampBot
/// Behaviours implemented by this bot.
///
///
- /// Lock this list before manipulating it.
+ /// Indexed by abbreviated name. There can only be one instance of a particular behaviour.
+ /// Lock this structure before manipulating it.
///
- public List Behaviours { get; private set; }
+ public Dictionary Behaviours { get; private set; }
///
/// Objects that the bot has discovered.
@@ -165,8 +166,6 @@ namespace pCampBot
{
ConnectionState = ConnectionState.Disconnected;
- behaviours.ForEach(b => b.Initialize(this));
-
Random = new Random(Environment.TickCount);// We do stuff randomly here
FirstName = firstName;
LastName = lastName;
@@ -176,12 +175,31 @@ namespace pCampBot
StartLocation = startLocation;
Manager = bm;
- Behaviours = behaviours;
+
+ Behaviours = new Dictionary();
+ foreach (IBehaviour behaviour in behaviours)
+ AddBehaviour(behaviour);
// Only calling for use as a template.
CreateLibOmvClient();
}
+ public bool AddBehaviour(IBehaviour behaviour)
+ {
+ lock (Behaviours)
+ {
+ if (!Behaviours.ContainsKey(behaviour.AbbreviatedName))
+ {
+ behaviour.Initialize(this);
+ Behaviours.Add(behaviour.AbbreviatedName, behaviour);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
private void CreateLibOmvClient()
{
GridClient newClient = new GridClient();
@@ -237,16 +255,21 @@ namespace pCampBot
private void Action()
{
while (ConnectionState != ConnectionState.Disconnecting)
+ {
lock (Behaviours)
- Behaviours.ForEach(
- b =>
- {
- Thread.Sleep(Random.Next(3000, 10000));
-
- // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
- b.Action();
- }
- );
+ {
+ foreach (IBehaviour behaviour in Behaviours.Values)
+ {
+ Thread.Sleep(Random.Next(3000, 10000));
+
+ // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
+ behaviour.Action();
+ }
+ }
+
+ // XXX: This is a really shitty way of yielding so that behaviours can be added/removed
+ Thread.Sleep(100);
+ }
}
///
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 3e446af..51c5ff4 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -140,7 +140,7 @@ namespace pCampBot
///
/// Behaviour switches for bots.
///
- private HashSet m_behaviourSwitches = new HashSet();
+ private HashSet m_defaultBehaviourSwitches = new HashSet();
///
/// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
@@ -195,6 +195,18 @@ namespace pCampBot
HandleDisconnect);
m_console.Commands.AddCommand(
+ "bot", false, "add behaviour", "add behaviour ",
+ "Add a behaviour to a bot",
+ "Can be performed on connected or disconnected bots.",
+ HandleAddBehaviour);
+
+// m_console.Commands.AddCommand(
+// "bot", false, "remove behaviour", "remove behaviour ",
+// "Remove a behaviour from a bot",
+// "Can be performed on connected or disconnected bots.",
+// HandleRemoveBehaviour);
+
+ m_console.Commands.AddCommand(
"bot", false, "sit", "sit", "Sit all bots on the ground.",
HandleSit);
@@ -235,7 +247,7 @@ namespace pCampBot
m_startUri = ParseInputStartLocationToUri(startupConfig.GetString("start", "last"));
Array.ForEach(
- startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => m_behaviourSwitches.Add(b));
+ startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => m_defaultBehaviourSwitches.Add(b));
for (int i = 0; i < botcount; i++)
{
@@ -243,28 +255,50 @@ namespace pCampBot
{
string lastName = string.Format("{0}_{1}", m_lastNameStem, i + m_fromBotNumber);
- // We must give each bot its own list of instantiated behaviours since they store state.
- List behaviours = new List();
-
- // Hard-coded for now
- if (m_behaviourSwitches.Contains("c"))
- behaviours.Add(new CrossBehaviour());
+ CreateBot(
+ this,
+ CreateBehavioursFromAbbreviatedNames(m_defaultBehaviourSwitches),
+ m_firstName, lastName, m_password, m_loginUri, m_startUri, m_wearSetting);
+ }
+ }
+ }
+
+ private List CreateBehavioursFromAbbreviatedNames(HashSet abbreviatedNames)
+ {
+ // We must give each bot its own list of instantiated behaviours since they store state.
+ List behaviours = new List();
+
+ // Hard-coded for now
+ foreach (string abName in abbreviatedNames)
+ {
+ IBehaviour newBehaviour = null;
+
+ if (abName == "c")
+ newBehaviour = new CrossBehaviour();
+
+ if (abName == "g")
+ newBehaviour = new GrabbingBehaviour();
- if (m_behaviourSwitches.Contains("g"))
- behaviours.Add(new GrabbingBehaviour());
+ if (abName == "n")
+ newBehaviour = new NoneBehaviour();
- if (m_behaviourSwitches.Contains("n"))
- behaviours.Add(new NoneBehaviour());
+ if (abName == "p")
+ newBehaviour = new PhysicsBehaviour();
- if (m_behaviourSwitches.Contains("p"))
- behaviours.Add(new PhysicsBehaviour());
-
- if (m_behaviourSwitches.Contains("t"))
- behaviours.Add(new TeleportBehaviour());
+ if (abName == "t")
+ newBehaviour = new TeleportBehaviour();
- CreateBot(this, behaviours, m_firstName, lastName, m_password, m_loginUri, m_startUri, m_wearSetting);
+ if (newBehaviour != null)
+ {
+ behaviours.Add(newBehaviour);
+ }
+ else
+ {
+ MainConsole.Instance.OutputFormat("No behaviour with abbreviated name {0} found", abName);
}
}
+
+ return behaviours;
}
public void ConnectBots(int botcount)
@@ -453,6 +487,44 @@ namespace pCampBot
}
}
+ private void HandleAddBehaviour(string module, string[] cmd)
+ {
+ if (cmd.Length != 4)
+ {
+ MainConsole.Instance.OutputFormat("Usage: add behaviour ");
+ return;
+ }
+
+ string rawBehaviours = cmd[2];
+ int botNumber;
+
+ if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[3], out botNumber))
+ return;
+
+ Bot bot = GetBotFromNumber(botNumber);
+
+ if (bot == null)
+ {
+ MainConsole.Instance.OutputFormat("Error: No bot found with number {0}", botNumber);
+ return;
+ }
+
+ HashSet rawAbbreviatedSwitchesToAdd = new HashSet();
+ Array.ForEach(rawBehaviours.Split(new char[] { ',' }), b => rawAbbreviatedSwitchesToAdd.Add(b));
+
+ List behavioursAdded = new List();
+
+ foreach (IBehaviour behaviour in CreateBehavioursFromAbbreviatedNames(rawAbbreviatedSwitchesToAdd))
+ {
+ if (bot.AddBehaviour(behaviour))
+ behavioursAdded.Add(behaviour);
+ }
+
+ MainConsole.Instance.OutputFormat(
+ "Added behaviours {0} to bot {1}",
+ string.Join(", ", behavioursAdded.ConvertAll(b => b.Name).ToArray()), bot.Name);
+ }
+
private void HandleDisconnect(string module, string[] cmd)
{
lock (m_bots)
@@ -594,7 +666,7 @@ namespace pCampBot
currentSim != null ? currentSim.Name : "(none)",
bot.ConnectionState,
bot.SimulatorsCount,
- string.Join(",", bot.Behaviours.ConvertAll(behaviour => behaviour.AbbreviatedName).ToArray()));
+ string.Join(",", bot.Behaviours.Keys.ToArray()));
}
}
@@ -621,16 +693,11 @@ namespace pCampBot
if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, cmd[2], out botNumber))
return;
- string name = string.Format("{0} {1}_{2}", m_firstName, m_lastNameStem, botNumber);
-
- Bot bot;
-
- lock (m_bots)
- bot = m_bots.Find(b => b.Name == name);
+ Bot bot = GetBotFromNumber(botNumber);
if (bot == null)
{
- MainConsole.Instance.Output("No bot found with name {0}", name);
+ MainConsole.Instance.OutputFormat("Error: No bot found with number {0}", botNumber);
return;
}
@@ -650,13 +717,39 @@ namespace pCampBot
MainConsole.Instance.Output("Settings");
ConsoleDisplayList statusCdl = new ConsoleDisplayList();
- statusCdl.AddRow("Behaviours", string.Join(", ", bot.Behaviours.ConvertAll(b => b.Name).ToArray()));
+
+ statusCdl.AddRow(
+ "Behaviours",
+ string.Join(", ", bot.Behaviours.Values.ToList().ConvertAll(b => b.Name).ToArray()));
+
GridClient botClient = bot.Client;
statusCdl.AddRow("SEND_AGENT_UPDATES", botClient.Settings.SEND_AGENT_UPDATES);
MainConsole.Instance.Output(statusCdl.ToString());
}
+ ///
+ /// Get a specific bot from its number.
+ ///
+ /// null if no bot was found
+ ///
+ private Bot GetBotFromNumber(int botNumber)
+ {
+ string name = GenerateBotNameFromNumber(botNumber);
+
+ Bot bot;
+
+ lock (m_bots)
+ bot = m_bots.Find(b => b.Name == name);
+
+ return bot;
+ }
+
+ private string GenerateBotNameFromNumber(int botNumber)
+ {
+ return string.Format("{0} {1}_{2}", m_firstName, m_lastNameStem, botNumber);
+ }
+
internal void Grid_GridRegion(object o, GridRegionEventArgs args)
{
lock (RegionsKnown)
--
cgit v1.1
From 1a2627031d8a80b1d5e21fd2d13e4dc2b123c0b4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 19:05:54 +0100
Subject: Add pCampbot "remove behaviour" console command for removing bot
behaviours during operation.
Doesn't currently work very well as stopping physics, for instance, can leave bot travelling in old direction
---
OpenSim/Tools/pCampBot/Bot.cs | 12 ++++++++
OpenSim/Tools/pCampBot/BotManager.cs | 53 ++++++++++++++++++++++++++++++++----
2 files changed, 60 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 6037516..0bd8151 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -184,6 +184,12 @@ namespace pCampBot
CreateLibOmvClient();
}
+ public bool TryGetBehaviour(string abbreviatedName, out IBehaviour behaviour)
+ {
+ lock (Behaviours)
+ return Behaviours.TryGetValue(abbreviatedName, out behaviour);
+ }
+
public bool AddBehaviour(IBehaviour behaviour)
{
lock (Behaviours)
@@ -200,6 +206,12 @@ namespace pCampBot
return false;
}
+ public bool RemoveBehaviour(string abbreviatedName)
+ {
+ lock (Behaviours)
+ return Behaviours.Remove(abbreviatedName);
+ }
+
private void CreateLibOmvClient()
{
GridClient newClient = new GridClient();
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 51c5ff4..6433c2e 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -200,11 +200,11 @@ namespace pCampBot
"Can be performed on connected or disconnected bots.",
HandleAddBehaviour);
-// m_console.Commands.AddCommand(
-// "bot", false, "remove behaviour", "remove behaviour ",
-// "Remove a behaviour from a bot",
-// "Can be performed on connected or disconnected bots.",
-// HandleRemoveBehaviour);
+ m_console.Commands.AddCommand(
+ "bot", false, "remove behaviour", "remove behaviour ",
+ "Remove a behaviour from a bot",
+ "Can be performed on connected or disconnected bots.",
+ HandleRemoveBehaviour);
m_console.Commands.AddCommand(
"bot", false, "sit", "sit", "Sit all bots on the ground.",
@@ -525,6 +525,49 @@ namespace pCampBot
string.Join(", ", behavioursAdded.ConvertAll(b => b.Name).ToArray()), bot.Name);
}
+ private void HandleRemoveBehaviour(string module, string[] cmd)
+ {
+ if (cmd.Length != 4)
+ {
+ MainConsole.Instance.OutputFormat("Usage: remove behaviour ");
+ return;
+ }
+
+ string rawBehaviours = cmd[2];
+ int botNumber;
+
+ if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[3], out botNumber))
+ return;
+
+ Bot bot = GetBotFromNumber(botNumber);
+
+ if (bot == null)
+ {
+ MainConsole.Instance.OutputFormat("Error: No bot found with number {0}", botNumber);
+ return;
+ }
+
+ HashSet abbreviatedBehavioursToRemove = new HashSet();
+ List behavioursRemoved = new List();
+
+ Array.ForEach(rawBehaviours.Split(new char[] { ',' }), b => abbreviatedBehavioursToRemove.Add(b));
+
+ foreach (string b in abbreviatedBehavioursToRemove)
+ {
+ IBehaviour behaviour;
+
+ if (bot.TryGetBehaviour(b, out behaviour))
+ {
+ bot.RemoveBehaviour(b);
+ behavioursRemoved.Add(behaviour);
+ }
+ }
+
+ MainConsole.Instance.OutputFormat(
+ "Removed behaviours {0} to bot {1}",
+ string.Join(", ", behavioursRemoved.ConvertAll(b => b.Name).ToArray()), bot.Name);
+ }
+
private void HandleDisconnect(string module, string[] cmd)
{
lock (m_bots)
--
cgit v1.1
From 3dbe7313d1c3fc28f0642531fbb6e238a98ac821 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 19:33:17 +0100
Subject: Add Close() method to IBehaviour to allow behaviours to cleanup when
removed or bot it disconnected.
In this case, it is used to turn off jump when physics testing behaviour is removed.
---
OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs | 2 ++
OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs | 5 +++++
OpenSim/Tools/pCampBot/Bot.cs | 16 +++++++++++++++-
OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs | 8 ++++++++
4 files changed, 30 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
index 66d5542..9bc8512 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
@@ -50,5 +50,7 @@ namespace pCampBot
{
Bot = bot;
}
+
+ public virtual void Close() {}
}
}
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
index 47b4d46..65a7c90 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
@@ -78,6 +78,11 @@ namespace pCampBot
Bot.Client.Self.Chat(randomf, 0, ChatType.Normal);
}
+ public override void Close()
+ {
+ Bot.Client.Self.Jump(false);
+ }
+
private string[] readexcuses()
{
string allexcuses = "";
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 0bd8151..f871b77 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -209,7 +209,17 @@ namespace pCampBot
public bool RemoveBehaviour(string abbreviatedName)
{
lock (Behaviours)
- return Behaviours.Remove(abbreviatedName);
+ {
+ IBehaviour behaviour;
+
+ if (!Behaviours.TryGetValue(abbreviatedName, out behaviour))
+ return false;
+
+ behaviour.Close();
+ Behaviours.Remove(abbreviatedName);
+
+ return true;
+ }
}
private void CreateLibOmvClient()
@@ -282,6 +292,10 @@ namespace pCampBot
// XXX: This is a really shitty way of yielding so that behaviours can be added/removed
Thread.Sleep(100);
}
+
+ lock (Behaviours)
+ foreach (IBehaviour b in Behaviours.Values)
+ b.Close();
}
///
diff --git a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
index f8a661b..0ed4825 100644
--- a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
@@ -51,6 +51,14 @@ namespace pCampBot.Interfaces
void Initialize(Bot bot);
///
+ /// Close down this behaviour.
+ ///
+ ///
+ /// This is triggered if a behaviour is removed via explicit command and when a bot is disconnected
+ ///
+ void Close();
+
+ ///
/// Action to take when this behaviour is invoked.
///
///
--
cgit v1.1
From 76bd2e2d727a15e5d3bc9045bdef6faaeca4a08f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 19:41:12 +0100
Subject: Consistently give responsibility for thread sleeping to behaviours
rather than controlling from the main action loop
This is to avoid excessive and inconsistent delays between behaviours that currently need to embed sleeps in other actions (e.g. physics) and other behaviours.
Might need a more sophisticated approach in the long term.
---
OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | 3 +++
OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs | 3 +++
OpenSim/Tools/pCampBot/Bot.cs | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
index 6acc27d..59f6244 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
@@ -29,6 +29,7 @@ using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading;
using pCampBot.Interfaces;
namespace pCampBot
@@ -60,6 +61,8 @@ namespace pCampBot
Bot.Client.Self.Grab(prim.LocalID);
Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
Bot.Client.Self.DeGrab(prim.LocalID);
+
+ Thread.Sleep(1000);
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
index 5f7edda..81f250d 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
@@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
+using System.Threading;
using log4net;
using OpenMetaverse;
using pCampBot.Interfaces;
@@ -74,6 +75,8 @@ namespace pCampBot
Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition);
Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition);
+
+ Thread.Sleep(Bot.Random.Next(3000, 10000));
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index f871b77..d0a4ef3 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -282,7 +282,7 @@ namespace pCampBot
{
foreach (IBehaviour behaviour in Behaviours.Values)
{
- Thread.Sleep(Random.Next(3000, 10000));
+// Thread.Sleep(Random.Next(3000, 10000));
// m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
behaviour.Action();
--
cgit v1.1
From 9c3c9b7f5f62a7ed892f691180b765a9190cbbcc Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 19:57:34 +0100
Subject: Make pCampbot "add behaviour" and "remove behaviour" console commands
work for all bots if no bot number is given
---
OpenSim/Tools/pCampBot/BotManager.cs | 123 ++++++++++++++++++++++-------------
1 file changed, 78 insertions(+), 45 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 6433c2e..3c1b11e 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -195,15 +195,17 @@ namespace pCampBot
HandleDisconnect);
m_console.Commands.AddCommand(
- "bot", false, "add behaviour", "add behaviour ",
+ "bot", false, "add behaviour", "add behaviour []",
"Add a behaviour to a bot",
- "Can be performed on connected or disconnected bots.",
+ "If no bot number is specified then behaviour is added to all bots.\n"
+ + "Can be performed on connected or disconnected bots.",
HandleAddBehaviour);
m_console.Commands.AddCommand(
- "bot", false, "remove behaviour", "remove behaviour ",
+ "bot", false, "remove behaviour", "remove behaviour []",
"Remove a behaviour from a bot",
- "Can be performed on connected or disconnected bots.",
+ "If no bot number is specified then behaviour is added to all bots.\n"
+ + "Can be performed on connected or disconnected bots.",
HandleRemoveBehaviour);
m_console.Commands.AddCommand(
@@ -224,7 +226,7 @@ namespace pCampBot
"bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
m_console.Commands.AddCommand(
- "bot", false, "show bot", "show bot ",
+ "bot", false, "show bot", "show bot ",
"Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);
m_bots = new List();
@@ -489,83 +491,114 @@ namespace pCampBot
private void HandleAddBehaviour(string module, string[] cmd)
{
- if (cmd.Length != 4)
+ if (cmd.Length < 3 || cmd.Length > 4)
{
- MainConsole.Instance.OutputFormat("Usage: add behaviour ");
+ MainConsole.Instance.OutputFormat("Usage: add behaviour []");
return;
}
string rawBehaviours = cmd[2];
- int botNumber;
-
- if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[3], out botNumber))
- return;
- Bot bot = GetBotFromNumber(botNumber);
+ List botsToEffect = new List();
- if (bot == null)
+ if (cmd.Length == 3)
{
- MainConsole.Instance.OutputFormat("Error: No bot found with number {0}", botNumber);
- return;
+ lock (m_bots)
+ botsToEffect.AddRange(m_bots);
}
+ else
+ {
+ int botNumber;
+ if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[3], out botNumber))
+ return;
+
+ Bot bot = GetBotFromNumber(botNumber);
+
+ if (bot == null)
+ {
+ MainConsole.Instance.OutputFormat("Error: No bot found with number {0}", botNumber);
+ return;
+ }
+
+ botsToEffect.Add(bot);
+ }
+
HashSet rawAbbreviatedSwitchesToAdd = new HashSet();
Array.ForEach(rawBehaviours.Split(new char[] { ',' }), b => rawAbbreviatedSwitchesToAdd.Add(b));
- List behavioursAdded = new List();
-
- foreach (IBehaviour behaviour in CreateBehavioursFromAbbreviatedNames(rawAbbreviatedSwitchesToAdd))
+ foreach (Bot bot in botsToEffect)
{
- if (bot.AddBehaviour(behaviour))
- behavioursAdded.Add(behaviour);
- }
+ List behavioursAdded = new List();
- MainConsole.Instance.OutputFormat(
- "Added behaviours {0} to bot {1}",
- string.Join(", ", behavioursAdded.ConvertAll(b => b.Name).ToArray()), bot.Name);
+ foreach (IBehaviour behaviour in CreateBehavioursFromAbbreviatedNames(rawAbbreviatedSwitchesToAdd))
+ {
+ if (bot.AddBehaviour(behaviour))
+ behavioursAdded.Add(behaviour);
+ }
+
+ MainConsole.Instance.OutputFormat(
+ "Added behaviours {0} to bot {1}",
+ string.Join(", ", behavioursAdded.ConvertAll(b => b.Name).ToArray()), bot.Name);
+ }
}
private void HandleRemoveBehaviour(string module, string[] cmd)
{
- if (cmd.Length != 4)
+ if (cmd.Length < 3 || cmd.Length > 4)
{
- MainConsole.Instance.OutputFormat("Usage: remove behaviour ");
+ MainConsole.Instance.OutputFormat("Usage: remove behaviour []");
return;
}
string rawBehaviours = cmd[2];
- int botNumber;
-
- if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[3], out botNumber))
- return;
- Bot bot = GetBotFromNumber(botNumber);
+ List botsToEffect = new List();
- if (bot == null)
+ if (cmd.Length == 3)
{
- MainConsole.Instance.OutputFormat("Error: No bot found with number {0}", botNumber);
- return;
+ lock (m_bots)
+ botsToEffect.AddRange(m_bots);
}
+ else
+ {
+ int botNumber;
+ if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, cmd[3], out botNumber))
+ return;
- HashSet abbreviatedBehavioursToRemove = new HashSet();
- List behavioursRemoved = new List();
+ Bot bot = GetBotFromNumber(botNumber);
+
+ if (bot == null)
+ {
+ MainConsole.Instance.OutputFormat("Error: No bot found with number {0}", botNumber);
+ return;
+ }
+ botsToEffect.Add(bot);
+ }
+
+ HashSet abbreviatedBehavioursToRemove = new HashSet();
Array.ForEach(rawBehaviours.Split(new char[] { ',' }), b => abbreviatedBehavioursToRemove.Add(b));
- foreach (string b in abbreviatedBehavioursToRemove)
+ foreach (Bot bot in botsToEffect)
{
- IBehaviour behaviour;
+ List behavioursRemoved = new List();
- if (bot.TryGetBehaviour(b, out behaviour))
+ foreach (string b in abbreviatedBehavioursToRemove)
{
- bot.RemoveBehaviour(b);
- behavioursRemoved.Add(behaviour);
+ IBehaviour behaviour;
+
+ if (bot.TryGetBehaviour(b, out behaviour))
+ {
+ bot.RemoveBehaviour(b);
+ behavioursRemoved.Add(behaviour);
+ }
}
- }
- MainConsole.Instance.OutputFormat(
- "Removed behaviours {0} to bot {1}",
- string.Join(", ", behavioursRemoved.ConvertAll(b => b.Name).ToArray()), bot.Name);
+ MainConsole.Instance.OutputFormat(
+ "Removed behaviours {0} to bot {1}",
+ string.Join(", ", behavioursRemoved.ConvertAll(b => b.Name).ToArray()), bot.Name);
+ }
}
private void HandleDisconnect(string module, string[] cmd)
--
cgit v1.1
From b781a23c445bea0fd199eb756ebf6143959256a6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 19:58:27 +0100
Subject: In pCampbot PhysicsBehaviour.Close(), only cancel jumping if bot is
connected
---
OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
index 65a7c90..6fd2b7c 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
@@ -80,7 +80,8 @@ namespace pCampBot
public override void Close()
{
- Bot.Client.Self.Jump(false);
+ if (Bot.ConnectionState == ConnectionState.Connected)
+ Bot.Client.Self.Jump(false);
}
private string[] readexcuses()
--
cgit v1.1
From 42bdf446585007029faf4cd21abd289487f0f797 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 4 Oct 2013 23:33:47 +0100
Subject: Bump OPenSimulator version and assembly versions up to 0.8.0 Dev
---
OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs | 2 +-
OpenSim/Tools/Configger/Properties/AssemblyInfo.cs | 2 +-
OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs b/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs
index 088be45..7006211 100644
--- a/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs
+++ b/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("0.7.6.*")]
+[assembly: AssemblyVersion("0.8.0.*")]
diff --git a/OpenSim/Tools/Configger/Properties/AssemblyInfo.cs b/OpenSim/Tools/Configger/Properties/AssemblyInfo.cs
index 0348628..bfcd4fb 100644
--- a/OpenSim/Tools/Configger/Properties/AssemblyInfo.cs
+++ b/OpenSim/Tools/Configger/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("0.7.6.*")]
+[assembly: AssemblyVersion("0.8.0.*")]
diff --git a/OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs b/OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs
index 78f3603..731e2c3 100644
--- a/OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs
+++ b/OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("0.7.6.*")]
+[assembly: AssemblyVersion("0.8.0.*")]
--
cgit v1.1
From 39de7614ec14babe092a2dd47072fd4a5015fdbb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 28 Oct 2013 18:03:34 +0000
Subject: Remove legacy sqlite lines added internally by OpenSimulator to the
[Startup] section.
These are long unused but confusingly will be seen in the [Startup] section on a "config save".
---
OpenSim/Tools/Configger/ConfigurationLoader.cs | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs
index 72ba185..0b6ee9c 100644
--- a/OpenSim/Tools/Configger/ConfigurationLoader.cs
+++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs
@@ -240,8 +240,6 @@ namespace OpenSim.Tools.Configger
config.Set("meshing", "Meshmerizer");
config.Set("physical_prim", true);
config.Set("serverside_object_permissions", true);
- config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
- config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
config.Set("storage_prim_inventories", true);
config.Set("startup_console_commands_file", String.Empty);
config.Set("shutdown_console_commands_file", String.Empty);
@@ -253,6 +251,5 @@ namespace OpenSim.Tools.Configger
return defaultConfig;
}
-
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From 0e07fad2e16ef135c71440ae3c6c909c4eee4a86 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 31 Oct 2013 20:19:57 +0000
Subject: minor: update pCampbot usage/help statement
---
OpenSim/Tools/pCampBot/pCampBot.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 781bb00..1fb0e03 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -151,17 +151,17 @@ namespace pCampBot
// worn to the folder MyAppearance/FirstName_LastName, and the load it.
Console.WriteLine(
- "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n"
+ "Usage: pCampBot -loginuri -firstname -lastname -password [OPTIONS]\n"
+ "Spawns a set of bots to test an OpenSim region\n\n"
+ " -l, -loginuri loginuri for grid/standalone (required)\n"
- + " -s, -start start location for bots (optional). Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
+ + " -s, -start start location for bots (default: last) (optional). Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
+ " -firstname first name for the bots (required)\n"
+ " -lastname lastname for the bots (required). Each lastname will have _ appended, e.g. Ima Bot_0\n"
+ " -password password for the bots (required)\n"
+ " -n, -botcount number of bots to start (default: 1) (optional)\n"
- + " -f, -from starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0) (optional)\n"
+ + " -f, -from starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0) (optional)\n"
+ " -c, -connect connect all bots at startup (optional)\n"
- + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p (required)\n"
+ + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g (default: p) (optional)\n"
+ " current options are:\n"
+ " p (physics - bots constantly move and jump around)\n"
+ " g (grab - bots randomly click prims whether set clickable or not)\n"
--
cgit v1.1
From cc7065f9ee0598640ac24e2672f8a0ba8744fd40 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 1 Nov 2013 00:04:18 +0000
Subject: minor: change "bot" pCampBot help cateogry to "Bots"
---
OpenSim/Tools/pCampBot/BotManager.cs | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 3c1b11e..abc71cb 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -176,57 +176,57 @@ namespace pCampBot
}
m_console.Commands.AddCommand(
- "bot", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);
+ "Bots", false, "shutdown", "shutdown", "Shutdown bots and exit", HandleShutdown);
m_console.Commands.AddCommand(
- "bot", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);
+ "Bots", false, "quit", "quit", "Shutdown bots and exit", HandleShutdown);
m_console.Commands.AddCommand(
- "bot", false, "connect", "connect []", "Connect bots",
+ "Bots", false, "connect", "connect []", "Connect bots",
"If an is given, then the first disconnected bots by postfix number are connected.\n"
+ "If no is given, then all currently disconnected bots are connected.",
HandleConnect);
m_console.Commands.AddCommand(
- "bot", false, "disconnect", "disconnect []", "Disconnect bots",
+ "Bots", false, "disconnect", "disconnect []", "Disconnect bots",
"Disconnecting bots will interupt any bot connection process, including connection on startup.\n"
+ "If an is given, then the last connected bots by postfix number are disconnected.\n"
+ "If no is given, then all currently connected bots are disconnected.",
HandleDisconnect);
m_console.Commands.AddCommand(
- "bot", false, "add behaviour", "add behaviour []",
+ "Bots", false, "add behaviour", "add behaviour []",
"Add a behaviour to a bot",
"If no bot number is specified then behaviour is added to all bots.\n"
+ "Can be performed on connected or disconnected bots.",
HandleAddBehaviour);
m_console.Commands.AddCommand(
- "bot", false, "remove behaviour", "remove behaviour []",
+ "Bots", false, "remove behaviour", "remove behaviour []",
"Remove a behaviour from a bot",
"If no bot number is specified then behaviour is added to all bots.\n"
+ "Can be performed on connected or disconnected bots.",
HandleRemoveBehaviour);
m_console.Commands.AddCommand(
- "bot", false, "sit", "sit", "Sit all bots on the ground.",
+ "Bots", false, "sit", "sit", "Sit all bots on the ground.",
HandleSit);
m_console.Commands.AddCommand(
- "bot", false, "stand", "stand", "Stand all bots.",
+ "Bots", false, "stand", "stand", "Stand all bots.",
HandleStand);
m_console.Commands.AddCommand(
- "bot", false, "set bots", "set bots ", "Set a setting for all bots.", HandleSetBots);
+ "Bots", false, "set bots", "set bots ", "Set a setting for all bots.", HandleSetBots);
m_console.Commands.AddCommand(
- "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
+ "Bots", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
m_console.Commands.AddCommand(
- "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
+ "Bots", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
m_console.Commands.AddCommand(
- "bot", false, "show bot", "show bot ",
+ "Bots", false, "show bot", "show bot ",
"Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);
m_bots = new List();
--
cgit v1.1
From c6395240f0dd7767cb9f14f2ad8b6cccadf1351a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 1 Nov 2013 02:04:04 +0000
Subject: For individual bots, seed random number generator with a random
number from BotManager rather than Environment.Tickcount
Otherwise, since bots are now created all at once, a bunch will get exactly the same tickcount and hence number sequences
---
OpenSim/Tools/pCampBot/Bot.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index d0a4ef3..ccc24fa 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -166,7 +166,7 @@ namespace pCampBot
{
ConnectionState = ConnectionState.Disconnected;
- Random = new Random(Environment.TickCount);// We do stuff randomly here
+ Random = new Random(bm.Rng.Next());
FirstName = firstName;
LastName = lastName;
Name = string.Format("{0} {1}", FirstName, LastName);
--
cgit v1.1
From 2d315ec207292ef05bab5e4f662599e755d7acbf Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Nov 2013 20:58:52 +0000
Subject: Fix a race condition where pCampbot actions could continue even if a
bot had disconnected.
---
OpenSim/Tools/pCampBot/Bot.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index ccc24fa..70aa2cb 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -276,7 +276,7 @@ namespace pCampBot
//add additional steps and/or things the bot should do
private void Action()
{
- while (ConnectionState != ConnectionState.Disconnecting)
+ while (ConnectionState == ConnectionState.Connected)
{
lock (Behaviours)
{
--
cgit v1.1
From caf2abe311a9f7a703ba7444601c34d96053edcf Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Nov 2013 23:32:26 +0000
Subject: Record individual region bot disconnects in pCampbot log
---
OpenSim/Tools/pCampBot/Bot.cs | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 70aa2cb..de464ab 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -264,9 +264,10 @@ namespace pCampBot
newClient.Throttle.Total = 400000;
}
- newClient.Network.LoginProgress += this.Network_LoginProgress;
- newClient.Network.SimConnected += this.Network_SimConnected;
- newClient.Network.Disconnected += this.Network_OnDisconnected;
+ newClient.Network.LoginProgress += Network_LoginProgress;
+ newClient.Network.SimConnected += Network_SimConnected;
+ newClient.Network.SimDisconnected += Network_SimDisconnected;
+ newClient.Network.Disconnected += Network_OnDisconnected;
newClient.Objects.ObjectUpdate += Objects_NewPrim;
Client = newClient;
@@ -583,7 +584,13 @@ namespace pCampBot
public void Network_SimConnected(object sender, SimConnectedEventArgs args)
{
m_log.DebugFormat(
- "[BOT]: Bot {0} connected to {1} at {2}", Name, args.Simulator.Name, args.Simulator.IPEndPoint);
+ "[BOT]: Bot {0} connected to region {1} at {2}", Name, args.Simulator.Name, args.Simulator.IPEndPoint);
+ }
+
+ public void Network_SimDisconnected(object sender, SimDisconnectedEventArgs args)
+ {
+ m_log.DebugFormat(
+ "[BOT]: Bot {0} disconnected from region {1} at {2}", Name, args.Simulator.Name, args.Simulator.IPEndPoint);
}
public void Network_OnDisconnected(object sender, DisconnectedEventArgs args)
@@ -591,7 +598,7 @@ namespace pCampBot
ConnectionState = ConnectionState.Disconnected;
m_log.DebugFormat(
- "[BOT]: Bot {0} disconnected reason {1}, message {2}", Name, args.Reason, args.Message);
+ "[BOT]: Bot {0} disconnected from grid, reason {1}, message {2}", Name, args.Reason, args.Message);
// m_log.ErrorFormat("Fired Network_OnDisconnected");
--
cgit v1.1
From 869a23e2234ce9b565249c5850324ca2de2f06ba Mon Sep 17 00:00:00 2001
From: justincc
Date: Wed, 13 Nov 2013 01:07:14 +0000
Subject: Update OpenSim.32BitLaunch.exe and Robust.32BitLaunch.exe to .NET 4
versions.
Also fixes some issues in associated solution files
---
.../OpenSim.32BitLaunch/OpenSim.32BitLaunch.csproj | 141 +++++++++++++-------
.../Robust.32BitLaunch/Robust.32BitLaunch.csproj | 147 +++++++++++++--------
.../Robust.32BitLaunch/Robust.32BitLaunch.sln | 40 +++---
3 files changed, 202 insertions(+), 126 deletions(-)
(limited to 'OpenSim/Tools')
diff --git a/OpenSim/Tools/OpenSim.32BitLaunch/OpenSim.32BitLaunch.csproj b/OpenSim/Tools/OpenSim.32BitLaunch/OpenSim.32BitLaunch.csproj
index d829e69..4625c33 100644
--- a/OpenSim/Tools/OpenSim.32BitLaunch/OpenSim.32BitLaunch.csproj
+++ b/OpenSim/Tools/OpenSim.32BitLaunch/OpenSim.32BitLaunch.csproj
@@ -1,58 +1,97 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {595D67F3-B413-4A43-8568-5B5930E3B31D}
- Exe
- Properties
- OpenSim._32BitLaunch
- OpenSim.32BitLaunch
- v2.0
- 512
-
-
- true
- full
- false
- ..\..\..\bin\
- DEBUG;TRACE
- prompt
- 4
- x86
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
- {438A9556-0000-0000-0000-000000000000}
- OpenSim
-
-
-
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {595D67F3-B413-4A43-8568-5B5930E3B31D}
+ Exe
+ Properties
+ OpenSim._32BitLaunch
+ OpenSim.32BitLaunch
+ v4.0
+ 512
+
+
+
+
+ 3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ false
+ ..\..\..\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ x86
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ False
+ .exe
+ ..\..\..\bin\OpenSim.exe
+
+
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+ -->
\ No newline at end of file
diff --git a/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj b/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj
index 481b3f8..9618c08 100644
--- a/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj
+++ b/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj
@@ -1,62 +1,99 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {595D67F3-B413-4A43-8568-5B5930E3B31D}
- Exe
- Properties
- Robust._32BitLaunch
- Robust.32BitLaunch
- v3.5
- 512
-
-
- true
- full
- false
- ..\..\..\bin\
- DEBUG;TRACE
- prompt
- 4
- x86
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- False
- ..\..\..\bin\log4net.dll
-
-
- False
- ..\..\..\bin\Robust.exe
-
-
-
- 3.5
-
-
-
-
-
-
-
-
-
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {595D67F3-B413-4A43-8568-5B5930E3B31D}
+ Exe
+ Properties
+ Robust._32BitLaunch
+ Robust.32BitLaunch
+ v4.0
+ 512
+
+
+
+
+ 3.5
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ false
+ ..\..\..\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ x86
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ False
+ ..\..\..\bin\log4net.dll
+
+
+ False
+ ..\..\..\bin\Robust.exe
+
+
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+ -->
\ No newline at end of file
diff --git a/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.sln b/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.sln
index c7c97b1..a48a2d3 100644
--- a/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.sln
+++ b/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.sln
@@ -1,20 +1,20 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C# Express 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.32BitLaunch", "Robust.32BitLaunch.csproj", "{595D67F3-B413-4A43-8568-5B5930E3B31D}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {595D67F3-B413-4A43-8568-5B5930E3B31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {595D67F3-B413-4A43-8568-5B5930E3B31D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {595D67F3-B413-4A43-8568-5B5930E3B31D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {595D67F3-B413-4A43-8568-5B5930E3B31D}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C# Express 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.32BitLaunch", "Robust.32BitLaunch.csproj", "{595D67F3-B413-4A43-8568-5B5930E3B31D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {595D67F3-B413-4A43-8568-5B5930E3B31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {595D67F3-B413-4A43-8568-5B5930E3B31D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {595D67F3-B413-4A43-8568-5B5930E3B31D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {595D67F3-B413-4A43-8568-5B5930E3B31D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--
cgit v1.1