Thread: Player.java and good design

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
  1. #11  
    Registered Member
    Join Date
    Jul 2012
    Age
    25
    Posts
    122
    Thanks given
    16
    Thanks received
    21
    Rep Power
    15
    Quote Originally Posted by Polar View Post
    I personally wouldn't go that approach, but with working with Kotlin I'd probably do what Scu posted. Storing them in some kind of "VariableMap" and that makes them easy to load and save without having to add a new column to a database table for example. In my original "framework" I had "player.getVar("key") which I personally liked more than have new fields in Player. It also allowed to easily add more variables without having to edit Player, which was a big thing since I wanted content to be implemented via plugins which shouldn't be required to edit Player.
    The reason that is bad design is because it forces the next user of your source to know all of the constants used in your Map (sure, looping through the Map works) - being able to read it in the code gives new developers an idea of what is going on.
    Reply With Quote  
     

  2. #12  
    Respected Member


    Polar's Avatar
    Join Date
    Sep 2015
    Age
    28
    Posts
    420
    Thanks given
    0
    Thanks received
    418
    Rep Power
    3098
    Quote Originally Posted by Sarkastisk View Post
    The reason that is bad design is because it forces the next user of your source to know all of the constants used in your Map (sure, looping through the Map works) - being able to read it in the code gives new developers an idea of what is going on.
    They're defined in config files so they aren't just random things thrown into a map, they have defaults for when the variable doesn't exist for example. Here's an example of such config, which the variable system is based on one from I believe transformers universe.

    Code:
    [variable_key]
    type = "VARP"
    domainType = "PLAYER"
    dataType = "INT"
    default = 0
    clientKey = -1
    persistent = false
    Reply With Quote  
     

  3. #13  
    Player.java and good design



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    Quote Originally Posted by Polar View Post
    They're defined in config files so they aren't just random things thrown into a map, they have defaults for when the variable doesn't exist for example. Here's an example of such config, which the variable system is based on one from I believe transformers universe.

    Code:
    [variable_key]
    type = "VARP"
    domainType = "PLAYER"
    dataType = "INT"
    default = 0
    clientKey = -1
    persistent = false
    I'm pretty sure the varps in the RS client all default to 0, as the varp/varbit definitions in the cache only deserialize their type field and nothing else

    Attached image
    Reply With Quote  
     

  4. #14  
    Respected Member


    Polar's Avatar
    Join Date
    Sep 2015
    Age
    28
    Posts
    420
    Thanks given
    0
    Thanks received
    418
    Rep Power
    3098
    Quote Originally Posted by Scu11 View Post
    I'm pretty sure the varps in the RS client all default to 0, as the varp/varbit definitions in the cache only deserialize their type field and nothing else
    Yeah they do, this supports more than just int as a datatype is why default exists.
    Reply With Quote  
     

  5. #15  
    Community Veteran

    Dexter Morgan's Avatar
    Join Date
    Nov 2008
    Age
    28
    Posts
    4,419
    Thanks given
    1,184
    Thanks received
    757
    Rep Power
    3098
    Quote Originally Posted by chaflie View Post
    It's laziness, and a snowball from previous laziness. Amateur programmers dominate the scene here, and when another rookie takes over a source, they think that placing things in the player class works, and they're right, it does work. But the average programmer doesn't realize they can branch it out differently, and this results in a source like Exotic. An experienced programmer would branch it out, but again, some experienced people are lazy and will just build on top of the rats nest with better code.

    It's why a lot of the more advanced programmers will try to write frameworks from scratch or use bases like Apollo or ScapeEmulator, because typically it's easier than cleaning the base with content. I
    To say lazy is to project insecurities. So you are lazy but do, that's pride. And whole your statement is derogatory. Why do people pile stuff in Player class? Because most arent interested in learning Java and becoming good programmers. They arent interested in the money. What works for them, they'll keep doing.

    Most people here, are amateurs without real learning, schooling, or interest. Only a few dedicate their life to learning computer languages. To say lazy is to misunderstand everything, its not laziness that stops learning. Some people are incapable of learning new things. Some people are interested at all. Some people dont want to. Some people do.

    Let me tell you more about "lazy" in terms of human physiology. Lazy is a great misunderstood term. When the body is tired, it is because it's using too much energy somewhere. Body energy comes from the lower part of the body. The adrenal glands are responsible for energy and fear. Someone with stress on their adrenal glands is incapable of learning because they live in fear. Everything seems irrational and doesn't seem to add up. So this person is basically living in fear, and most likely on the animal level. So, if you understand, you'll never judge. If you judge, you'll never understand. Meanwhile, this is happening on an animal level, on the mental level, there's something else happening.

    When there's fear on the animal level and the mental level is the dominant one, you get a person like you who looks upon others and doesn't realize he seems himself. Then, judgement happens within and is projected out. The projection is illusive. The judgement occurs as a contradiction of expectation outcomes. If you are capable, and you deem "others" as incapable, you are judging yourself as if you were them. Very delusional and very "normal" in contemporary society.
    Reply With Quote  
     

  6. #16  
    Programmer, Contributor, RM and Veteran




    Join Date
    Mar 2007
    Posts
    5,147
    Thanks given
    2,656
    Thanks received
    3,731
    Rep Power
    5000
    Quote Originally Posted by Scu11 View Post
    and loses compile time validation on type safety
    https://netty.io/4.1/api/io/netty/ut...ributeMap.html is a nice way to implement type-safe maps capable of storing different types in Java.
    .
    Reply With Quote  
     

  7. #17  
    Renown Programmer
    Bartvh's Avatar
    Join Date
    May 2017
    Posts
    370
    Thanks given
    89
    Thanks received
    208
    Rep Power
    497
    Quote Originally Posted by Sarkastisk View Post
    I get that. Which is great for PlayerSaves and a HashMap usually has O(1) time complexity; but it doesn't make for readable code. When I first wrote this post I did consider that alternative aswell, but for readability one should rather make a PlayerCombat class which handles all of the player-combat related things and perhaps a new class called PlayerNPCKills which handles NPCKills.
    O(1) hashmaps? That's new to me.
    Reply With Quote  
     

  8. #18  
    Programmer, Contributor, RM and Veteran




    Join Date
    Mar 2007
    Posts
    5,147
    Thanks given
    2,656
    Thanks received
    3,731
    Rep Power
    5000
    Quote Originally Posted by Bartvh View Post
    O(1) hashmaps? That's new to me.
    The amortized time complexity of get/contains/insertion operations of a hash table is O(1).

    Although the worst case for, say, a put operation is O(n) (when the array of buckets is resized), this is only expected to happen every n operations, balancing everything out.
    .
    Reply With Quote  
     

  9. Thankful users:


  10. #19  
    Banned


    Join Date
    Mar 2017
    Posts
    391
    Thanks given
    227
    Thanks received
    261
    Rep Power
    0
    Quote Originally Posted by Dexter Morgan View Post
    To say lazy is to project insecurities. So you are lazy but do, that's pride. And whole your statement is derogatory. Why do people pile stuff in Player class? Because most arent interested in learning Java and becoming good programmers. They arent interested in the money. What works for them, they'll keep doing.

    Most people here, are amateurs without real learning, schooling, or interest. Only a few dedicate their life to learning computer languages. To say lazy is to misunderstand everything, its not laziness that stops learning. Some people are incapable of learning new things. Some people are interested at all. Some people dont want to. Some people do.

    Let me tell you more about "lazy" in terms of human physiology. Lazy is a great misunderstood term. When the body is tired, it is because it's using too much energy somewhere. Body energy comes from the lower part of the body. The adrenal glands are responsible for energy and fear. Someone with stress on their adrenal glands is incapable of learning because they live in fear. Everything seems irrational and doesn't seem to add up. So this person is basically living in fear, and most likely on the animal level. So, if you understand, you'll never judge. If you judge, you'll never understand. Meanwhile, this is happening on an animal level, on the mental level, there's something else happening.

    When there's fear on the animal level and the mental level is the dominant one, you get a person like you who looks upon others and doesn't realize he seems himself. Then, judgement happens within and is projected out. The projection is illusive. The judgement occurs as a contradiction of expectation outcomes. If you are capable, and you deem "others" as incapable, you are judging yourself as if you were them. Very delusional and very "normal" in contemporary society.
    Can we save the non-duality and philosophical shit for forums that aren't game-related? you went into a full on rant about projection with something that wasn't even directed towards you - that's projection too, yeah?
    Reply With Quote  
     

  11. Thankful users:


  12. #20  
    Community Veteran

    Dexter Morgan's Avatar
    Join Date
    Nov 2008
    Age
    28
    Posts
    4,419
    Thanks given
    1,184
    Thanks received
    757
    Rep Power
    3098
    Quote Originally Posted by ThisForumSucks View Post
    Can we save the non-duality and philosophical shit for forums that aren't game-related? you went into a full on rant about projection with something that wasn't even directed towards you - that's projection too, yeah?
    Could, but then you are drowning in ignorance. The bigger the ignorance, the bigger the ego. The ego is pure illusion, the illusion of individual existence.

    I didnt rant, I shared some knowledge. But your life got your confused and you think the subtle areas of reality arent a section of your correlation. In other words, all that you see, is a reflection of you. If you think I rant, its directly reflective of as you know life to be. You do know, the description you construct is directive and subjective of you and not universally objective? You should know all arose from nothing. All came from silence. As above, so below, as within, so without.

    If you think life is to be lived to living up to a status or reputation, then you already are lost and hiding behind a mask, role playing this character you deceive yourself to be. Fool.

    Your quoting sigmund freud like what he discovered is the absolute truth worth knowing. The guy went on a basis that all there is, is mind, and thus, failed in complete deduction.

    This isnt philosophy. Its poetry, knowledge of self. But you wouldn't understand, for the one that denies the spirit falls into a darkness. There will always be unevolved fools like you who think they are absolutely right, but unlike you. I do not have pride nor confidence. Instead, I have wonder and clarity of perception.

    Seems like you got triggered little boy. Knowledge of self is the only think worth knowing. Disconnection from spirit is why people suffer. Reconnection is all they seek but follow blindly being led by the blind. Some think a job, status, family, money, is what they want but in absolute reality and honesty, it is clear it's not. But spend their whole lives trying to prove themselves wrong.

    You are your own enemy.
    Reply With Quote  
     

  13. Thankful user:


Page 2 of 3 FirstFirst 123 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. Replies: 0
    Last Post: 06-10-2013, 01:21 PM
  2. Replies: 2
    Last Post: 12-11-2012, 04:57 AM
  3. Replies: 12
    Last Post: 10-26-2010, 08:43 PM
  4. silab items for item.java and item.cfg
    By Frosty Teh Snowman in forum Configuration
    Replies: 81
    Last Post: 08-04-2008, 04:38 AM
  5. Replies: 3
    Last Post: 02-09-2008, 02:19 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •