NpcSpawner lib - spawn basic NPCs

Discussion in 'Resources' started by Redecouverte, Feb 3, 2011.

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

    MatCat

    I am not even using the player move right now, if you look its not being used at all.

    Though it was the method I used before, and on 1.4 my previous method had no lag.

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

    przerwap

    Right, it is commented out, I was looking at the .jar, now looking at the git repo.
    If you don't experience any lag with the plugin disabled than its likely the chunk code.
    If you do experience lag with the plugin disabled than I would divert to any recently installed plugins.
     
  3. Offline

    MatCat

    No its just my plugin, and it lagged even when I had no code at all, I tested it on purpose at one point to just spawn all the NPC's reguardless chunk loaded or not, and no loops or checks, still lagged, this is something I did not experience on 1.4 with my plugin. So it's not the loading/unloading of the NPC Entity, Its not any loops that I can find because I made sure there where none, and even oddlyer is that it only lags on my live server (CentOS with 8x cores and 12gb of ram, 4gb allocated to server) not my testing serv (Windows 7 with dual cores and 3gb of ram (only 512mb allocated to test serv!). Now my live server has some java garbage collector optimizations, I even tried running the live with those off, either way it made no difference.

    I thought about it a lot, and I think the lag has something to do with the way the new lib provided by kezec? creates the Player entity, because I noticed he does it slightly differently then the original lib, or something is fooed with network handler.

    Considering that in my testing there are almost 100 NPC's, tracking 100 entities isn't much of a problem for the MC Server, heck if I do /butcher on my life I usually see about 600 to 700 mobs getting killed. ONly real difference is Player Entity is hooked into the network crap because its pretty much a fake player. I don't know how much overhead this produces or how it compares between 1.5 and 1.4. But going through my code I see no reason for the lag I get, and I see no evidence of what it could be either. The server's ram and cpu usage does not noticeably run any different compared to with or without the plugin!
     
  4. Offline

    przerwap

    I updated the lib, a few hours before that guy, for my own purposes but he posted his here so I didn't bother putting mine up.
    Well, here it is:
    http://dl.dropbox.com/u/13784935/stuff/NPC.zip
    You can try using that instead, but I must say that I haven't touched what used this code in about a week so the Bukkiteers could have changed some Method names as usual. But it worked last time I checked.
     
  5. Offline

    oleg

    where i put this npc folder in lib ?
     
  6. Offline

    MatCat

    I switched my code over today, I did get some kind of network error for each npc spawned, but it doesn't appear to happen otherwise and things seem to be working fine. I usually get fairly bad lag this time of night so it's kind of hard to tell but it doesn't seem lagged, and I don't think I've seen anyone complain...

    So I think all may be well!
     
  7. Offline

    fullwall

    @MatCat: the error is caused by not initialising the nethandler in CraftNPC in the constructor (it passes null, just create a fake nethandler and no errors caused).
     
  8. Offline

    Kekec852

    I did some research and spawn around 40 NPCs with only two players(me and friedn halping spawn NPCs) on server and ther was little lag. Than I restart server and spawn around 15 NPCs to prank players. There was no lag until another player join. Than even moving lag. So I restart server once again.

    So my conclusion is that lag comes from lib. But I think we need to understand that spawning NPC is very simular to player joining server.
     
  9. Offline

    MatCat

    Yes true but without internet delay / packets / client lag, all of these things come together in the overhead of a player, the players object on the server itself isn't laggy. With your lib I couldn't do crap, though the player connecting thing makes sense because on my test serv of me by myself no lag, but my live crazy lag. No lag at all with the original lib modified.
     
  10. Offline

    Kekec852

    It is not that differnet. Most parts are same. Except how NPC is spawnd ... But even that isn't that different.
    I'll test that method as well, to see if there is the problem.
     
  11. Offline

    jmonk

    Anyone had issues with NPCs disappearing?
     
  12. Offline

    fullwall

    @jmonk: they disappear with the chunk: you have to respawn them yourself.
     
  13. Offline

    tips48

    so is there a working lib, or do they all have extreme lag?
    and can someone tell me which one is working?
     
  14. Offline

    Kekec852

    Both lib are working and if you spawn around 50 - 150+ NPCs on some server you will experience lag. I test both libs and if you spawn too many NPCs both lag.
     
  15. Offline

    Pezmc

    Is this still functioning? I get errors with lots of inexistent imports
     
  16. Offline

    fullwall

    You need to edit it.
     
  17. Offline

    Pezmc

    Working on that, but I can't find all the calls to net.minecraft or bukkit.craftbukkit anywhere in Bukkit's JavaDoc, I am an experienced hMod developer but trying to get my head round Bukkit!

    Could you offer a slight hint perhaps?
     
  18. Offline

    fullwall

    The updated lib (with some modifications) is in the Citizens github. Apart from that, you can use the mc-dev branch in Bukkit's github.
     
  19. Offline

    Kekec852

    You need to add craftbukkit jar as lib to compile your plugin.
     
  20. Offline

    subanoomic

    I get these errors in eclipse with the latest version of Bukkit, Craftbukkit (as lib) and NPCLib:

    Am I the only one who gets these errors? Any ideas on how to solve them?
     
  21. Offline

    Qwasyx

    You get this error because lots of things changed in the minecraft version 1.6.6
     
  22. Offline

    subanoomic

    Thanks for the info. I hope there'll be an update in the near future.
     
  23. Offline

    matejdro

    Any news on 1.6.6 version? I would love to try this.

    Also, can this spawn any npc or just human?
     
  24. Offline

    Streammz

    Looking forward for 1.6.6, tried the citizens lib, but it got an huge amount of errors
     
  25. Offline

    ViciousCake

    I tried the citizens lib too, with the same result as Streammz.
    I might be doing something wrong though, since I'm not very experienced in java :)

    Anyways, hoping for a update soon :) Thanks!
     
  26. Offline

    fullwall

    The citizens lib has our own additions... just delete those and the errors will go away.
     
  27. Offline

    ViciousCake

    I tried, and i gave up :p Guess I'll be waiting for someone smarter then me to do it :p
     
  28. Offline

    enelar

    For noobs, how can i handle errors:
    Code:
    The import org.bukkit.craftbukkit cannot be resolved
    
    The import org.bukkit.entity.MobType cannot be resolved
    on strings
    Code:
    import org.bukkit.craftbukkit.CraftServer;
    import org.bukkit.entity.MobType;
    in Main.java, in example.

    and the same on 4 string in EEntiryListener.java?
     
  29. Offline

    Kekec852

  30. Offline

    ViciousCake

    Thank you for shareing Kekec852! I really appreciate it :)
     
Thread Status:
Not open for further replies.

Share This Page