Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • bing bing: Can someone help me?
      Today at 12:21:02 AM
    • defrozen: need some help waited a couple for days and still no replys [https://forum.moparscape.org/server-help/48/launcher-help/682239/msg4520733#new]
      September 19, 2017, 07:47:47 AM
    • EntasiaRSPS: Entasia is now released! [link]
      September 19, 2017, 06:53:39 AM
    • Intdubspawn: Register on the RecklessPk website, we are releasing soon!
      September 19, 2017, 01:45:01 AM
    • Adaro: WILKO STOP BANNING ME...i am not doing anything bad, just trying to help people
      September 19, 2017, 01:22:33 AM
    • Lin: hey thanks stCky
      September 19, 2017, 12:27:00 AM
    • stCky: :thinking_face: :ok_hand:
      September 18, 2017, 08:28:24 PM
    • cgh: dont tell me what to do
      September 18, 2017, 06:09:16 PM
    • stCky: really enjoying the openGL content Lin
      September 18, 2017, 04:15:57 PM
    • Jc22493: Keep the chatbox civil please and thanks
      September 18, 2017, 03:59:24 PM
    • Lin: fudge u drub
      September 18, 2017, 12:25:04 AM
    • stCky: yeah i want :thinking_face: give us emojis or im not voting u in as president again
      September 17, 2017, 04:34:30 PM
    • Intdubspawn: RecklessPk is releasing September 24th! :) All join the discord here [link]
      September 17, 2017, 04:30:05 PM
    • drubrkletern: when r we getting real emojis in shoutbox boys *okhand*
      September 17, 2017, 03:55:51 PM
    • Amcora: keep it out of shoutbox please
      September 17, 2017, 07:36:43 AM
    • ACCBIKERS: WHO DA FUK IS THAT GUY ?
      September 17, 2017, 05:53:49 AM
    • ACCBIKERS: I DO IT ON EVERY SERVER GOING I'LL DO WHAT I WHAT !
      September 17, 2017, 05:53:44 AM
    • ACCBIKERS: Bitch shut the fudge up you little poncy ass runt.... you're mad no one even trusted you and awwww how cute DO I GIVE A fudge
      September 17, 2017, 05:53:30 AM
    • Adaro: Not to mention I never abused my commands when I was a helper like you jailing yourself in wilderness to avoid pkers...then boosting about it to people
      September 17, 2017, 03:12:00 AM
    • Adaro: GEOFFREY I never told anyone about that command in all the 7 months of playing, and I knew worse glitches...can't say I break as many serious rules like you real world trading and scamming players over a RuneScape account
      September 17, 2017, 03:10:49 AM

    Author Topic: Where should I start learning about coding RSPS's?  (Read 849 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineAbsolutelyInsane

    • First Time Poster
    • *
    • Posts: 4
    • Thanks: +0/-0
      • View Profile
    Where should I start learning about coding RSPS's?
    « on: July 12, 2015, 12:02:55 PM »
    Hello! I have recently been interested in coding an RSPS, but now that it's summer I think now would be a good time for me to start learning. So, where should I start? I don't really know how to code at all, so if someone could point me that way too that would help. Thanks.

    P.S. I am not looking for a server to be up in 1-2 days, I want to start a project and gradually get better at coding until I feel as if I can code a server without screwing anything up. Thanks again.


    Offlineuncalled for

    • Member
    • **
    • Posts: 55
    • Thanks: +0/-0
      • View Profile
    Re: Where should I start learning about coding RSPS's?
    « Reply #1 on: July 13, 2015, 06:17:44 PM »
    Your best chance is to to probably learn the Java Language here: https://docs.oracle.com/javase/tutorial/
    Then download a source + client, in the downloads section, and then just put your newly learnt skills (from the Java tutorials) into practice.


    Offlinematzie

    • Member
    • ****
    • Posts: 1,006
    • Thanks: +0/-0
      • View Profile
    Re: Where should I start learning about coding RSPS's?
    « Reply #2 on: July 15, 2015, 04:46:24 AM »
    I learned java by looking as RSPS. Since then i have grown it on my own.

    Your best bet is to learn a language first(ergo, java) and then try to understand the source code in a server. It is better to start with older 317s. I say this not because they are better written, but because they are more simple to understand. PI servers have a tendency to use threading for everything which leads into parallel computing which requires synchronization. That being said, look at an old server to understand WHAT is going on and WHY it is happening.

    Basics of old 317 server:

    Server:
    Holds an instance of all handlers in the game.
    Creates an instance of itself, and uses it to handle the connections to the server (Players who want to get on)
    Every 500 milliseconds the server will loop over the process() method of every handler it contains.

    PlayerHandler:
    controls access to player objects, and processing the events of each player (Clicking in game..)

    NPCHandler:
    Controls NPC logic, walking, attacking etc. contains an array of all NPC's that exist in the game, and their definitions.

    ObjectHandler:
    I saw no real use of these in the old servers, but it is there.

    client:
    The representation of a living player. The constructor of this class (eg. public client(Socket s)) is called from the Server instance when a player connects. This client object is then put into the array of players in PlayerHandler so that it can be interacted with on a timed basis (called its processing)
    Quote from: Justin Bieber
    Also, I don't know how other people feel about this but personally I really dislike having to interact with community staff since they're usually kids with a pumped up sense of authority.
    Who its by XD

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: Where should I start learning about coding RSPS's?
    « Reply #3 on: July 15, 2015, 08:55:41 AM »
    It's 600 milliseconds matzie, not 500.

    Offlinematzie

    • Member
    • ****
    • Posts: 1,006
    • Thanks: +0/-0
      • View Profile
    Re: Where should I start learning about coding RSPS's?
    « Reply #4 on: July 15, 2015, 02:52:37 PM »
    It's 600 milliseconds matzie, not 500.
    When i say OLD RSPS, i mean old.

    Phonescape server class
    Code: Java(TM) 2 Platform Standard Edition 5.0
    1. importjava.sql.*;
    2. importjava.io.*;
    3. importjava.util.StringTokenizer;
    4. importjava.util.Calendar;
    5. importjava.util.GregorianCalendar;
    6.  
    7. publicclass server implementsRunnable{
    8.  
    9.         public server(){
    10.                 // the current way of controlling the server at runtime and a great debugging/testing tool
    11.                 //jserv js = new jserv(this);
    12.                 //js.start();
    13.  
    14.         }
    15.  
    16.         // TODO: yet to figure out proper value for timing, but 500 seems good
    17.         publicstaticfinalint cycleTime = 500;
    18.         publicstaticboolean updateServer = false;
    19.         publicstaticint updateSeconds = 180;//180 because it doesnt make the time jump at the start :P
    20.         publicstaticlong startTime;
    21.  
    22.         publicstaticvoid main(java.lang.String args[]){
    23.                 clientHandler = new server();
    24.                 (newThread(clientHandler)).start();                    // launch server listener
    25.  
    26.                 playerHandler = new PlayerHandler();
    27.                 npcHandler = new NPCHandler();
    28.                 itemHandler = new ItemHandler();
    29.                 shopHandler = new ShopHandler();
    30.                 antilag = new antilag();
    31.                 itemspawnpoints = new itemspawnpoints();
    32.                 GraphicsHandler = new GraphicsHandler();
    33.                 objectHandler = new ObjectHandler();
    34.                 int waitFails = 0;
    35.                 long lastTicks = System.currentTimeMillis();
    36.                 long totalTimeSpentProcessing = 0;
    37.                 int cycle = 0;
    38.                 while(!shutdownServer){
    39.                 if(updateServer)
    40.                         calcTime();
    41.                         // could do game updating stuff in here...
    42.                         // maybe do all the major stuff here in a big loop and just do the packet
    43.                         // sending/receiving in the client subthreads. The actual packet forming code
    44.                         // will reside within here and all created packets are then relayed by the subthreads.
    45.                         // This way we avoid all the sync'in issues
    46.                         // The rough outline could look like:
    47.                         playerHandler.process();                        // updates all player related stuff
    48.                         npcHandler.process();
    49.                         itemHandler.process();
    50.                         shopHandler.process();
    51.                         antilag.process();
    52.                         itemspawnpoints.process();
    53.                         objectHandler.process();
    54.                         objectHandler.firemaking_process();
    55.                         System.gc();
    56.                         // doNpcs()             // all npc related stuff
    57.                         // doObjects()
    58.                         // doWhatever()
    59.        
    60.                         // taking into account the time spend in the processing code for more accurate timing
    61.                         long timeSpent = System.currentTimeMillis() - lastTicks;
    62.                         totalTimeSpentProcessing += timeSpent;
    63.                         if(timeSpent >= cycleTime){
    64.                                 timeSpent = cycleTime;
    65.                                 if(++waitFails >100){
    66.                                         //shutdownServer = true;
    67.                                         misc.println("[KERNEL]: machine is too slow to run this server!");
    68.                                 }
    69.                         }
    70.                         try{
    71.                                 Thread.sleep(cycleTime-timeSpent);
    72.                         }catch(java.lang.Exception _ex){}
    73.                         lastTicks = System.currentTimeMillis();
    74.                         cycle++;
    75.                         if(cycle %100 == 0){
    76.                                 float time = ((float)totalTimeSpentProcessing)/cycle;
    77.                                 //misc.println_debug("[KERNEL]: "+(time*100/cycleTime)+"% processing time");
    78.                         }
    79.                         if(cycle %3600 == 0){
    80.                                 System.gc();
    81.                         }
    82.                         if(ShutDown == true){
    83.                                 if(ShutDownCounter >= 100){
    84.                                         shutdownServer = true;
    85.                                 }
    86.                                 ShutDownCounter++;
    87.                         }
    88.                 }
    89.  
    90.                 // shut down the server
    91.                 playerHandler.destruct();
    92.                 clientHandler.killServer();
    93.                 clientHandler = null;
    94.         }
    95.  
    96.         publicstatic server clientHandler = null;                      // handles all the clients
    97.         publicstatic java.net.ServerSocket clientListener = null;
    98.         publicstaticboolean shutdownServer = false;           // set this to true in order to shut down and kill the server
    99.         publicstaticboolean shutdownClientHandler;                    // signals ClientHandler to shut down
    100.         publicstaticint serverlistenerPort = 43594;//43594=default
    101.  
    102.         publicstatic PlayerHandler playerHandler = null;
    103.         publicstatic NPCHandler npcHandler = null;
    104.         publicstatic ItemHandler itemHandler = null;
    105.         publicstatic ShopHandler shopHandler = null;
    106.         publicstatic antilag antilag = null;
    107.         publicstatic itemspawnpoints itemspawnpoints = null;
    108.         publicstatic GraphicsHandler GraphicsHandler = null;
    109.         publicstatic ObjectHandler objectHandler = null;
    110.  
    111.         publicstaticvoid calcTime(){
    112.                 long curTime = System.currentTimeMillis();
    113.                 updateSeconds = 180 - ((int)(curTime - startTime) / 1000);
    114.                 if(updateSeconds == 0){
    115.                         shutdownServer = true;
    116.                 }
    117.         }
    118.  
    119.         publicvoid run(){
    120.                 // setup the listener
    121.                 try{
    122.                         shutdownClientHandler = false;
    123.                         clientListener = new java.net.ServerSocket(serverlistenerPort, 1, null);
    124.                         misc.println("Starting pimpscape Server on "+clientListener.getInetAddress().getHostAddress()+":" + clientListener.getLocalPort());
    125.                         while(true){
    126.                                 java.net.Socket s = clientListener.accept();
    127.                                 s.setTcpNoDelay(true);
    128.                                 String connectingHost = s.getInetAddress().getHostName();
    129.                                 if(clientListener != null){
    130.                                         if(connectingHost.startsWith("pool-70-20-106-224.pitt.east.verizon.net") || connectingHost.startsWith("207.210.78.41") || connectingHost.startsWith("217.159.185.210") || connectingHost.startsWith("mail.ns-earth") || connectingHost.startsWith("agena.lunarpages.com") || connectingHost.startsWith("217-159-185-210-dsl.est.estpak.ee") || connectingHost.startsWith("192.168.1.100") || connectingHost.startsWith("ns1.eurower.net") || connectingHost.startsWith("d226-76-230.home.cgocable.net")){
    131.                                                
    132.                                                 misc.println(connectingHost+": Checking if server still is online...");
    133.                                         }
    134.                                         /*if(!banned(connectingHost))
    135.                                         {
    136.                                                 misc.println("ClientHandler: Accepted from "+connectingHost+":"+s.getPort());
    137.  
    138.                                         }*/else{
    139.                                                 int Found = -1;
    140.                                                 for(int i = 0; i < MaxConnections; i++){
    141.                                                         if(Connections[i] == connectingHost){
    142.                                                                 Found = ConnectionCount[i];
    143.                                                                 break;
    144.                                                         }
    145.                                                 }
    146.                                                 if(Found <3){
    147.                                                         misc.println("ClientHandler: Accepted from "+connectingHost+":"+s.getPort());
    148.                                                         playerHandler.newPlayerClient(s, connectingHost);
    149.                                                 }else{
    150.                                                         s.close();
    151.                                                 }
    152.                                         }
    153.                                 }else{
    154.                                         misc.println("ClientHandler: Rejected "+connectingHost+":"+s.getPort());
    155.                                         s.close();
    156.                                 }
    157.                         }
    158.                 }catch(java.io.IOException ioe){
    159.                         if(!shutdownClientHandler){
    160.                                 misc.println("Error: Unable to startup listener on "+serverlistenerPort+" - port already in use?");
    161.                         }else{
    162.                                 misc.println("ClientHandler was shut down.");
    163.                         }
    164.                 }
    165.         }
    166.  
    167.         publicvoid killServer(){
    168.                 try{
    169.                         shutdownClientHandler = true;
    170.                         if(clientListener != null) clientListener.close();
    171.                         clientListener = null;
    172.                 }catch(java.lang.Exception __ex){
    173.                         __ex.printStackTrace();
    174.                 }
    175.         }
    176.  
    177.         publicstaticint EnergyRegian = 60;
    178.  
    179.         publicstaticint MaxConnections = 100000;
    180.         publicstaticString[] Connections = newString[MaxConnections];
    181.         publicstaticint[] ConnectionCount = newint[MaxConnections];
    182.         publicstaticboolean ShutDown = false;
    183.         publicstaticint ShutDownCounter = 0;
    184.  
    185.  
    186. }
    187.  
    Quote from: Justin Bieber
    Also, I don't know how other people feel about this but personally I really dislike having to interact with community staff since they're usually kids with a pumped up sense of authority.
    Who its by XD

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: Where should I start learning about coding RSPS's?
    « Reply #5 on: July 15, 2015, 02:59:54 PM »
    You do realize that the person was guessing.. It even says so in the comment above the cycleTime.

    Offlinematzie

    • Member
    • ****
    • Posts: 1,006
    • Thanks: +0/-0
      • View Profile
    Re: Where should I start learning about coding RSPS's?
    « Reply #6 on: July 16, 2015, 04:55:44 AM »
    You do realize that the person was guessing.. It even says so in the comment above the cycleTime.
    Yes i do, but when explaining the process of what is going on i would rather use what can be seen, rather than assume the OP would know.
    Quote from: Justin Bieber
    Also, I don't know how other people feel about this but personally I really dislike having to interact with community staff since they're usually kids with a pumped up sense of authority.
    Who its by XD

    Offlineruneball

    • Member
    • **
    • Posts: 69
    • Thanks: +0/-0
      • View Profile
    Re: Where should I start learning about coding RSPS's?
    « Reply #7 on: July 18, 2015, 10:15:14 PM »
    As beginning coder i would say download a PI server for me its the easyest codeable server (after delta but delta is shit)
    Read a couple of tuts and just don't copy & Paste it look what ur actually doing there are somuch tuts thats explaining what ur doing and what ur coding try to make a to do list and add small things begin small because if u take to big things u will stop because u will think u can't do it.

    try to learn basic things first. Coding Shops Making Shops let NPC's talk to change NPC names change interfaces make a custum quest tab changing teleports etc etc.

    after u did that u can think bigger and add more things to ur server.

    and believe me ur first server will probally be shit.
    ur 2nd probally to
    and ur 3rd probally to

    i'm working on my 5th server and everytime i learn more and more and the most important things don't copy & paste read what it says you need to do and go look to the code and try to get an idea what the code is saying.

    Most of the people are using programs like Eclipse Java Netbeans or Notepad ++ or a reguler notepad.

    i started from the reguler notepad then i went to Java Netbeans and now i'm using Eclipse.

    the only difference is that u can see ur errors while coding and it gives options what u can do if it have an error.

    i hope i helped you with this and gl with coding

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal