User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: [2.xx] Expanded void Remove()

  1. #1
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%

    [2.xx] Expanded void Remove()

    Internalise void Remove() so that it entirely kills any pointer object.

  2. #2
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    37
    Posts
    4,436
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,560
    Level
    30
    vBActivity - Bars
    Lv. Percent
    51.71%
    Quote Originally Posted by ZoriaRPG View Post
    Internalise void Remove() so that it entirely kills any pointer object.
    What exactly are you having problems removing?

  3. #3
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    Remove() does not fully invalidate pointers for datatypes ffc, item, lweapon, eweapon, and uses a substandard way to remove npc pointers. Have a look at what void Remove() does, and you'll understand.

    An internal Remove() would fully remove the pointer.

  4. #4
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    37
    Posts
    4,436
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,560
    Level
    30
    vBActivity - Bars
    Lv. Percent
    51.71%
    Quote Originally Posted by ZoriaRPG View Post
    Remove() does not fully invalidate pointers for datatypes ffc, item, lweapon, eweapon, and uses a substandard way to remove npc pointers. Have a look at what void Remove() does, and you'll understand.

    An internal Remove() would fully remove the pointer.
    Why would you need to remove the pointer? I know what Remove() does. I just fail to see what problem you have. Remove() doesn't do anything with pointers it gets rid of what they point to.

  5. #5
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    Quote Originally Posted by SUCCESSOR View Post
    Why would you need to remove the pointer? I know what Remove() does. I just fail to see what problem you have. Remove() doesn't do anything with pointers it gets rid of what they point to.
    Because isValid() still returns that the pointer exists, even if you do Remove(), and for loops still scan it, which lengthens loop time.

    I wrote other functions to cover this, but it's still optimal to actually remove the pointer when it's no longer needed.

  6. #6
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,815
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,933
    Level
    33
    vBActivity - Bars
    Lv. Percent
    23.45%
    Quote Originally Posted by SUCCESSOR View Post
    Why would you need to remove the pointer? I know what Remove() does. I just fail to see what problem you have. Remove() doesn't do anything with pointers it gets rid of what they point to.
    Remove is actually a bit of a hack. It doesn't really remove the object, it just makes it so that the next frame ZC will see that it should be removed (deleted). Internalizing it is actually a good suggestion, though actually deleting it might be bad. (Like my pappy used to say: Don't change horses midstream.)
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  7. #7
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    37
    Posts
    4,436
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,560
    Level
    30
    vBActivity - Bars
    Lv. Percent
    51.71%
    Quote Originally Posted by Gleeok View Post
    Remove is actually a bit of a hack. It doesn't really remove the object, it just makes it so that the next frame ZC will see that it should be removed (deleted). Internalizing it is actually a good suggestion, though actually deleting it might be bad. (Like my pappy used to say: Don't change horses midstream.)
    I get that. I know its a hack. I just don't see the useful difference to ZoriaRPG if it is internalized or not.

    Quote Originally Posted by ZoriaRPG View Post
    Because isValid() still returns that the pointer exists, even if you do Remove(), and for loops still scan it, which lengthens loop time.

    I wrote other functions to cover this, but it's still optimal to actually remove the pointer when it's no longer needed.
    So you want it to remove objects faster? Or are you saying you want if(pointer) to evaluate to false if it is invalid?

  8. #8
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    Right, isValid() should evaluate false when a pointer is specifically removed.Iit would avoid the hack-ish methods that I'm using to determine if it should be skipped. Again, for loops (especially with a Waitframe(), as those can become cumulative) would be optimised if pointers are removed. It would allow the loop to advance in the same frame, and wouldn't require workarounds for multiple loops that run per frame.

    If you're curious, here is a set of utility functions that I use with the present Remove() function:


    Code:
    ///Used to check if any given pointer is on screen. Move pointers to X = 32768 to effectively kill them with void Remove().
     bool isOnScreen(item i){
    	if( i->isValid() && i->X != 32768 ) {
    		return true;
    	}
    	return false;
    }
    
     bool isOnScreen(ffc f){
    	if( f->Data > 0 && f->X != 32768 ) {
    		return true;
    	}
    	return false;
    }
    
     bool isOnScreen(npc n){
    	if( n->isValid() && n->X != 32768 ) {
    		return true;
    	}
    	return false;
    }
    
     bool isOnScreen(eweapon e){
    	if( e->isValid() && e->X != 32768 ) {
    		return true;
    	}
    	return false;
    }
    
    bool isOnScreen(lweapon l){
    	if( l->isValid() && l->X != 32768 ) {
    		return true;
    	}
    	return false;
    }
    I use those, in place of isValid(), which works for the present, but it would still be better to remove the pointers. They otherwise just use stack/ heap space anyway.

    Again, it's a request for the future. It would be cleaner to remove the pointers, rather than moving them off-screen.

    I can see how deleting the ZScript void Remove might be bad, if anything depends on it.

    You could do void Rem() for the internal side, to prevent compatibility conflicts.

  9. #9
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    37
    Posts
    4,436
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,560
    Level
    30
    vBActivity - Bars
    Lv. Percent
    51.71%
    So basically what you are saying is you want to remove objects without waiting a frame. You could have just said that.

  10. #10
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    Quote Originally Posted by SUCCESSOR View Post
    So basically what you are saying is you want to remove objects without waiting a frame. You could have just said that.
    I could have, and then answered other questions from someone else, about why I don't want to wait a frame...

    It's low priority, and for the record, I'll make suggestions for improvements, even if they don't directly pertain to my own goals. In this case, I have utility functions that mimic the behaviour that I need, but I've run into instances in other projects where this became an issue. That notwithstanding, I would likely have made this suggestion in time, simply because if a user can create a pointer, they should be able to directly remove it. It's tidier that way.

    When was I required to have reasons, anyway?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social