Skip to main content
4 events
when toggle format what by license comment
Jul 7, 2014 at 18:32 comment added user1430 If you only expect to have one world, only create one world object. Don't make the World class static or a singleton; that is a bad design direction (it unnecessarily pessimizes your architecture). Even if you don't expect to have more than one world instance now, you don't want to artificially limit your ability to do so in the future -- even if it never plays into your game design, there are various interesting technical optimizations one can make by supporting multiple world objects (such as preloading state to reduce load times on reloads or transitions).
Jul 7, 2014 at 18:29 comment added user1430 You should pass the World (and/or the WorldListener as appropriate) to methods that need them. It makes your dependencies explicit, which is good because it helps you identify where you need to reduce dependencies (because too many complex dependency chains produces code that is "a mess"). Plus it eliminates the issues involved with static classes that hold state that you are running afoul of.
Jul 7, 2014 at 18:18 comment added cortell davis So if the World Listener shouldn't be static, then how will i refer to it from a non static method? I don't want to create multiple instances of World, seeing as there is only one game world, and i don't plan on adding a feature of multiple game worlds. And i'm not sure i follow you about the design patterns aren't solutions. I get that there is more than one way to implement them "correctly", but i'm more so concerned about implementing them incorrectly, or in a badly designed way. Also i turned to design patterns because the last project i coded was a mess and i needed to clean it up.
Jul 7, 2014 at 18:04 history answered user1430 CC BY-SA 3.0