Thread: [Broken]: Jython 317 RuneScape Emulator - Help fixing?

Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1 [Broken]: Jython 317 RuneScape Emulator - Help fixing? 
    brb ridin da storm

    blakeman8192's Avatar
    Join Date
    Dec 2012
    Age
    28
    Posts
    2,010
    Thanks given
    802
    Thanks received
    1,357
    Rep Power
    286
    As a fun project/learning experience I decided that I would write a server almost entirely in Python except use the JVM to run it through the Jython library (believe it or not, Jython runs much faster than standard Python because it benefits from the dynamic optimizations that the HotSpot JVM provides).

    Some Benefits:
    • Easy to develop with (you can literally learn Python in a few hours)
    • No need to compile your code - no need for the JDK
    • Extremely lightweight source code (the jython library jar is 1.8MB though)
    • Very fast compared to standard Python
    • Very simple source code.
    • Easy "packaging", because of recursive script loading in the Engine, you can throw any scripts into any amount of sub-folders for organizational purposes and they will all be loaded the same. (also, no need for a "package" statement).


    The server uses a very lightweight asynchronous networking library written in Java that I have made (called Helios). The jar has the source code in it, but there is no JavaDoc documentation. Feel free to use it in other projects. It has an Engine.jar (source files are in the jar) which contains the main Java code which loads all Python scripts into the interpreter (which then compiles them into bytecode) and calls the "bootstrap" method inside the interpreter.

    However, because I am not nearly as good with Python as I am with Java, I have been unable to complete this source: I'm stuck on parsing incoming packets after login. So I'm asking you guys to do your best and take a shot at fixing it. If you fix it, major props to you and we can move on with developing this baby.

    (mods: this stands apart from downloads/projects/help threads because it's unique compared to other servers and this main section in general will have a better response towards helping out. If it's in the projects section, nobody will look. If it's in the downloads section, nobody will use it as they're looking for complete sources. And if it's in the help section, well I wont get any useful help)

    Download: [Only registered and activated users can see links. ]

    I also thought it'd be kinda neat to just give this out as an example that we are not restricted to Java in this community.

    Good luck!
    rest in peace Qemist, Izzy, TeChNo PuNk, Impulser, & bootnecklad
     

  2. #2  
    Member
    Nour's Avatar
    Join Date
    May 2007
    Posts
    472
    Thanks given
    127
    Thanks received
    61
    Rep Power
    569
    looks cash, i may try my hand at it
    RIP Emps-scape 2006-2013.
    [SPOIL]
    [/SPOIL]

    i need 2 herd sum bots
    i need 2 steal sum zombies
    i need 2 open many slots
    to hold my ****in zombies
     

  3. #3  
    Previously Hyperion


    Join Date
    Jan 2009
    Posts
    1,254
    Thanks given
    3
    Thanks received
    18
    Rep Power
    138
    Gonna check it out, what ive seen of python though i generally dont like it, feel more comfortable with java.

    [Only registered and activated users can see links. ]
     

  4. #4  
    Registered Member

    Join Date
    Oct 2007
    Posts
    2,413
    Thanks given
    254
    Thanks received
    479
    Rep Power
    2785
    Quote Originally Posted by Mental Piracy View Post
    Gonna check it out, what ive seen of python though i generally dont like it, feel more comfortable with java.
    I'll second that.
     

  5. #5  
    Banned

    Join Date
    Mar 2008
    Posts
    2,595
    Thanks given
    128
    Thanks received
    191
    Rep Power
    0
    Scripting languages ftl.
     

  6. #6  
    Renown Programmer
    veer's Avatar
    Join Date
    Nov 2007
    Posts
    3,747
    Thanks given
    354
    Thanks received
    1,368
    Rep Power
    3032
    fast compared to standard python... um no

    Code:
    class OutLogger(object):
        def __init__(self):
            self.out = sys.stdout
            self.outlog = open("./logs/out.log", "a")
            
        def write(self, message):
            self.out.write(message)
            self.outlog.write(message)
    
    class ErrLogger(object):
        def __init__(self):
            self.err = sys.stderr
            self.errlog = open("./logs/err.log", "a")
            
        def write(self, message):
            self.err.write(message)
            self.errlog.write(message)
    l2 inheritance

    also you don't have to use getters/setters from jython
     

  7. #7  
    Renown Programmer
    Join Date
    Dec 2008
    Posts
    363
    Thanks given
    1
    Thanks received
    28
    Rep Power
    74
    p.s. faster than slow != fast
    [Only registered and activated users can see links. ]
     

  8. #8  
    brb ridin da storm

    blakeman8192's Avatar
    Join Date
    Dec 2012
    Age
    28
    Posts
    2,010
    Thanks given
    802
    Thanks received
    1,357
    Rep Power
    286
    ps you guys are idiots, it's compiled into bytecode and not interpreted through the python interpreter
    rest in peace Qemist, Izzy, TeChNo PuNk, Impulser, & bootnecklad
     

  9. #9  
    Registered Member

    Join Date
    Feb 2009
    Posts
    554
    Thanks given
    7
    Thanks received
    19
    Rep Power
    340
    Well, it is most certainly different...

    Edit - again

    Code:
    	def handle(self):
    		session = self.session
    		session.getInBuffer().flip()
    		if session.getInBuffer().remaining() == 0:
    			return
    		inBuffer = session.getInRSBuffer()
    		inBuffer.reset(session.getInBuffer().array(), session.getInBuffer().remaining())
    		if inBuffer.getOpcode() != -1:
    			self.opcode = inBuffer.getOpcode()
    			print "Opcode: ", self.opcode
    		if RSBuffer.packetSizes[self.opcode] != -1:
    			self.size = RSBuffer.packetSizes[self.opcode];
    			print "Size: ", self.size
    		if self.size == 0:
    			return;
    		for i in range(0, self.size):
    			print "Data: ", inBuffer.get()
    			self.payload.add(inBuffer.get())
    			self.opcode = -1
    			self.size = -1
    			self.payload.clear()
    			session.getInBuffer().clear()
    From that I get:

    Code:
    Loading scripts...
            Loaded script: Main.py
            Loaded script: Protocol.py
            Loaded script: Server.py
            Loaded script: Session.py
            Loaded script: Logger.py
    Bootstrapping Jython RuneScape Emulator...
    Binding listener address -  127.0.0.1 : 43594
    Server running!
    Accepting connection from: 127.0.0.1
    Logged in user successfully.
    Logged in user successfully.
    Opcode:  174
    Size:  0
    Opcode:  220
    Size:  0
    Opcode:  138
    Size:  0
    Opcode:  207
    Size:  0
    Opcode:  105
    Size:  0
    Opcode:  66
    Size:  0
    Opcode:  39
    Size:  2
    Data:  255
    Data:  61
    Opcode:  127
    Size:  0
    Opcode:  83
    Size:  0
    Terminating connection from: 127.0.0.1

    It prints 'Logged in user successfully.' at the end of the login method. Nothing special happens on the client.

    That session includes logging in once from the client, waiting a few seconds - then closing the client.


    Hope I could help.
     

  10. #10  
    Renown Programmer
    veer's Avatar
    Join Date
    Nov 2007
    Posts
    3,747
    Thanks given
    354
    Thanks received
    1,368
    Rep Power
    3032
    Quote Originally Posted by blakeman8192 View Post
    ps you guys are idiots, it's compiled into bytecode and not interpreted through the python interpreter
    ps you are an idiot; python compiles to bytecode too... ever heard of pyc?
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •