EMC code Explained

Discussion in 'Community Discussion' started by just_five_fun, May 8, 2014.

  1. I am a better technical writer than entertainer, but some people might like to know stuff about how code works. Since EMC plugin code is closed source, no outsiders can look at it. We wouldn't want to give away everything, but in some cases we can say a lot.

    I found an example to start, and I know that we want to encourage people to use the groups feature and play together, so I think this is a good one to explain, it's also updated code that goes with the difficulty settings.

    If anyone has other questions, please ask, and I will work with Aikar to get approval to release an answer or even a little code for 'fun' now and then.

    So, this installment is on the xp sharing feature to groups.

    The first element of importance is range. Group members in a 64x64x64 block area get to share xp from individual mobs as they are killed. Outside the area, you keep all your own and nobody gets any extra for your effort. You arn't considered part of the group for xp sharing purposes if you are farther than 32 blocks in any direction from the mob death location. Perhaps interesting to the technical type, or maybe just trivia.

    ...BUT.. Combined with this next part, could become very useful.

    The second element is division of xp sharing. On a 1 by one basis, the following equation is used to share out a mobs xp drop. Each group member in range is given an even part of the xp or 1, whichever is greater. Any remainder is dropped as an orb and at least one orb is always dropped even if xp is evenly divided. With standard mobs, groups larger than 5 will be getting free xp for the 6th player and up, and also the one that is dropped. This isn't a lot, but it will apply to every single mob killed.

    An interesting concept is the xp from lesser mobs like chickens, which only give 1-3 xp each.

    Next time:
    Mob Difficulty calculation! (lots of actual code logic in this one)

    I will be interested in seeing what else people might want.
  2. Would be interesting to see some snippets of code via Gists. ;3
    technologygeek likes this.
  3. Interesting. :D I like learning more about how EMC really works.
    cadgamer101 and EquableHook624 like this.
  4. This next one is much more code than the first. This is actually a reissue of this information to get things started off. The next one is already written, but doing some cleanup to make the code a little more clear.
  5. Looking forward to it. Thank you for this.
    cadgamer101 likes this.
  6. So this is JavaScript or another EMC code language? Also are you guys code monkeys?
  7. Minecraft and the EMC plugin code are written in Java. JavaScript is for webpages. As for updating, I already gave this info to the team, and I don't know when it will be put into the wiki or how they will format it, but I am re-releasing it to the general public due to it already being written, and to introduce the concept before i release the next edition.
    cadgamer101, mba2012 and B4DMAN5IMON like this.
  8. This is some really interesting stuff. I'd love to see some more.
    cadgamer101 likes this.
  9. +1 on explanation.
    Ill have to start following you just_five_fun.
    Maybe like that ill stop hassling you with deep questions all the time. :p
    Can't wait for the next episode
    cadgamer101 likes this.
  10. Who doest?