|
ZRS3 is a RuneScape 3 framework built with NIO-based networking events using the reactor pattern.
ZRS3 was written from scratch by Emperor and myself, Expect to see so progress soon,
We will most update the revision when its necessary. I.E Invention, a few other game updates coming.
Revision: 862
Information
Treasure Hunter | Meteor Storm - News - RuneScape
15 Year Anniversary Celebrations!
- Game
- Engine
- Entity
- Player
- NPC
- Render
- World
- Objects
- Map
- Movement
- PathFinder
- NIO-Networking
- Event Producer
- Ondemand
- Handshake
- Login
- Game
- IO-Event Handling
- Write Events
- Completed count: 6
- In-progress count: 2
- Read Events
- Item Interactions
- NPC Interactions
- Object Interactions
- LoginServer
Note: Content will be listed when we have completed every packet completed.
Media
Example of code
Code:package org.avior.network; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.util.Iterator; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * Handles (NIO-based) networking events using the reactor pattern. * @author Emperor */ public final class NioNetwork implements Runnable { /** * The executor service. */ private final ExecutorService service; /** * The selector */ private Selector selector; /** * The socket channel. */ private ServerSocketChannel channel; /** * The I/O event handling instance. */ private final IoEventHandler eventHandler; /** * If the reactor is running. */ private boolean running; /** * Constructs a new {@code NioReactor}. * @param poolSize The pool size. */ private NioNetwork(int poolSize) { this.service = Executors.newSingleThreadScheduledExecutor(); this.eventHandler = new IoEventHandler(Executors.newFixedThreadPool(poolSize)); } /** * Creates and configures a new {@code NioReactor} with a pool size of 1. * @param port The port. * @return The {@code NioReactor} {@code Object}. * @throws IOException When an I/O exception occurs. */ public static NioNetwork configure(int port) throws IOException { return configure(port, 1); } /** * Creates and configures a new {@code NioReactor}. * @param port The port. * @param poolSize The amount of threads in the thread pool. * @return The {@code NioReactor} {@code Object}. * @throws IOException When an I/O exception occurs. */ public static NioNetwork configure(int port, int poolSize) throws IOException { NioNetwork reactor = new NioNetwork(poolSize); reactor.channel = ServerSocketChannel.open(); reactor.selector = Selector.open(); reactor.channel.bind(new InetSocketAddress(port)); reactor.channel.configureBlocking(false); reactor.channel.register(reactor.selector, SelectionKey.OP_ACCEPT); System.out.println("Server hosted on channel: " + reactor.channel.getLocalAddress()); return reactor; } /** * Starts the reactor. */ public void start() { running = true; service.execute(this); } @Override public void run() { while (running) { try { selector.select(); } catch (IOException e) { e.printStackTrace(); } Iterator<SelectionKey> iterator = selector.selectedKeys().iterator(); while (iterator.hasNext()) { SelectionKey key = iterator.next(); iterator.remove(); if (!key.isValid()) { key.cancel(); continue; } try { if (key.isAcceptable()) { eventHandler.accept(key, selector); } if (key.isReadable()) { eventHandler.read(key); } else if (key.isWritable()) { eventHandler.write(key); } } catch (Throwable t) { eventHandler.disconnect(key, t); } } } } /** * Terminates the reactor (once it's done processing current I/O events). */ public void terminate() { running = false; } }Code:package org.avior.network.packet.exec.modules; import org.avior.game.entity.player.Player; import org.avior.game.world.SceneGraph; import org.avior.network.packet.IoBuffer; import org.avior.network.packet.PacketHeader; import org.avior.network.packet.exec.WritablePacket; /** * @author James */ public class SceneGraphPacket implements WritablePacket<SceneGraph> { @Override public IoBuffer write(Player player, SceneGraph sceneGraph) { IoBuffer buffer = new IoBuffer(77, PacketHeader.SHORT); if (sceneGraph.isSendGPI()) { sceneGraph.loadGlobalPlayers(buffer); sceneGraph.setSendGPI(false); } buffer.putS(0); buffer.put(9); buffer.putShort(player.getLocation().getChunkY()); buffer.putLEShortA(player.getLocation().getChunkX()); buffer.putC(1); return buffer; } }
Wow was instantly attracted by the thread layout...good luck man!
James, you mean Invention right? rofl.
Not - Intention which means:
the thing that you plan to do or achieve : an aim or purpose
Will follow like I did for Avior and Zrs3
good luck James
I really want to find a few people who actually wanna learn, people that have self morals and respect other people and their different opinions, knowledge level and willing to teach someone help the other person doesnt understand well.
I want a team about 5 Including emperor and myself, By February/March you will be able to convert our from one revision to another.
This stuff includes
- Packet indentifcation
- Writing the packets server side
- able to located what you need, i.e dumps from rs, classes ect
An all around helping each-other server.
"NioNetwork.java" I'd reconsider a more logical name.. Also I'm going to assume you're using the packet read/write system I made, if so I'd like credits.
OT: Good luck.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |