Moved to GitHub!

Published September 29, 2014
Advertisement
[font=arial]Small update, moved the repo to GitHub, and config files.[/font]


[font=arial]

dustArtemis

[/font]

[font=arial]dustArtemis is a fork of Artemis Entity System, which is a BSD-licenced small Java framework for setting up Entities, Components and Systems.[/font]

[font=arial]GitHub[/font]



[font=arial]Well, I moved the repository to GitHub, its pretty nice for public projects. I'm still getting used to git/GitHub particulars, like releases, tags, slightly different branch management, etc.[/font]

[font=arial]Configuration file[/font]



[font=arial]If you go to 'configfile-exp' branch, there are two commits that add the possibility of setting some of the constants used through dustArtemis from a configuration file, without changing the sources.[/font]

[font=arial]There are plenty of things around that are very specific to each project. For example, if you plan to have around 1k live entities in your World instance, does it makes sense to initialize entity bags with a size of 16? Not really. You're pretty much guaranteeing that plenty of arrays will be trashed at application startup.[/font]

There are also things like, if you're using Bag container, it has a fixed constant for switching from 2 times its capacity to 1.5 times its capacity when it has to grow (previously, 2048).

Probably that's not good enough for everyone, maybe you don't mind 2 times growth so you want to put the threshold higher. Now its possible to specify this in the configuration file.

Hands on...



An example of the contents of a configuration file would be:BAG_DEFAULT_CAPACITY=64BAG_GROW_RATE_THRESHOLD=4096APPROX_COMPONENT_TYPES=48
That raises the default capacity of subclasses of ImmutableBag to 64 elements from the default 16, raises the grow rate threshold to 4096 from the default 2048, and lowers the component types that will be present to 48 from the default 64.

All constants have minimums (so you can't set one to -2 for example), and reasonable defaults in the case you don't specify them in your config file or just plain don't use a config file.

Config files have to be stored in plain text, and its relative path (from the application's POV) has to be set in "dustArtemis.cfgpath" system property. This is using the properties API from Java, so you'd point to your config file like this:System.getProperties().put("dustArtemis.cfgpath", "myFolder/myConfigFile.cfg");
Remember that dustArtemis constants get loaded when the DAConstants class is loaded. So if you use any other part of dustArtemis before adding that property, you might trigger DAConstants class loading before you need to (costants will take the default values instead of the ones instead of the ones in your file).

So before doing anything in your project, put that property in Java's system properties if you want dustArtemis to load the constants from your config file.

Have in mind most of these values aren't limits. Nothing bad will happen if you specify "30" as the component types and you add 31 different component types to entities. These are just starting values for the most part, so you can avoid annoying array reallocation on application startup.

As always, you can check the sources to see where specifically each constant is used in the framework.

Aaand...



that's all. See ya later! biggrin.png
1 likes 4 comments

Comments

dsm1891

misleading and... :(

September 29, 2014 12:52 PM
TheChubu

Oh c'mon, nothing satisfies you.

September 30, 2014 12:00 AM
dsm1891

This was very satisfying, just expected more :/

September 30, 2014 11:09 AM
Gaiiden

misleading and... sad.png

No, his last entry was misleading :P

October 04, 2014 05:52 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement