Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Advice/Help needed on Abstract player based state design pattern.


    Realistic

    Recommended Posts

    Hi all,

    I am still wrapping my head around Java and its "50+ Common design patterns!". Any advice on how to achieve my goal would be awesome.  My goal :

    To be able to take a "Snapshot" of the players current state (Inventory, equipment, location, ECT...), take the delta from the players current state and be able to essentially say "Go to new state".

    Each object will have its own abstracted logic that tells the script how to obtain it (GE, fishing, woodcutting ETC...). This logic can be split up to be area specific (tutorial island), item type specific IE: cooked fish = raw fish + heat OR  iron bar + hammer + smiting level + anvil (contains location) = iron dagger OR rock + pickaxe + level = ore. 

    Current Approaches:

    1. Make item type classes, item classes, and code specific ways to obtain the items for each class. This would involve making a class with specific implementation details for each item in the game. Most general actions could be inherited.
    2. Code generic classes that will handle most item logic, add item relationships to a graph or relational DB. The main difference here would be the item relationships would be stored in a DB not code.
    3. Similar to a graph/relational DB create a vector set (like Word2Vec) that contains all the item relationships.

    Advantages:

    1. Having a system like this will allow extremely simple script to do complex actions with very little coding. 
    2. Multiple developers could contribute and quickly add many items.
    3. Could be compiled to a JAR or be an open DB that any DreamBot developer could access to improve scripter productivity on the Dreambot platform.

     

    Any and all advice would be awesome! If anyone would like to help me create this I would love to work with some other devs from the community. If/when this system is created I am planning on posting it on GitHub for all Dreambot devs to use.

    Link to comment
    Share on other sites

    That sounds like a massive undertaking, I wish you nothing but luck :)

    I don't have any specific guidance, but it's important to choose the right abstraction for something like this. Think for a while about how the end user will interact with it, and design it twice :)

    Link to comment
    Share on other sites

    Design patterns are all bullcrap u learn the hardway later after using the wrong way long enough and trying to make your code better. There is never a 100% right answer. Its always just preference after screwing around long enough. As for what you're saying. U could do relationships in either code or in DB. through doing like hasOne, belongsTo, hasMany, and etc. methods.

    This sounds more like a library ontop of DB3. I like this idea. But depends if ur using it for information or u want it to do all those things. Could easily break along the way if u intend for it to do a lot. Maybe just a check for if it can do those things would be nice. Like if it detects bar + hammer in bank with anvil close. u could give it a true boolean for a method maybe like bankHasSmelting? Idk. Most people will want to do their own implementations. or maybe bankHasSmeltingIronBar.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.