This Post is simply making a statement about the usefulness and simplicity of Typesafe Config Library within Play! I used it because I needed to balance my Monsters’ strengths. Things like health, offense, damage and defense should be configurable and best be very distinct from Monster to Monster.
What would be easier than having them quickly available in a config file rather than in DB? For tweaking and testing this is enough and it keeps me going.
You can do that quite easy too:
- Put a the file into your Play /conf folder, named yourname.conf
- Load the file using the name:
Java1Config conf = ConfigFactory.load("yourname")
- Access the config file properties via
Java1Config conf = ConfigFactory.load("yourname").getConfig("default.yourname");
Here is how I proceeded loading the Werwolf properties from the werwolf.conf document into the corresponding Java class:
Have fun configuring!