Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2018-07-30 23:08:44, last edited by noob4lyfe (2018-07-30 23:09:33)

noob4lyfe
Guest

Creating Bot

If creating a rpg bot of some sort what should i use to keep track of items such as weapons that players have and also, what would be best way to save stats/weapons for characters on a file and best way to load them back into the game once i restart bot so players don't lose their stuff

#2 2018-07-30 23:13:12

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: Creating Bot

For my latest, discontinued project: EEArena, I used .json database files for each user that has ever joined the world. Here is the source code for it, if you want to take a few crucial elements from it.

The file consisted of the whole player class, which contained all the information about the player in the game, and in the bot system. I worked with the Newtonsoft.Json library.

Offline

Wooted by:

#3 2018-07-30 23:15:59

noob4lyfe
Guest

Re: Creating Bot

Thanks for the information, to store the information did you use arrays? Or dictionaries of some sort? If so, what's better and why?

#4 2018-07-30 23:21:59, last edited by LukeM (2018-07-30 23:23:01)

LukeM
Member
From: England
Joined: 2016-06-03
Posts: 3,009
Website

Re: Creating Bot

How much do you already know?
Do we need to start from the basics or have you already had programming / EE botting experience before?

Edit: Also what programming language are you using / going to use?

Offline

#5 2018-07-30 23:23:23

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: Creating Bot

I used a player array. I initialized it at startup with zero elements, then would resize it when a player joined. I'd then easily access the player object with Player[id].

That was written long ago, and I consider lists better to work with than arrays.

Offline

#6 2018-07-30 23:23:56, last edited by noob4lyfe (2018-07-30 23:25:06)

noob4lyfe
Guest

Re: Creating Bot

LukeM wrote:

How much do you already know?
Do we need to start from the basics or have you already had programming / EE botting experience before?

I already know a lot of the basics; I just want to get familiarized with what's better for storing information - like I've seen players use dictionaries for storing things that i'd put in arrays. So i was just trying to come to a conclusion on what's best for what.

HG wrote:

I used a player array. I initialized it at startup with zero elements, then would resize it when a player joined. I'd then easily access the player object with Player[id].

That was written long ago, and I consider lists better to work with than arrays.

Appreciate it!

#7 2018-07-30 23:26:30

LukeM
Member
From: England
Joined: 2016-06-03
Posts: 3,009
Website

Re: Creating Bot

What programming language are you using / going to use?

Offline

#8 2018-07-30 23:28:56

noob4lyfe
Guest

Re: Creating Bot

LukeM wrote:

What programming language are you using / going to use?

Currently using C# is there another one you would suggest - I do believe c++ doesn't have player.io library, if it does please correct me on this.

#9 2018-07-30 23:32:24

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: Creating Bot

There is a C++ PlayerIO library by Atilla, but it only works for managed C++, which is not recommended to use.

Offline

Wooted by:

#10 2018-07-30 23:35:04, last edited by LukeM (2018-07-30 23:37:31)

LukeM
Member
From: England
Joined: 2016-06-03
Posts: 3,009
Website

Re: Creating Bot

C# and JavaScript are the easiest to use IMO, C# is generally better for bots you just want to run yourself, and JavaScript is better for web based (and non Windows) bots as it can be run in your browser.

For C#, I prefer using a dictionary with integer (player ID) keys, as it allows you to remove players after they have left making it easier to iterate over, while with lists you would have to use some sort of null / disconnected check which might be a bit messy...

Offline

Wooted by: (3)
LukeM1532990104717077

Board footer

Powered by FluxBB

[ Started around 1732414318.0721 - Generated in 0.247 seconds, 13 queries executed - Memory usage: 1.45 MiB (Peak: 1.57 MiB) ]