Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Mar 2004
Offline Last Active Dec 27 2013 04:19 AM

Topics I've Started

Special Rules in a Turn Based Entity Component System

16 January 2013 - 12:34 PM



I'm currently planning on implementing a tabletop game in the spirit of Warhammer 40k.

This is a turn based strategy game with lots of special rules.


Why a entity component system?

  • Units have special ability, which could be realized each as a component
  • Area effects such as fear, could also be realized as a component indicating that a unit is affected by fear
  • Each race or army type have there own special rules
  • Special rules generally only effect some part of the system, e.g., movement or shooting
  • Ease of integration in Unity (make games not engines wink.png )

So what is the problem?

How to realize the special rules?


To perform an action two six side dice are rolled and the sum is compared to a threshold.

Lets assume a special ability or effect that modifies this test as follows: instead of two dice three dice are rolled and the highest result is discarded.

Another effect might case that an additional dice is rolled and added to the result.

So the combination would be: roll four dice remove the highest and add the rest up.


So in a perfect world the rules do not have to know about each other.

But should be able to override each other such that an ability can cancel out an effect.


Would you ...

  • implement the abilities as flag components? And put there effect into each system, e.g. shooting or movement system?
  • put the logic of the ability into the components?
  • have the logic of the ability as another component, where one could have many components of the same type, if the effects can stack?
  • any other ideas?

Of course if you are missing an information please feel free to ask. Also I'm looking forward to suggestions of different approaches.

RandomNumbers, Replay and Multithreading

25 August 2010 - 12:07 AM


I'm writing an engine (using a component system) where a lot of components can be updated simultaneously. Some of them use random numbers, but if I distribute it over the network or try to replay it, then of course some get the wrong random number.

So I'm looking for a way to reliable have the same random numbers for the components. Any ideas?

Movement of Sailboats

30 March 2010 - 09:46 PM

Hallo, I would like to simulate the movement of a sailboat in 2D from the following:
  • wind including direction and velocity
  • position of helm
  • position of sail
  • mass of boat
  • shape of boat
Do I need more? Where would I find the needed equations? Would a 2D physics engine help here or not?

Change of Probability propagation

29 April 2008 - 02:34 AM

Hi all, I've a problem which I'm to blind to solve. I'm implementing a probability inference system with special requirements. So here i present the formula that troubles me: Let Y = A1*X1 + A2*X2 + A3*X3 + ... + Ak*Xk with Xi random variables of dimension n, Y of dimension m and A1 be matrices with dim mxn. Let all Xi ~ N( mu_i, Co_i ) have n dimensional multivariate normal distribution. So Y has also a m dimensional multivariate normal distribution with mu_y and Co_y. (let Ai^t be the transposed of Ai) => mu_y = A1*mu_1 + ... + Ak*mu_k and Co_y = A1*Co_1*A1^t + ... + Ak*Co_k*Ak^t If mu_y and Co_y get changed then I have to also update the mu_i and Co_i. This will yield more then one solution (in case of m*k > n). So I have to pick one. Due to the nature of the problem at hand I would like to pick the one which introduces the "smallest change". Let muX = ( mu_1 mu_2 .. mu_k ) a m*k-dimensional vector and let |L the set of all solutions. Then I would select muX* = min || muX - mul || with mul in |L. But how would I do that for the Covarianz matrices?

Will the compiler optimize the std::pair away?

25 April 2008 - 02:21 AM

Hi all, first the source:

template <typename T>
class TMatrix
	typedef T value_type;
	typedef std::pair<unsigned int, unsigned int> Index;
	TMatrix( size_t dim ) : _dim(dim), _data(dim*dim) {}

	inline T& operator[](const Index& idx)
		assert(idx.first < _dim && idx.first < _dim);
		return _data[idx.first *_dim + idx.second];

	inline T operator[](const Index& idx) const
		assert(idx.first < _dim && idx.second < _dim);
		return _data[idx.first *_dim + idx.second];

	const size_t _dim;
	std::vector<T> _data;

Okay now I can do nice things like
TMatrix<double> m;
m[1, 2] = 0;
double v = m[2,3];

The question is: Will the compiler be able to optimize away the creation and destruction of the std::pair ?