Tag Info

New answers tagged

3

It's OK to have component dependencies. And the more explicit the dependency the better. There's nothing worse than dependencies hidden behind useless layers of indirections. Your case doesn't look like a dependency hell to me. No circular dependency or unclear ownership of data: consider yourself lucky! Now I still believe that you need to reverse your ...


2

In my experiences there aren't too many ways around the fact that, you're right, all your different game entities and their components need to be aware of the state of the game and their own state. It's a mess unless you design with state machines in mind. The best way I've found to deal with it is to make sure that components are all doing small pieces of ...


0

You could develop a bytecode language for this. Take a look at this: http://gameprogrammingpatterns.com/bytecode.html Instead of spells as in that example, see the commands as 'walk to' and 'display message' and so on.


1

Generalizing your problem, you have a pool of data (the player's state), and you need a way to represent a boolean expression over such data, Before starting, you may want to sit down and decide: How many situations need prerequisites? 20? 10000? Which data sources are available for querying? Just technologies and resources? How about time since the game ...


1

If you're looking for some magic pattern or data structure that deals with prerequisites, I don't think there is one, or rather, it's very simple: all you need is a simple way to query the number of Xs in Y, and a clear hierarchy of ownership. That is, be able to query things like: Number of buildings of a certain type in a city Whether a specific ...


2

Disclaimer: artemis-odb dev here. -Changing the Entity System, i know of Artemis, but it would be great if you could point me at something else for Java if you know a library that does it better. I'm not sure whether you're referring to vanilla artemis or artemis-odb, but the latter improves on performance considerably with regards to mutating ...


1

So, i figured out how to do it quick and dirty, i subclassed Array (libGDX.util) to allow for faster removal of Entities and then i swapped it with the normal Array inside the Engine class of Ashley: package de.vatterger.threadedSim.tools; import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; ...


1

The game layer probably shouldn't know about the HUD layer. The HUD layer should maybe listen to events from the game layer. Your example is a bit vague, so let's say there is a button above each enemy that should have the lifetime of the enemy. You could make a button system that checks that the corresponding enemy(a component of the button) is still ...


3

I think the Observer Pattern may fit here. Instead of sending a message to your button, let your button observe some component.



Top 50 recent answers are included