Realistic 20 Share Posted September 19, 2020 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: 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. 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. Similar to a graph/relational DB create a vector set (like Word2Vec) that contains all the item relationships. Advantages: Having a system like this will allow extremely simple script to do complex actions with very little coding. Multiple developers could contribute and quickly add many items. 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 More sharing options...
Pandemic 2675 Share Posted September 19, 2020 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 More sharing options...
LordJashin32 54 Share Posted September 19, 2020 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.