Reopened.
Printable View
Reopened.
Updated main post.
Added:
- Created bot manager (ZBotManager). Responsible for creating/destroying bots, and issuing commands to all bots.
- Bots are now derived from the player (ZBotCharacter). Bots are pretty much of type MyZCharacter (The thing you play as), but with some features removed.
- Added bypass for connection check for bots. I suspect this makes the bot client-sided. Need to find a way to test.
- Added bots to peer list with a sentinel IP of "255.255.255.255" and port 0. Should be useful for making server sided bots in the near future.
- Added death mechanics to bots. Bots stay dead until you respawn them with "/bot spawn".
- Added godmode to bots. "/bot god"
- Bots now contain your name.
To be added:
- Need to create ZNetBot so you can see other player's bots and bots in replays.
- Need to consider bots in replays.
- Need to fix player camera controlling bots.
- Need to fix most ranged weapons not damaging bot.
- Need to fix bots not dying in pits.
- Need to add controllability.
Updated main post a tiny bit.
Fixed player camera controlling bots. Bots now have their own independent camera. Before, they were facing whatever direction the player was at all times.
Bots now switch to melee upon spawning.
Started fiddling with controlling the bot. It's going hilarious.
https://i.ibb.co/Wkt8kFJ/Broken-Turtle.gif
"/bot turtle" in real time. Blocks are too fast to register as a block.
https://i.ibb.co/z4DzzJH/lol.gif
Cleaned up main post for future me and updated command list, because winter break is over (that was fast) and school is starting up. This project is on low priority again. :(
I last left off on beginning to give the training bot some controllability. I need to find a way to send an action (like pressing shift to block) instead of copying and pasting code for blocking; This should naturally lead into implementing McSic's suggestion of a record/play mechanic where you can record your actions and have the bot replay them.
Ahh i would say make it learn to play. Give it all the keys to the kingdom of course. Show it certain moves and what not and then have it quest and deep learn over and over till it can win a quest by rsing and such till it could stand on its own and then just keep making it learn and improve.
That's epic how far you've gotten
btw if u wanna use some haxs for quest and such https://streamable.com/0nwf9z
Header file adminhax.h or whatever
Then go to ZChat_Cmds.cpp include the header and this stuffQuote:
//forum.ragezone.com/f245/commands-hacks-admin-jork-1171006/
static bool bLawn = false;
static bool bMas = false;
static bool bFlip = false;
static bool bRe = false;
void lawnmower()
{
bLawn = !bLawn;
(bLawn == false) ? ZChatOutput(MCOLOR(255, 0, 0), ">Lawnmower") : ZChatOutput(MCOLOR(0, 255, 0), "Lawnmower");
while (bLawn == true)
{
ZMyCharacter* m_pMyCharacter = ZGetGame()->m_pMyCharacter;
MCommand* pNewCmd = ZGetGameClient()->CreateCommand(MC_PEER_SHOT_MELEE, MUID(0, 0));
pNewCmd->AddParameter(new MCommandParameterFloat((float)timeGetTime()));
pNewCmd->AddParameter(new MCommandParameterPos(m_pMyCharacter->GetPosition().x, m_pMyCharacter->GetPosition().y, m_pMyCharacter->GetPosition().z));
pNewCmd->AddParameter(new MCommandParameterInt(1));
ZGetGameClient()->Post(pNewCmd);
Sleep(20);
}
}
void massive()
{
bMas = !bMas;
(bMas == false) ? ZChatOutput(MCOLOR(255, 0, 0), ">Massive") : ZChatOutput(MCOLOR(0, 255, 0), "Massive");
while (bMas == true)
{
MCommand* pNewCmd = ZGetGameClient()->CreateCommand(MC_PEER_SKILL, MUID(0, 0));
pNewCmd->AddParameter(new MCommandParameterFloat((float)timeGetTime()));
pNewCmd->AddParameter(new MCommandParameterInt(2));
pNewCmd->AddParameter(new MCommandParameterInt(7));
ZGetGameClient()->Post(pNewCmd);
Sleep(20);
}
}
void flipmower()
{
bFlip = !bFlip;
(bFlip == false) ? ZChatOutput(MCOLOR(255, 0, 0), ">Flipmower") : ZChatOutput(MCOLOR(0, 255, 0), "Flipmower");
while (bFlip == true)
{
MCommand* pNewCmd = ZGetGameClient()->CreateCommand(MC_PEER_SKILL, MUID(0, 0));
pNewCmd->AddParameter(new MCommandParameterFloat((float)timeGetTime()));
pNewCmd->AddParameter(new MCommandParameterInt(1));
pNewCmd->AddParameter(new MCommandParameterInt(7));
ZGetGameClient()->Post(pNewCmd);
Sleep(20);
}
}
void respawn()
{
bRe = !bRe;
(bRe == false) ? ZChatOutput(MCOLOR(255, 0, 0), ">Respawn") : ZChatOutput(MCOLOR(0, 255, 0), "Respawn");
while (bRe == true)
{
ZMyCharacter* m_pMyCharacter = ZGetGame()->m_pMyCharacter;
MCommand* pNewCmd = ZGetGameClient()->CreateCommand(MC_PEER_SPAWN, MUID(0, 0));
pNewCmd->AddParameter(new MCommandParameterPos(m_pMyCharacter->GetPosition().x, m_pMyCharacter->GetPosition().y, m_pMyCharacter->GetPosition().z));
pNewCmd->AddParameter(new MCommandParameterDir(m_pMyCharacter->GetDirection().x, m_pMyCharacter->GetDirection().y, m_pMyCharacter->GetDirection().z));
ZGetGameClient()->Post(pNewCmd);
ZGetGame()->ReleaseObserver();
ZPACKEDSHOTINFO ShotInfo;
ShotInfo.fTime = (float)timeGetTime();
ShotInfo.posx = 0;
ShotInfo.posy = 0;
ShotInfo.posz = 0;
ShotInfo.tox = 0;
ShotInfo.toy = 0;
ShotInfo.toz = 0;
ShotInfo.sel_type = 1;
pNewCmd = ZGetGameClient()->CreateCommand(MC_PEER_SHOT, MUID(0, 0));
pNewCmd->AddParameter(new MCommandParameterBlob(&ShotInfo, sizeof(ZPACKEDSHOTINFO)));
ZGetGameClient()->Post(pNewCmd);
Sleep(20);
}
}
then void initcmdsQuote:
//admin stuff
void ChatCmd_Respawn(const char* line, const int argc, char** const argv);
void ChatCmd_Lawnmower(const char* line, const int argc, char** const argv);
void ChatCmd_Flipmower(const char* line, const int argc, char** const argv);
void ChatCmd_Massive(const char* line, const int argc, char** const argv);
void ChatCmd_AdminCmds(const char* line, const int argc, char** const argv);
Quote:
// admin stuff
_CC_AC("lawn", &ChatCmd_Lawnmower, CCF_ADMIN | CCF_GAME, ARGVNoMin, ARGVNoMax, true, "/lawn", "");
_CC_AC("mas", &ChatCmd_Massive, CCF_ADMIN | CCF_GAME, ARGVNoMin, ARGVNoMax, true, "/mas", "");
_CC_AC("flip", &ChatCmd_Flipmower, CCF_ADMIN | CCF_GAME, ARGVNoMin, ARGVNoMax, true, "/flip", "");
_CC_AC("re", &ChatCmd_Respawn, CCF_ADMIN | CCF_GAME, ARGVNoMin, ARGVNoMax, true, "/re", "");
_CC_AC("admin_cmds", &ChatCmd_AdminCmds, CCF_ADMIN | CCF_GAME, ARGVNoMin, ARGVNoMax, true, "/admin_cmds", "");
Quote:
// admin stuff
void ChatCmd_AdminCmds(const char* line, const int argc, char** const argv)
{
if (!ZGetMyInfo()->IsAdminGrade()) { return; }
ZChatOutput("Commands:", ZChat::CMT_SYSTEM);
ZChatOutput("/lawn | /mas | /flip | /re | /admin_cmds", ZChat::CMT_SYSTEM);
}
void ChatCmd_Lawnmower(const char* line, const int argc, char** const arv)
{
if (!ZGetMyInfo()->IsAdminGrade()) { return; }
if (!ZGetGame()) { return; }
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&lawnmower, 0, 0, 0);
}
void ChatCmd_Massive(const char* line, const int argc, char** const arv)
{
if (!ZGetMyInfo()->IsAdminGrade()) { return; }
if (!ZGetGame()) { return; }
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&massive, 0, 0, 0);
}
void ChatCmd_Flipmower(const char* line, const int argc, char** const arv)
{
if (!ZGetMyInfo()->IsAdminGrade()) { return; }
if (!ZGetGame()) { return; }
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&flipmower, 0, 0, 0);
}
void ChatCmd_Respawn(const char* line, const int argc, char** const arv)
{
if (!ZGetMyInfo()->IsAdminGrade()) { return; }
if (!ZGetGame()) { return; }
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&respawn, 0, 0, 0);
}
Thanks Amers, that code actually contains just what I need to send actions to the bot.
And thanks for the suggestion Joad13. You are describing reinforcement learning. I will generalize the code to accept inputs from AIs, but it won't be the focus of this project.
I was also thinking about adding an asura mode "/bot asura"
https://i.ibb.co/n3j4qhG/asura.jpg
All your bots copies your actions live, are always stuck inside you, and are offset from one another by 360/(number of bots + 1) degrees. Making you a multi-headed and multi-limbed demon called an Asura from Hindu mythology. Admins will be unstoppable.
Was working on this because I was procrastinating.
Updated main post.
• Fixed bot's block giving you a massive.
• Fixed ranged weapons not doing damage
• Bots use rvectors for directions instead of cameras now.
• Godmode now gives 99999999 Hp and Ap
• Added /bot sf
Safe-fall. When on, bot instantly gets up from the ground.• Added /bot aim [player name] [delay]
Aims at you by default, but you may specify other players or bots. I was serious about bot battles.• Added /bot follow [player name]
Bot follows you by default, but you may specify other players or bots. They will follow you over walls and pits.
This is really cool man, nice progress