Jump to content

A mob that acts as a collective consciousness?


The Great Duck

Recommended Posts

I am not too expirienced with this, but I am currently tinkering around with AIs so maybe this could be some way:

 

Look at the targeting AI, you could copy some things, and save all targeted entities (targeted by your robot mobs) into a list, and than create a method to choose which entity to target in the overall list.

Link to comment
Share on other sites

First of all you should read about http://minecraft.gamepedia.com/Spawn

Unless you don't want your mobs to despawn ever you should consider Despawns.

 

It'd be pointless to make links between entities. I'd rather go with WorldSaveData and hold big pool of everything your "army" collects there. WSD is saved into world (per world). Same as entities, in case of taleportig entity into other dimension it will start using other pool (from that world obviously).

 

You should know that you can't (shouldn't) load entities in chunks that are not loaded. Loading chunks that are not needed for server to work will cause massive lags on big maps considering your entity will be present in many places (again - read about Spawning on wiki).

 

To get entities in world you can simply get entityList (from world) and check instanceof, or hold your own (weak?) list in WorldSaveData that will be filled on entity spawn.

 

Ye, as to rest - you need to code your AI that will actually use that data, nothing to tell you here since idk what you want.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

First of all you should read about http://minecraft.gamepedia.com/Spawn

Unless you don't want your mobs to despawn ever you should consider Despawns.

 

First of all, how is that even relevant?

 

It'd be pointless to make links between entities. I'd rather go with WorldSaveData and hold big pool of everything your "army" collects there. WSD is saved into world (per world). Same as entities, in case of taleportig entity into other dimension it will start using other pool (from that world obviously).

 

Pointless because there are workarounds, or pointless because you just don't personally like it? That would make sense except for where I have no idea what this "WSD" is. (I know what it stands for, but I have no idea how to access it).

 

You should know that you can't (shouldn't) load entities in chunks that are not loaded. Loading chunks that are not needed for server to work will cause massive lags on big maps considering your entity will be present in many places (again - read about Spawning on wiki).

 

I'm aware of that. The entity won't be left spawned all the time (although, I might have them stay in the memory similar to how friendlier mobs don't despawn completely). The idea is that the one's that /are/ spawned are linked together, as well as any other's that spawn later on. I am well aware for the potential for lag.

 

Ye, as to rest - you need to code your AI that will actually use that data, nothing to tell you here since idk what you want.

 

Assuming I can get them to all see what each other sees, there is little I need to do with regards to AI. I recently saw a video where they greatly extended a zombies LOS and it was able to run through an entire labyrinth, so minecraft already has the potential for long-range seeing meelee mobs.

Link to comment
Share on other sites

Ok, so, here's the thing.

 

You need an object...er,

Object

that represents your hivemind and makes each Hive distinct from each other Hive.  If there's only one Hive, that's ok too, all we need to do is have a class that represents the collective, whether it be One or Many.

 

This object will be created on world load (or at the very least on startup, then have members inserted into it on world load and removed on world unload) and hold references to each currently active Entity within the Hive.  That is, when a chunk unloads and the Entity is saved to disk, the Hive needs to forget that it exists, because it can't do anything to it, so you may as well free up the RAM.

 

The point of this Hive

Object

is so that you have an upper level for your hive members to communicate through.  "I see the player" is emitted from one member, up to the hive, and back down to each other hive member.  "Can the hive see the player?" can then also be polled, asking the Hive and getting a response because the Hive

Object

stores those variables that you're interested in.  The Hive can also have its own AI task list, goals, and such just like any other Entity, but instead of being an Entity itself, it's merely an

Object

that interacts with the world through its myriad member Entities.

 

You can't just "create a hivemind" with entities and an AI task, you need to actually instantiate the hivemind as an object so that you can manage its goals, current tasks, and various members and provide a clean method of inter-member communication.

 

The alternative is far more complicated, and involves creating a set of rules that two members interacting with each other follow in order to determine what task each is carrying out and what needs to be done.  This is how real insect hives work: by statistical analysis of how many of its fellows its found performing a given task (indicated my pheromones*), an individual can discern what tasks are being under-performed and switch over to that task, maintaining a goal balance of workload.  Figuring out what rules and signals  you need is going to be far more work.

 

*This can be observed in ants by coating a living ant in the pheromone that says "I'm a dead body" and watching other ants pick up its fellow and hauling it to the garbage pile.  The victim ant will repeatedly attempt to clean itself and return to the colony only to get hauled back repeatedly (until the artificial scent is wiped clean again).  It reeks very much of "

" and shows off that each ant is actually unaware of what every other ant is doing, except by those pheromone signals and a small set of rules.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I think the way mobs like wolves and pets attack is pretty much the same as what you want to do. Basically, if one of the entities gets a target, then all of them in the nearby region also get the same attack target. I know you might say that is "communication", but really that is the same thing -- all of them collectively getting same target.

 

If you want to be literal about it and actually combine what they can all see, I think there is a canEntityBeSeen() method in the EntityLivingBase class. You could iterate through all your entities and check any of them can see the player.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Ok, so, here's the thing.

 

You need an object...er, Object that represents your hivemind and makes each Hive distinct from each other Hive.  If there's only one Hive, that's ok too, all we need to do is have a class that represents the collective, whether it be One or Many.

 

This object will be created on world load (or at the very least on startup, then have members inserted into it on world load and removed on world unload) and hold references to each currently active Entity within the Hive.  That is, when a chunk unloads and the Entity is saved to disk, the Hive needs to forget that it exists, because it can't do anything to it, so you may as well free up the RAM.

 

The point of this Hive Object is so that you have an upper level for your hive members to communicate through.  "I see the player" is emitted from one member, up to the hive, and back down to each other hive member.  "Can the hive see the player?" can then also be polled, asking the Hive and getting a response because the Hive Object stores those variables that you're interested in.  The Hive can also have its own AI task list, goals, and such just like any other Entity, but instead of being an Entity itself, it's merely an Object that interacts with the world through its myriad member Entities.

 

You can't just "create a hivemind" with entities and an AI task, you need to actually instantiate the hivemind as an object so that you can manage its goals, current tasks, and various members and provide a clean method of inter-member communication.

 

The alternative is far more complicated, and involves creating a set of rules that two members interacting with each other follow in order to determine what task each is carrying out and what needs to be done.  This is how real insect hives work: by statistical analysis of how many of its fellows its found performing a given task (indicated my pheromones*), an individual can discern what tasks are being under-performed and switch over to that task, maintaining a goal balance of workload.  Figuring out what rules and signals  you need is going to be far more work.

 

*This can be observed in ants by coating a living ant in the pheromone that says "I'm a dead body" and watching other ants pick up its fellow and hauling it to the garbage pile.  The victim ant will repeatedly attempt to clean itself and return to the colony only to get hauled back repeatedly (until the artificial scent is wiped clean again).  It reeks very much of "I'm not dead yet!" and shows off that each ant is actually unaware of what every other ant is doing, except by those pheromone signals and a small set of rules.

 

That's funny how you say that, because I was planning to somehow implement a leader (the only difficulty was seeing how that would work). Thank you very much.

 

If you want to be literal about it and actually combine what they can all see, I think there is a canEntityBeSeen() method in the EntityLivingBase class. You could iterate through all your entities and check any of them can see the player.

 

Would that also work for block entities? (doors, chests, walls, etc)?

Link to comment
Share on other sites

Block entities might be trickier, but there are ways to detect those too.

 

If world#getEntitiesInAABB(<Class>) doesn't work, you can just loop through the blocks "in range" and see if any of them have a TE and what kind of TE.  It's fast (0.6ms for a whole chunk worth of observation) but I still wouldn't do it very often.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.