Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    11
  • comments
    17
  • views
    27903

Moved to GitHub!

Sign in to follow this  
TheChubu

1571 views

[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
Sign in to follow this  


4 Comments


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!