Giant Elementals, A Crazy Idea that IS possible!

Discussion in 'WIP and Development Status' started by Splated, Apr 7, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    epicfacecreeper Do you want to make an ElementalAPI ? I have no idea how.
  2. Offline


    Splated ,I can help with that, if you are going to make an API, or an AI from scratch.
  3. Offline



    I been working on the config files the elementals can be created from .yml, I made 2 variations a bird like fire, and a tornado like air.

    Basicly the shape and animations can be player made, so if you wanted a End Elemental you can make a new file end.yml, make it of ender blocks, choose its special ability to be "teleport" make it look like a giant enderman. Then type /live end to create it.

    I havent gotten to the animation loading yet but that will be my next task.

    heres the shape of the default

    If anyone is interested, I could use help making the animations.
    TwerkinCraft and NathanWolf like this.
  4. Offline


  5. Offline


  6. Offline


    We're just negating the gravity atm but I think it would be a good idea to use flyingblocksapi.
  7. Offline


    Made it myself, I figured it out when I was making

    We can use it as a soft depend and use my way as a backup if it stops working.

    ill try to install it today if i have time.

    ase34 I tried to use flyingblocksapi but I couldn't find a way to move the block with the elemental.

    Ok for those of you who want to take a crack at making there own elementals heres the pre version.

    This is an alpha version and has lots of broken stuff so just play with it for now.

    I updated the elemental-config-file page.

    if anyone makes something cool send me the config file.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  8. Offline


  9. Offline


    It would be awesome to be inside one of these things controlling them.

    There are a number of "Avatar: the last Airbender" faction servers where you can earthbend, firebend, waterbend, airbend. It works pretty well for factions, because there's so much ways these benders can uniquely engage/disengage in combat. Anyhow, the point is, as you may know, there's an "Avatar" who can bend all of the elements. Usually this is a donor perk on these servers.

    Now, Imagine if you could enter the "Avatar State," which, in the TV series which this is based off of, basically has one of these elementals surrounding you. Video clip (spoilers!):
    NathanWolf likes this.
  10. Offline


    So are you guys going to share your source code, by any chance? I'd like to integrate with your plugin, I don't need a fully-formed API or anything, but if I can basically call whatever method is called when you do /live, and give it a specific location, that'd be awesome!

    The most recent version of my MagicWorlds plugin can be run stand-alone (without the Magic plugin), and I would love to add a rule that, if your plugin is present, can randomly spawn in Elementals like I do Automata. Then you could use those two plugins to make a world with natural elementals ... yeah!

    I would also love to make a Magic spell that summons an Elemental- but that's something you could actually add to your plugin (as a totally-optional Magic integration) if you'd be interested.

    I'd really love to use Magic and make a set up like Bobit for a bending server! Or... heck, that's something I'd love to do. I already have two servers, a third for bending might be fun :)

    But seriously, I love that series. My plugin comes preconfigured with templates for 3 levels of "bending" wand of each element, as well as an Avatar wand. I plan on (eventually..) making an "avatar state" spell.

    For me, I was going to have it do some cool effects (now that I read Bobit's ideas, having the player surrounded in a cloud of falling brocks would be really sweet...), make you levitate, and make all spells superpowered and cost-free (the avatar state itself would have a heavy mana drain on it). I'd also throw the "Summon Elemental" spell on the avatar wand if it existed ;)

    Annnnnnyway, that was a huge tangent. Mainly what I want to say is - "please share your code?" XD

    If you'd like help, I would be more than happy to get you set up! I can take the code, create a new GitHub organization (or add you two to mine, if you want - you could share my CI server, issue tracker, etc... up to you), set up a nice pom file ... all you'd have to do is install the GitHub app and you'd be up and running with some shareable open source awesomeness...... whaddya say? :)

    EDIT: I just read the performance notes on not having more than 1-3 elementals exist at a time... heh! Maybe, maybe naturally spawning is a bad idea then- but the spell could still be cool, if it was super OP and only allowed one elemental per player? In either case I'd love to see code :)
  11. Offline


    I like it.

    I did have the idea of forming an elemental on a player, but in my early experiments the player was blinded by the blocks flying around them, however now that theres more control over where the blocks are, it may be possible.

    Since the AI is far from done this may be a good way to get the plugin up and running sooner.

    Heres my thinking;

    • Animations are played to match the players movement. Then later when the AI is working the same animations are played by the AI.
      • jumping
      • crouching
      • sneaking
      • hovering
      • flying
      • walking
      • sprinting
      • standing
      • attacking
      • death
      • life
      • Special moves ( Not sure how the player will trigger this, control rods?)
    • The players damage is transferred to the elemental, until the elemental dies.
    • I can't have the player hovering unless they have flying, they will need to be on the ground.
    • Arrows should be deflected by the flying blocks working like a shield.
    • If the block explosion is enabled the player will need some immunity to it, but can tnt traps be used vs the player?
    • If the player moves too fast the blocks won't be able to keep up.
    I should be able to have this working today the code for control via cow is still in there just need to change it to a player.

    I'm not ready to have the code public but I want to have an api so other plugins can use it.

    As for performance, I cleaned up the flying block code a lot and you can do more with a lot less blocks. Now the performance problems seem to be client side now and having too many blocks on the screen at the same time.

    The limits are now set in the config files so you can crank up the golem counts and block safeguards.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  12. Offline


  13. Offline


    ok code is change is done just need to fix a few things in the animation files and its done
  14. Offline


    I just tried out the plugin for a bit (I'll share a video a little later), very fun!

    Super destructive though! You may want to make block damage off by default? I know there's a config option for it already.

    I tested out using various spells to try and kill it. Push and Pull were kind of funny but the arrow spells were the only ones that were effective. Do you react to other projectile hit events? Reacting to explosions would be cool, too, if possible!
  15. Offline


    They do react to explosions, make one under water and it will react to its own explosion.

    I have the next major update

    Added some examples of possible options fire wings and shield

    Firewings.yml Firewings will pop out of the players back when they are flying and have a crapy flap animation.

    Shield.yml will create a spinning sphere of blocks around the player when they block with a sword.

    ill post a video when i get a chance
    NathanWolf likes this.
  16. Offline


    Well I threw quite a few overpowered tnts at it, as well as generated some big explosions directly. It does shuffle the blocks around a bit, but I more meant it ought to be able to kill them. Though I guess if they cause explosions themselves that's not going to work out.

    Do you know why a fireball or wither skull doesn't hurt them? Is that on purpose?
  17. Offline


    New blocks are made ever 5 ticks, old blocks are removed if they reach there destination or are older the 100 ticks.

    i don't think fireballs or skulls effect falling sand other then push them.

    Next big task is catching if a block is hit with a sword.

    and this Nightmare task of AI.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  18. Offline


    Moved to a more appropriate section.
  19. Offline


    NathanWolf All projectiles should hurt elementals now. I would like to make an API, but it's is still way in development, the code is messy and you can only have one elemental. But it is definitely on my to-do list.
    NathanWolf likes this.
  20. Offline


    epicfacecreeper NathanWolf is now one of us! (Chanting) one of us! one of us!

    You check out the last batch of changes?
    NathanWolf likes this.
  21. Offline


    I am indeed!

    I can help add in some simple AI, if you want, not sure what you had in mind. I haven't done too much in this area (personally or professionally, AI is so rarely a backend task!)- my Automata are kind of dumb and simple, they basically choose a target entity based on the direction they're "looking" in, distance, entity type (preferring Players), etc. They lock on and move towards that target in a straight line.

    This is kind of a cheat, AI-wise, because the automaton's blobiness and general randomness of their core algorithm means they're actually pretty flexible about moving over or around obstacles- I want to add some additional logic for some special cases where they get stuck, but in general a lot of the awesomeness there is that I didn't have to do anything, they are kind of ... well autonomous :)

    Anyway, I'd love to help if I can! I was thinking of looking at making a simple API first, mainly because I selfishly want to integrate ... in some way :)

    I'm not so sure about the natural spawning thing now, but maybe some kind of "boss fight" random event. Still pondering.

    epicfacecreeper That's awesome! Exactly what I meant about projectiles. If I were to, say, want to add these to a Magic world, I'd want there to be as many ways for Mages to kill them as possible. That'll add 4 or 5 more spells that'll work, on top of the 3 arrow-based spells. If we could get some way for TNT and explosion-based spells to work also, that'd be sweet- not sure how that'd work if they are generating their own explosions, though.

    Oh, btw, here's me testing and having fun:

  22. Offline


    Nice video i think the new Shield and Fire wings will fit well in your world.

    I found a basic pathfinder, The code was old and still used blockIDs, but i managed to break it when I was updating, I disabled it for the player ride update. however its a place to start, if i can mod it to take in account the Elementals width we won't need the block explosions any more.

    I used the ender dragons cheater way of handling pathfinding around blocks, DON'T just blow them up!
  23. Offline


    What is your main goal in the AI? I mean, how would you like them to move around? Should they climb over smallish obstacles, attempt to walk around larger ones, that sorta thing?

    I think you can do a lot of that with a couple of BlockIterators (maybe a few since they're so big) and some pretty simple logic - I'm not sure you need anything complex like AStar, though again this isn't totally my area :)

    Do you think people would make use of an API for this plugin? I think so! I was thinking it could start with something like this:

    1. package info.nothingspecial.api.elementals;
    3. import org.bukkit.Location;
    4. import org.bukkit.command.CommandSender;
    5. import org.bukkit.entity.Entity;
    7. /**
    8. * This is the public API for the Splateds_Elementals plugin.
    9. *
    10. * It can be used to spawn, destroy, control, etc Elementals.
    11. *
    12. */
    13. public interface ElementalsAPI {
    15. /**
    16.   * Create an Elemental of a specific type at a certain location.
    17.   *
    18.   * @param location The location at which to create the elemental.
    19.   * @param templateName The name of the elemental's template description
    20.   * @param creator The creator of the elemental, may be null.
    21.   * @return False on failure, such as if there are already too many elementals in the world.
    22.   */
    23. public boolean createElemental(Location location, String templateName, CommandSender creator);
    25. /**
    26.   * Check to see if the given Entity is an Elemental, or part of an Elemental.
    27.   *
    28.   * @param entity The entity to check
    29.   * @return true if this Entity is an Elemental, or part of one.
    30.   */
    31. public boolean isElemental(Entity entity);
    33. /**
    34.   * Damage the Elemental represented by the given Entity.
    35.   *
    36.   * @param entity The entity to use to determine which Elemental to damage.
    37.   * @param damage The amount of damage to apply.
    38.   * @param fireTicks The duration of fire, if any, to apply.
    39.   * @param attacker The attacker, initiator of damage. May be a command block or console, or null.
    40.   * @return False if the entity is not a living Elemental.
    41.   */
    42. public boolean damageElemental(Entity entity, double damage, int fireTicks, CommandSender attacker);
    43. }

    I'd like to use this, maybe, to:
    • Have certain spells like Disintegrate be able to directly damage Elementals. Would need to test performance of targeting all those blocks though.
    • Have Automata track down and attack Elementals
    • Make a Spell that summons an Elemental
    • Somehow introduce elementals naturally into the game- maybe have one that randomly roams around and tp's to players... not sure
    Any other ideas? What would people like to see out of an API for this plugin?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  24. Offline


    aStar seems to work fast when i played with it. Just need to fix what I broke.

    The flying blocks tend to snag on trees so a way to prevent that would be nice.

    AI goals:

    • idle wandering
    • Path find to target enemys
    • choose a range or melee attack
    • if path to target is blocked smash something (like a house ) or a wall
    • have a configurable options like aggressive defend, guard, flying
    • seek block types for healing or weapons

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  25. Offline


    AI idea: spawn an invisible mob, use it to move the elemental?

    Basically avoid having to implement AI, maybe? :)
  26. Offline


    Originally it was an iron golem but yes it works i just want more control and i have problems with reflection.
    NathanWolf likes this.
  27. Offline


    Oh! Well I guess you thought of that already :)

    Well I can help with reflection, but I think for custom entities or entity AI you have to build against CB and can't use reflection. I'm not sure though, I haven't don't this myself.

    EDIT: though I guess once you're making custom AI, you don't need the entity anymore, so it's a moot point. And we are back where we started...
  28. Offline


    My suggestion is extend a Zombie or something and give it custom PathfinderGoals. That'll handle pathing and stuff.
    NathanWolf likes this.
  29. Offline


    You can change the path goals of a mob, I did it with this but i had to include NMS which i hate doing because it requires you to update the code every time, anything changes.

    I tried to recreate this with reflection but never could get it to work. If one of you gets it working we can use a any mob as our Path finder. if not the AStar will work.

    2. import net.minecraft.server.v1_7_R1.EntityCreature;
    3. import net.minecraft.server.v1_7_R1.Navigation;
    4. import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature;
    8. boolean gohere(Entity entity, Location home, int speed){
    10. EntityCreature ec = ((CraftCreature)entity).getHandle();
    11. Navigation nav = ec.getNavigation();
    13. return nav.a(home.getX(),home.getY(),home.getZ(),speed);
    14. }

    I think we still need an AI of some type, a zombie won't range attack a target, a skeleton won't melee, A spiders bounding box and wall climb may be useful. a Gast for flying, can we override its attack?

    We will still need AI for the hate lists and what abilities to use and range to target.
    Can we access minecrafts source AI code, A brain transplant?

    I think our own AI is best option but a lot of work.
  30. Offline


    public boolean gohere(Entity entity, Location home, int speed) throws Exception
            Class< ? > EntityCreature = getCraftClass("EntityCreature");
            Class< ? > Navigation = getCraftClass("Navigation");
            Method getNavigation = getMethod(EntityCreature , "getNavigation");
            Method a = getMethod(Navigation , "a" , new Class< ? >[]
            { double.class , double.class , double.class , double.class });
            Object ec = getHandle(entity);
            Object nav = getNavigation.invoke(ec);
            return (boolean) (Boolean) a.invoke(nav , home.getX() , home.getY() , home.getZ() , speed);
        public static Class< ? > getCraftClass(String ClassName)
            String name = Bukkit.getServer().getClass().getPackage().getName();
            String version = name.substring(name.lastIndexOf('.') + 1) + ".";
            String className = "net.minecraft.server." + version + ClassName;
            Class< ? > c = null;
                c = Class.forName(className);
            catch (ClassNotFoundException e)
            return c;
        public static Object getHandle(Object entity)
            Object nms_entity = null;
            Method entity_getHandle = getMethod(entity.getClass() , "getHandle");
                nms_entity = entity_getHandle.invoke(entity);
            catch (IllegalArgumentException e)
            catch (IllegalAccessException e)
            catch (InvocationTargetException e)
            return nms_entity;
        public static Method getMethod(Class< ? > cl, String method, Class< ? >[] args)
            for ( Method m : cl.getMethods() )
                if ( m.getName().equals(method) && ClassListEqual(args , m.getParameterTypes()) )
                    return m;
            return null;
        public static Method getMethod(Class< ? > cl, String method)
            for ( Method m : cl.getMethods() )
                if ( m.getName().equals(method) )
                    return m;
            return null;
        public static boolean ClassListEqual(Class< ? >[] l1, Class< ? >[] l2)
            boolean equal = true;
            if ( l1.length != l2.length )
                return false;
            for ( int i = 0; i < l1.length; i++ )
                if ( l1[i] != l2[i] )
                    equal = false;
            return equal;
    there you go :)
    Splated likes this.
Thread Status:
Not open for further replies.

Share This Page