Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

CMD error

Newbie Spellweaver
Joined
Jul 17, 2008
Messages
51
Reaction score
4
Currently experiencing this, any advice?


9k5R5Ct - CMD error - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Junior Spellweaver
Joined
Sep 11, 2014
Messages
181
Reaction score
76
server.maps.MapleMap:
Code:
private int runningOid = 100;

increase the number to like 100,000 or something

That's just the starting oid, pretty sure that will do nothing. In fact if you set that too high you might get that exception every time. There's a max oid when an object is set though. I didn't know it was even possible to run out though, since it reuses object ids right? Either way there shouldn't be a cap for OID since it just doens't make sense. It doesn't save memory at all. Still It's very surprising how you even managed to have the max oids at once since when you reach the max oid, it will start over and go back to the runningOid. Then it will loop and try to find a nontaken oid.
 
Upvote 0
Newbie Spellweaver
Joined
Jul 17, 2008
Messages
51
Reaction score
4
" private void incrementRunningOid() {
runningOid++;
if (runningOid >= 3000000) {
runningOid = 100000;//Lol, like there are monsters with the same oid NO " ? is that enough?


server.maps.MapleMap:
Code:
private int runningOid = 100;

increase the number to like 100,000 or something
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Jan 18, 2010
Messages
3,109
Reaction score
1,140
That's just the starting oid, pretty sure that will do nothing. In fact if you set that too high you might get that exception every time. There's a max oid when an object is set though. I didn't know it was even possible to run out though, since it reuses object ids right? Either way there shouldn't be a cap for OID since it just doens't make sense. It doesn't save memory at all. Still It's very surprising how you even managed to have the max oids at once since when you reach the max oid, it will start over and go back to the runningOid. Then it will loop and try to find a nontaken oid.

Oh, right, didn't see that.. In my Lithium source the runningOid was 500k, and there's no thrown exception for Out of OIDs.. Didn't see that Moople throws that exception when it's greater than 30k. You're right, that's actually really odd. It should be done like in Lithium, when you add a Map Object, it gets an int (newOid) which is an incremented runningOid, and then applies that newOid as the object.

PHP:
public final void addMapObject(final MapleMapObject mapobject) {
        runningOidLock.lock();
        int newOid;
        try {
            newOid = ++runningOid;
        } finally {
            runningOidLock.unlock();
        }

        mapobject.setObjectId(newOid);

        mapobjectlocks.get(mapobject.getType()).writeLock().lock();
        try {
            mapobjects.get(mapobject.getType()).put(newOid, mapobject);
        } finally {
            mapobjectlocks.get(mapobject.getType()).writeLock().unlock();
        }
    }

So, isn't that better than doing this? :
PHP:
public void addMapObject(MapleMapObject mapobject) {
        objectWLock.lock();
        try {
            mapobject.setObjectId(runningOid);
            this.mapobjects.put(Integer.valueOf(runningOid), mapobject);
            incrementRunningOid();
        } finally {
            objectWLock.unlock();
        }
    }

private void incrementRunningOid() {
        runningOid++;
        if (runningOid >= 30000) {
            runningOid = 1000;//Lol, like there are monsters with the same oid NO
        }
        objectRLock.lock();
        try {
            if (!this.mapobjects.containsKey(Integer.valueOf(runningOid))) {
                return;
            }
        } finally {
            objectRLock.unlock();
        }
        throw new RuntimeException("Out of OIDs on map " + mapid + " (channel: " + channel + ")");
    }

" private void incrementRunningOid() {
runningOid++;
if (runningOid >= 3000) {
runningOid = 100000;//Lol, like there are monsters with the same oid NO " ? is that enough?

Yes, that looks like correct to me.
 
Upvote 0
Junior Spellweaver
Joined
Sep 11, 2014
Messages
181
Reaction score
76
Running Oid needs a lock? Even if it wasn't threadsafe I don't see the problem of making it race conditions. You're just incrementing by 1, so there shouldn't be a problem with it.
 
Upvote 0
Back
Top