Jump to content

Artificial Intelligence for DST


Recommended Posts

As I've already discussed here, I'm working on an Artificial Intelligence to play DST.
My project was approved so I'll be working for it for my Master's Dissertation, which is nice :)

But as I started to try out modding (btw, it' really difficult to grasp everything without an API...) I've come to realize that everything in the game just happens around the player (do correct me if I'm wrong).

What I mean by this is, imagine that a player A is at (0,0,0) world coordinates and player B is at (1000,0,0), then things will only actually 'happen' around player A and B (I believe that the game only processes about two screen in distance around the player). This means that if a beefalo exists at (0,1000,0) he won't actually "exist" in the game at this given moment, right?
This being true, the beefallo, which is not inside the area of the game that needs to be 'processed', won't actually be moving, producing manure, etc. (aka, running it's associated behaviours/scripts).

This poses a problem in my case. In order to have an autonomous character, he'll need to exist (has in, run scripts) always, even if he is far away from a player. How do I accomplish this?
One solution would be the AI to be a player. Although I don't think this is a solution because I want players to be able to play with my character locally.
Or can I trick the game into thinking that a given entity is a player?
Or by using a dedicated server I can accomplish this?
Or is there another way to accomplish what I intend?

PS - right now I'm working to had a "brain" to the character that I'm playing, just to get the hang of modding and to get comfortable with everything
 

Link to comment
Share on other sites

@Hineios

The first half of your post is correct.

The range in which entities go into limbo "shut down" is about 76 units or 19 turf squares.

The pop in radius is 64 units, or 16 turf squares.

Entities in limbo do not simulate on the server, and only the entities that pop in and don't pop out exist on the client's side.

There might be some discrepancies with how the latest moon rock revealer thing works, not sure if the entity exists or if it's just a map thing.

 

As for manipulating where the simulation simulates I do believe that lies within the C-code realm for handling.

function EntityScript:RemoveFromScene()

Shoves the target edict into limbo state and it is being called from the process state rather than the LUA state.

 

This may be a feature you'd have to request to a developer at Klei for allowing of entities to act like players in terms of simulation constraints..

Link to comment
Share on other sites

Why is it necessary that the AI does not disappear?  I mean pigs also do disappear, but have a brain and so somewhat an "AI".
So I think it depends on what kind of AI you are working. 
Are you working at "bots" like the mod linked in your other thread ? How did the author of this solved the problem?
Or are you working basically on complex brains and behaviour for animals like pigs and such stuff?

Edited by Serpens
Link to comment
Share on other sites

2 hours ago, Serpens said:

Why is it necessary that the AI does not disappear?  I mean pigs also do disappear, but have a brain and so somewhat an "AI".
So I think it depends on what kind of AI you are working. 
Are you working at "bots" like the mod linked in your other thread ? How did the author of this solved the problem?
Or are you working basically on complex brains and behaviour for animals like pigs and such stuff?

It is my interpretation that the person wants to create full blown AI "players" running around the server such that their interactions are constantly going on regardless of who is there to see.

Link to comment
Share on other sites

@CarlZalph thanks for the insight!
And yes, that is what I want to achieve.

@Serpens my goal is to have a companion AI to play the game with the players. Not a pet, not a companion but a character capable of as much as a player. I don't want a simple complying character that will fetch you whatever you need, but will try to survive, alone or with help (by the player or other AI's). This mean that it'll be able to do exactly the same as a player. Imagine playing with other people, but instead of a human controlling the character you have an AI.

The final goal is to test it on a social level.
How do regular players feel when playing with it? Do people cooperate with the AI or compete? What level of communication must occur in order to have cooperation or competition?
These are all interesting questions for my research, but in order to study such a character it must be interesting enough for players (as in, be smart enough to play the game on it's own).

This being said, my goal now is to implement an AI that can play the game and see how much time (or how well) it survives.

Answering @Serpens your other question, the other modder was working on the original Don't Starve and he just added brains to his actual character. I've managed to do the same on DST and implemented a simple "wanderer" character. (it just wanders about not really doing nothing)

For now it is enough for me to start working, but I need to understand which limitations I'll have because I'd like to publish for the community to test and play with my AI.
 

Link to comment
Share on other sites

36 minutes ago, Hineios said:

@CarlZalph thanks for the insight!
And yes, that is what I want to achieve.

@Serpens my goal is to have a companion AI to play the game with the players. Not a pet, not a companion but a character capable of as much as a player. I don't want a simple complying character that will fetch you whatever you need, but will try to survive, alone or with help (by the player or other AI's). This mean that it'll be able to do exactly the same as a player. Imagine playing with other people, but instead of a human controlling the character you have an AI.

The final goal is to test it on a social level.
How do regular players feel when playing with it? Do people cooperate with the AI or compete? What level of communication must occur in order to have cooperation or competition?
These are all interesting questions for my research, but in order to study such a character it must be interesting enough for players (as in, be smart enough to play the game on it's own).

This being said, my goal now is to implement an AI that can play the game and see how much time (or how well) it survives.

Answering @Serpens your other question, the other modder was working on the original Don't Starve and he just added brains to his actual character. I've managed to do the same on DST and implemented a simple "wanderer" character. (it just wanders about not really doing nothing)

For now it is enough for me to start working, but I need to understand which limitations I'll have because I'd like to publish for the community to test and play with my AI.
 

thanks for explanation :)

Why don't you simplify your task, by making this AI for DS instead? I mean the main purpose is your Master Dissertation. And if you loose 1-2 months on figuring out the limitatons of DST (and maybe notice that it is impossible), you will loose important time for your Master Dissertation.

Link to comment
Share on other sites

The thing is, the main purpose is the social part, not the playing of DST.
Worst case scenario I'll test it "in house" with a PC running both the server and the AI and another one running the game for people to test it, but I'd rather make it available for the community and get feedback from you, but we'll see how it goes.

 

 

Link to comment
Share on other sites

So, I found something.

While going through some game files, I found prefabs/minimap.lua which has an interesting line of code:

inst.entity:SetCanSleep(false)

From what I understood this sets the this entity to not enter the Limbo state.

Went to try it out and it turns out it really does what is expected :D
So I guess this is the answer I was looking for.

 

However I have another question regarding brains.
I read somewhere in the forum that brains only run on the server (I can't find where though).
It actually makes sense since everything is replicated and random behaviour wouldn't be the same for different players (for example when pigs wander about their house), wtv.
I've been porting KinOfTown's brain into DST. I've kept his idea of using the brain as a button to toggle the brain on and off. However whenever a client tries to this, everything crashes.

So my question is, how do I tell the server "hey, switch this guy's brain please".
Any idea? What would be the correct way to implement this?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...