Thread: NetScape - C# Multi Rev RSPS

Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 31
  1. #11  
    Registered MrClassic

    MrClassic's Avatar
    Join Date
    Oct 2008
    Age
    26
    Posts
    1,967
    Thanks given
    16,954
    Thanks received
    410
    Rep Power
    5000
    Goodluck
    Thanks, MrClassic.

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. Thankful user:


  3. #12  
    what the dog doin

    mikan's Avatar
    Join Date
    Aug 2017
    Posts
    917
    Thanks given
    698
    Thanks received
    731
    Discord
    View profile
    Rep Power
    4898
    !!! gl
    Reply With Quote  
     

  4. Thankful users:


  5. #13  
    Mikan Fanboy



    Omar's Avatar
    Join Date
    Dec 2007
    Posts
    217
    Thanks given
    425
    Thanks received
    590
    Discord
    View profile
    Rep Power
    4734
    Appreciate the C# reference
    [Only registered and activated users can see links. ]

    Spoiler for aaaa:




    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. Thankful user:


  7. #14  
    Chemist

    Advocatus's Avatar
    Join Date
    Dec 2009
    Age
    28
    Posts
    2,549
    Thanks given
    192
    Thanks received
    761
    Discord
    View profile
    Rep Power
    1332
    Best of luck with this. I had never thought of using a HashSet like you did in [Only registered and activated users can see links. ] . This is fairly different from most of the approaches to the Player Update packet that are utilized currently. Is their a specific reason why you took this approach?
    Quote Originally Posted by blakeman8192 View Post
    Quitting is the only true failure.
    Reply With Quote  
     

  8. Thankful user:


  9. #15  
    Registered Member
    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    67
    Thanks given
    60
    Thanks received
    64
    Discord
    View profile
    Rep Power
    392
    Quote Originally Posted by Advocatus View Post
    Best of luck with this. I had never thought of using a HashSet like you did in [Only registered and activated users can see links. ] . This is fairly different from most of the approaches to the Player Update packet that are utilized currently. Is their a specific reason why you took this approach?
    Thanks,

    This was the way it was done in Apollo, however I did check over this and the RegionCoordinates have a specific hash code:
    Code:
    		public override int GetHashCode()
    		{
    			return X << 16 | Y;
    		}
    Doing stuff like HashSet.Contains(regionCoords) is a O(1) operation due to this. Compared to a list where the worst time could be O(N) where N is the size of the list.
    Also the HashSet prevents duplicates fairly quickly as opposed to a list where you have to check every item for a duplicate O(N) again.

    If you do have any alternatives which may be better please do let me know.


    Edit also i forgot:
    Code:
    .ToHashSet()
    will create a new HashSet of the already existing one. Like a shallow copy.
    Reply With Quote  
     

  10. Thankful user:


  11. #16  
    true

    DerekH's Avatar
    Join Date
    Dec 2011
    Age
    16
    Posts
    1,186
    Thanks given
    554
    Thanks received
    259
    Rep Power
    125
    Awesome, best of luck.
    Reply With Quote  
     

  12. Thankful user:


  13. #17  
    SEXY LYNCH

    Ethan's Avatar
    Join Date
    Feb 2016
    Age
    22
    Posts
    119
    Thanks given
    15
    Thanks received
    81
    Discord
    View profile
    Rep Power
    390
    Woah good fucking luck with this project brother!
    Reply With Quote  
     

  14. Thankful user:


  15. #18  
    Chemist

    Advocatus's Avatar
    Join Date
    Dec 2009
    Age
    28
    Posts
    2,549
    Thanks given
    192
    Thanks received
    761
    Discord
    View profile
    Rep Power
    1332
    Quote Originally Posted by JayArrowz View Post
    Thanks,

    This was the way it was done in Apollo, however I did check over this and the RegionCoordinates have a specific hash code:
    Code:
    		public override int GetHashCode()
    		{
    			return X << 16 | Y;
    		}
    Doing stuff like HashSet.Contains(regionCoords) is a O(1) operation due to this. Compared to a list where the worst time could be O(N) where N is the size of the list.
    Also the HashSet prevents duplicates fairly quickly as opposed to a list where you have to check every item for a duplicate O(N) again.

    If you do have any alternatives which may be better please do let me know.


    Edit also i forgot:
    Code:
    .ToHashSet()
    will create a new HashSet of the already existing one. Like a shallow copy.
    Haha. Whoops. Checking the github, there has been quite a few changes to the [Only registered and activated users can see links. ] class

    Checking the local copy of Apollo that I had checked the other day it had

    Code:
    package org.apollo.game.sync.task;
    
    import org.apollo.game.event.impl.RegionChangeEvent;
    import org.apollo.game.model.Player;
    import org.apollo.game.model.Position;
    
    /**
     * A {@link SynchronizationTask} which does pre-synchronization work for the specified {@link Player}.
     * 
     * @author Graham
     */
    public final class PrePlayerSynchronizationTask extends SynchronizationTask {
    
    	/**
    	 * The player.
    	 */
    	private final Player player;
    
    	/**
    	 * Creates the {@link PrePlayerSynchronizationTask} for the specified player.
    	 * 
    	 * @[Only registered and activated users can see links. ] player The player.
    	 */
    	public PrePlayerSynchronizationTask(Player player) {
    		this.player = player;
    	}
    
    	/**
    	 * Checks if a region update is required.
    	 * 
    	 * @[Only registered and activated users can see links. ] {@code true} if so, {@code false} otherwise.
    	 */
    	private boolean isRegionUpdateRequired() {
    		Position current = player.getPosition();
    		Position last = player.getLastKnownRegion();
    
    		int deltaX = current.getLocalX(last);
    		int deltaY = current.getLocalY(last);
    
    		return deltaX < 16 || deltaX >= 88 || deltaY < 16 || deltaY >= 88;
    	}
    
    	@Override
    	public void run() {
    		player.getWalkingQueue().pulse();
    
    		if (player.isTeleporting()) {
    			player.resetViewingDistance();
    		}
    
    		if (!player.hasLastKnownRegion() || isRegionUpdateRequired()) {
    			player.setRegionChanged(true);
    
    			Position position = player.getPosition();
    			player.setLastKnownRegion(position);
    
    			player.send(new RegionChangeEvent(position));
    		}
    	}
    
    }
    So yeah, big difference haha.
    Quote Originally Posted by blakeman8192 View Post
    Quitting is the only true failure.
    Reply With Quote  
     

  16. #19  
    Registered Member
    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    67
    Thanks given
    60
    Thanks received
    64
    Discord
    View profile
    Rep Power
    392
    Yeah quite a lot of branches for apollo easy to get mixed up . I do think how I combined the pre, update and post update stuff looks ugly as f, I will be separating it properly later on.
    Reply With Quote  
     

  17. #20  
    Officially Running

    Mr Dream's Avatar
    Join Date
    Dec 2013
    Posts
    1,738
    Thanks given
    491
    Thanks received
    274
    Discord
    View profile
    Rep Power
    761
    wow, very very nice ill follow this
    Reply With Quote  
     

Page 2 of 4 FirstFirst 1234 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Multi-rev support for 530
    By I am Montage in forum Buying
    Replies: 0
    Last Post: 10-05-2020, 11:36 PM
  2. Replies: 9
    Last Post: 11-24-2012, 04:38 PM
  3. Replies: 16
    Last Post: 10-09-2012, 10:47 PM
  4. Making Multi Pking Zone @ revs
    By romo173 in forum Help
    Replies: 0
    Last Post: 08-03-2012, 12:04 AM
  5. Replies: 13
    Last Post: 03-08-2011, 02:32 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •