Thread: Python Server Framework

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 48
  1. #1 Python Server Framework 
    nbness2#5894

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    626
    Thanks given
    238
    Thanks received
    113
    Rep Power
    256
    Hi.
    You may have seen servers written in other languages like Ruby or C#. I'm writing one in Python!
    I know that it's impractical because of performance deficit between python and ther languages, but doing this will (hopefully) further my understanding of python and the rsps client in general.
    I will be using Python 3.5.1 and have not decided if I want to use a non-default implementation. I'll be sticking with the default CPython Implementation for now.

    You can follow progress here -> [Only registered and activated users can see links. ] <- as well as this thread. I will be updating whenever I'm off work, not at school and not doing other stuff.

    Pypy3 pros
    • Faster other python implementations on average
    • Can output C, CLR (.net), JVM (java scala korlin etc) and PYPY bytecode
    • Lower memory overhead on average

    Pypy3 cons
    • Runs c extensions slower than cpython
    • Pypy3 for Py3.5+ is linux only for now. Have never used Linux or a VM so I don't know much about either.
    • Can be slower than other python implementations in some case.


    Cpython pros
    • Supports all of stdlib fully
    • Runs c extensions much faster than the alternatives

    Cpython cons
    • Slower than other implementations of python
    • Can only be interpreted in the CPython Interpreter.


    Jython pros
    • Can import JVM Bytecode objects and access them directly using python syntax, therefore having access to full Java stdlib.
    • Compiles to JVM Bytecode and can run alongside java, scala, kotlin etc classes.

    Jycons
    • Python2.x only basically. Jython3 is very slow development.
    • Slower than other implementations of python


    Spoiler for Latest Update:

    Baby update (compared to what is coming soon )
    • Itemdefs moved from 459 to OSRS 145
    • Lots of params added and put into json (is_2h, is_noted, etc). This is going to be for ease, rather than handling this stuff in the code, we can just put it in itemdef! Makes python more viable for server hosting
    • JSON file size - 1077kb -> 3977kb
    • New binary pack format (8.82% size of original, retains all relevant data, with a caveat)
    • New binary is 55.4% size of the old binary and loads even faster (thanks, caveat)
    • Nulls are not fully packed, their data is all the same.


    Info on new binary packing format:
    Code:
    
    Item binary data length - 1 byte -- Length of the binary data for any given itemdef (will probably be changed to more if I decide to get item descriptions)
    
    Item ID - 15 bits - If the item is a null, the ID written will be 32767 and if a 32767 is read, go to the next item.
    
    Item name length - 6 bits - This is because the longest item name contains 35 characters
    
    Item Name - 7 bits per char - [Only registered and activated users can see links. ]
    
    CAVEAT - Nothing for item description. Right now all item descriptions are "It's a(n) xxx." so this can be eliminated while packing binary.
    
    If I ever bother to scrape the descriptions, they will be handled like item names.
    
    Item Price - 31 bits - This is for a max value of ~2147m, you won't be selling items for a negative price or for more than max-stack of an item, so last bit isnt' necessary in either scenario
    
    Item is 2h - 1 bit - True/False
    
    Item is stackable - 1 bit - True/False
    
    Item is tradable - 1 bit - True/False
    
    Item is sellable - 1 bit - True/False
    
    Item is droppable - 1 bit - True/False
    
    Item is noted - 1 bit - True/False
    
    Item can note - 1 bit - True/False
    
    If item isnt noted and item can note:
        Item noted id - 15 bits - This is the noted item id
    
    Item bonuses - 1-10 bits (first 4 for bonus id 0-13, last 9 for value -255 to 255).
        If a 1 is read, next 9 bits are read.
        If a 0 is read, the next bit is read for checking if there is a bonus
        After the 13th bit check (and possibly bonus grab), go to next item
    
    if last bit written is the last bit of the last byte:
        a 255 byte is added (11111111)
    
    if last bit written is not the last bit of the last byte (if last byte was written with 1-7 bits):
         1s are written to the rest of the byte and the byte's bits are reversed
    
    this is to maintain data integrity
    [/list]



    Red - Not started
    Orange - In Progress
    Green - Finished

    Planned Features

    Spoiler for Planned Features:


    Rsps client packet "Library"
    Plugin System
    Functions that execute code corresponding to the packets that the player sent. E.g. Player clicks on a bank and opens bank interface. Player clicks light on a dropped log and it lights the fire.
    Playable - WE GETTIN THERE YEET



    One of my goals is to hopefully show that python is a viable alternative to java for RSPS servers, although with CPython being how it is, it might not be. RSPS gameplay is very performance critical for the end user. I will try to make this possible by making critical stuff a separate service and offloading them to separate cores rather than using them in threads on the same core. This does increase memory overhead but it will also increase performance.
    If this proves to be a viable alternative (either with CPython or any other implementation), it will also give python programmers an alternative to running a server and creating server content, not having to learn java (Not that it's necessarily hard, it's just a very noticeable change in syntax. If I didn't skim java before learning python I'd be so confused.)

    As of 6/27/2017, we are now more focused on an asynchronous implementation, rather than multiprocessed. Transfering data between processes is not the easiest or the most efficient in python, you have to send the object to a Multiprocessing Queue which then pickles (serializes) it and another python process can snatch it out of the queue, but it's quite a hassle trying to do that for multiple processes (or I'm not as good at it as I thought). So, Async it is.

    Contributors:
    • [Only registered and activated users can see links. ]
    • [Only registered and activated users can see links. ]
    Last edited by nbness2; 07-17-2017 at 02:19 PM. Reason: another update
    Reply With Quote  
     


  2. #2  
    Best Rat Donor

    Australisch's Avatar
    Join Date
    Nov 2015
    Posts
    2,028
    Thanks given
    951
    Thanks received
    410
    Rep Power
    4169
    best of luck, interested to see how this turns out.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Super Donator


    Join Date
    Feb 2011
    Age
    22
    Posts
    1,136
    Thanks given
    180
    Thanks received
    178
    Rep Power
    243
    Good luck with this.. Thoe I dont really see the usage of it but hey! If it is for learning go for it, but then I would probably be doing something else than RSPS stuff
    Reply With Quote  
     

  5. #4  
    🎶 As you're falling down 🎶

    i_pk_pjers_i's Avatar
    Join Date
    Feb 2015
    Posts
    1,270
    Thanks given
    4,828
    Thanks received
    552
    Rep Power
    2104
    Best of luck, will rep you in 24 hours. I started learning Python recently and I must say, it is pretty cool although very different than most of the other languages I learn - I started off by creating a League of Legends log parser, then created an IRC bot as I've had experience with that in the past and that is always fun.

    Very cool to see a Python server framework being created. I hope this goes far.
    [Only registered and activated users can see links. ]
    Vouches (22, many more available upon request): [Only registered and activated users can see links. ] and [Only registered and activated users can see links. ]

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

    Made me smile : [Only registered and activated users can see links. ]

    I'm honored : [Only registered and activated users can see links. ]

    Quote Originally Posted by Idiot Bird View Post
    Quote Originally Posted by Velocity View Post
    lol np mate looks like the community brought ur rep down to ur IQ
    Not too sure about that, it's at 0 . It would have to go minus to even be remotely close to his IQ.
    Reply With Quote  
     

  6. Thankful user:


  7. #5  
    Registered Member
    Greg's Avatar
    Join Date
    Jun 2010
    Posts
    1,008
    Thanks given
    165
    Thanks received
    460
    Rep Power
    738
    I've never used python but from what I've heard doesn't it have horrible compile and execution times in comparison to java, isn't is just used for quick prototyping or tools?
    Reply With Quote  
     

  8. #6  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    24
    Posts
    4,444
    Thanks given
    892
    Thanks received
    1,524
    Rep Power
    3206
    Best of luck
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  9. #7  
    Registered Member
    Sandal's Avatar
    Join Date
    May 2017
    Posts
    1,620
    Thanks given
    26
    Thanks received
    257
    Rep Power
    194
    best 0f luck!
    Reply With Quote  
     

  10. #8  
    nbness2#5894

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    626
    Thanks given
    238
    Thanks received
    113
    Rep Power
    256
    Quote Originally Posted by i_pk_pjers_i View Post
    Best of luck, will rep you in 24 hours. I started learning Python recently and I must say, it is pretty cool although very different than most of the other languages I learn - I started off by creating a League of Legends log parser, then created an IRC bot as I've had experience with that in the past and that is always fun.

    Very cool to see a Python server framework being created. I hope this goes far.
    I hope I can take it far!

    Quote Originally Posted by Greg View Post
    I've never used python but from what I've heard doesn't it have horrible compile and execution times in comparison to java, isn't is just used for quick prototyping or tools?
    It depends on the task, but in general yes python has slower execution times compared to java because it is an interpreted language, not compiled. However, if I use Pypy implementation, the speedup is on average 6x and can be as large as 300x speedup. It all depends on the task and the workload I hope I can make it happen!

    Quote Originally Posted by Zivik View Post
    Best of luck
    Thanks !
    Reply With Quote  
     

  11. #9  
    ExemptionX


    Join Date
    Jul 2007
    Posts
    1,513
    Thanks given
    164
    Thanks received
    161
    Rep Power
    265
    Goodluck bro
    Reply With Quote  
     

  12. Thankful user:


  13. #10  
    aaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa

    Planets's Avatar
    Join Date
    Aug 2014
    Age
    24
    Posts
    2,155
    Thanks given
    672
    Thanks received
    1,934
    Rep Power
    5000
    Quote Originally Posted by Greg View Post
    I've never used python but from what I've heard doesn't it have horrible compile and execution times in comparison to java, isn't is just used for quick prototyping or tools?
    Isnt python interpreted not compiled? (i know no programming so please correct me)
    [Only registered and activated users can see links. ]




    Reply With Quote  
     

  14. Thankful user:


Page 1 of 5 123 ... LastLast

Thread Information
Users Browsing this Thread

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

Similar Threads

  1. Feather - RuneScape Private Server Framework
    By Thock321 in forum Downloads
    Replies: 8
    Last Post: 08-29-2013, 04:48 AM
  2. Creating a server framework
    By Virus X3 in forum Help
    Replies: 34
    Last Post: 12-28-2009, 01:47 AM
  3. 317 Server framework
    By Stability666 in forum Downloads
    Replies: 21
    Last Post: 10-11-2009, 08:33 PM
  4. Login @ PYTHON SERVER!! AMFG!!
    By w::v::d in forum Show-off
    Replies: 11
    Last Post: 08-13-2009, 07:35 PM
  5. RSES Server Framework
    By Lazaro in forum Downloads
    Replies: 62
    Last Post: 03-14-2009, 11:32 AM
Tags for this Thread

View Tag Cloud

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