|
|
||
|---|---|---|
| plugins | ||
| .gitignore | ||
| index.js | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| utils.js | ||
Plobot
A Minecraft bot built using Mineflayer designed for Kaboom clones, capable of accomplishing various tasks (duh).
Features
- Automatic Head Movements: It can stare at nearby players, wowzies!
- Custom Behaviors: Easily add your own custom logic or extend the bot’s functionality through the plugin system, all without affecting anything unrelated!
- Event-driven: Listens to Minecraft events such as player interactions, block updates, etc.
- Infinitely Programmable: With the built-in Scheme interpreter and the Scheme initialization file, you can (theoretically) craft any intricate user-defined commands in-game through chat, without even touching a line of bot code!
Requirements
- Node.js: Just grab the newest version, whatever it is.
- Mineflayer: This bot is powered by the Mineflayer library.
Installation
We'll assume you are using *NIX for this one, like most people do when hosting a bot. These instructions haven't been checked, so please take it with a grain of salt (but I believe they're mostly correct).
-
Clone this repository:
git clone https://code.chipmunk.land/Plovie/plobot.git cd plobot -
Install dependencies:
npm install
Configuration
There isn't a lot of configuration for this bot, but if you look at the code, you'll find something like this:
const bot = require('mineflayer').createBot({
host: process.argv[2] || 'play.kaboom.pw',
port: process.argv[3] || 25565,
username: process.argv[4] || '_dat',
checkTimeoutInterval: 600 * 1000,
plugins: plugins,
hideErrors: true
});
bot.prefix = process.argv[5] || ';';
You can specify those 4 options, either through command-line arguments or by modifying the code directly, and I don't think I even have to explain what each of them means. Do I? Anyway, here's an example.
node index.js mykaboomclone.com 25569 Notch '!'
Usage
Start the Bot
To start the bot with default configs, run the following command:
node index.js
The bot will attempt to log in to the specified server and start performing the configured tasks.
Custom Commands (Plugins)
The bot already comes with a bunch of built-in plugins. To add custom behaviours or commands, create a new directory in the plugins folder and add a new index.js file in there. The bot will automatically load all plugins found in the plugins directory. Here's an example (not tested, should work anyway):
mkdir plugins/myPlugin
touch plugins/myPlugin/index.js
And then you add some code to plugins/myPlugin/index.js. Assuming your bot is stored in the variable bot, you can add your own help topics coupled to the plugin by modifying bot.help. Here's an example of plugins/myPlugin/index.js (modified from plugins/prefixManager/index.js):
const inject = bot => {
bot.help.someRandomTopic = () => `Hello! I'm some random help topic! And hey, the bot's prefix is ${bot.prefix}!`;
bot.on('whisper', (username, message) => {
if (!message.startsWith('prefix')) return;
const words = message.split(' ');
if (words.length === 1) {
bot.whisper(username, `Current prefix: ${bot.prefix}`);
} else {
bot.whisper(username, `New prefix: ${bot.prefix = words[1][0]}`);
}
});
}
module.exports = inject
FAQ & Troubleshooting
- Bot failed to connect to the server: Ensure that the Minecraft server is running and the bot knows the correct host and port, etc.
- Missing files: There are a couple of files needed by the bot for it to be fully functional. You can study the source code to see how things work, and add the files manually (contents of files might matter, too). If you don't add the files, the basic functionalities of the bot should still be unaffected, though.
- Why the heck is it so unresponsive to commands huh?: This is often due to a resource-saving measure in place for efficiency. It is implemented in
index.jsnear the end (75 + (3e3 - 75) * (1 - Math.exp(-alpha * x))). Please refer to the appendix for more information on the dynamic adjustment of responsiveness.
License
Will you read that LICENSE file?
Appendix: Mathematical Formulation and Asymptotic Behavior of Response Time in Dynamical Systems
The following section presents a detailed mathematical formulation of the response time behavior in the context of dynamical systems, specifically focusing on an exponential relaxation model. This model is relevant for understanding the temporal evolution of system responsiveness and its asymptotic behavior as the system stabilizes over time.
1. Mathematical Formulation of Response Time
The system's response time T(x) at a given time x, where x \geq 0 represents the elapsed time, can be modeled using an exponential function of the form:
T(x) = T_{\min} + (T_{\max}-T_{\min})(1 - \exp(-\alpha x))
where:
T_{\text{min}}is the minimum response time of the system, representing the upper bound of system responsiveness.T_{\text{max}}is the maximum response time, which characterizes the lower bound of the system's responsiveness.\alpha > 0is the decay rate parameter, governing the speed at which the system approaches its equilibrium state.xdenotes the elapsed time since the system was last perturbed.
This equation achieves the effect that the system begins in a state of minimal response time and gradually increases its response time toward the maximum, following a characteristic exponential curve.
2. Initial Response Time and Asymptotic Behavior
At the initial time x = 0, the response time T(0) is equal to T_{\text{min}}, indicating that the system begins in a state of minimal response time:
T(0) = T_{\text{min}} + (T_{\text{max}} - T_{\text{min}}) \left( 1 - \exp(-\alpha \cdot 0) \right) = T_{\text{min}}
As time x progresses toward infinity, the system’s response time approaches its upper bound T_{\text{max}} asymptotically. The long-term behavior of the system can be described by the following limit:
\lim_{x \to \infty} T(x) = T_{\text{min}} + (T_{\text{max}} - T_{\text{min}}) \left( 1 - 0 \right) = T_{\text{max}}
This demonstrates that, as x \to \infty, the system stabilizes and the response time reaches a steady-state value of T_{\text{max}}.
3. Monotonicity of the Response Time Function
The response time function T(x) is strictly increasing over time. To confirm this, we compute the first derivative of T(x) with respect to x:
\frac{dT}{dx} = \alpha \left( T_{\text{max}} - T_{\text{min}} \right) \exp(-\alpha x)
Since \alpha > 0 and \exp(-\alpha x) is always positive for all x \geq 0, we conclude that:
\frac{dT}{dx} > 0, \quad \forall x \geq 0
This confirms that the function T(x) is monotonically increasing, meaning that the system’s response time consistently increases as time passes and does not exhibit any oscillatory or non-monotonic behavior.
4. Exponential Relaxation Model
The term 1 - \exp(-\alpha x) in the equation is characteristic of exponential relaxation, a common feature in systems transitioning from an initial perturbation to equilibrium. Exponential relaxation is widely observed in physical and computational systems, where the rate of change slows down as the system approaches its steady-state configuration.
This behavior can be described as a process where the system exhibits an initially rapid response that decays over time, eventually reaching a steady-state value. The rate at which the system stabilizes is determined by the decay constant \alpha, which characterizes the relaxation speed. A larger \alpha corresponds to a faster stabilization, while a smaller \alpha indicates slower convergence.
5. Parameterization and System Dynamics
To characterize the system more precisely, we introduce parameters for the response time bounds and decay constant. For example, the minimum and maximum response times, T_{\text{min}} and T_{\text{max}}, can be selected based on system performance requirements, while the decay constant \alpha can be determined from empirical data or system design specifications.
In practical scenarios, the decay rate \alpha may be derived from experimental observations, such as the time required for the system to transition from an initial response time to a steady-state condition. The following relationship can be used to estimate \alpha given known values for T_{\text{min}}, T_{\text{max}}, and an intermediate response time T_{\text{mid}} observed at a specific time:
\alpha = K^{-1} \ln\left( \frac{T_{\text{max}} - T_{\text{min}}}{T_{\text{max}} - T_{\text{mid}}} \right)
Where K is a scaling factor related to the time constant of the system. By choosing appropriate values for T_{\text{min}}, T_{\text{max}}, and T_{\text{mid}}, this equation allows for the determination of \alpha and facilitates a more accurate specification of the system’s response behavior.
6. Implications for System Performance and Efficiency
The analysis of the response time dynamics reveals key insights into system performance. By understanding the exponential relaxation model, developers and system administrators can make informed decisions about optimizing resource allocation and tuning the system’s responsiveness. For example, during periods of frequent use, the system may prioritize efficiency by operating at full responsiveness, while during periods of infrequent use, it can slow down its response.
Understanding the asymptotic behavior of the response time also helps in predicting the performance of the system. This knowledge is crucial for designing systems that need to dynamically adjust performance under varying operational conditions.
Conclusion
In summary, the response time of the system exhibits exponential relaxation characterized by an initial rapid response that slows as the system approaches its steady-state value. The mathematical formulation provided offers a rigorous framework for understanding the system's behavior over time, enabling better optimization and management of system resources. By carefully tuning the parameters T_{\text{min}}, T_{\text{max}}, and \alpha, one can tailor the system’s performance to meet specific operational requirements, ensuring both efficiency and stability.