Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Dec 2012
Offline Last Active May 17 2015 05:16 AM

Posts I've Made

In Topic: Quick question about handling 2d levels

07 May 2015 - 07:51 AM


Should I create a state for every level, or a single level state that reads from a level manager?

There should be a single state for gameplay, another for overworld, etc.
Data is what changes from stage-to-stage.  A “level manager” is ambiguous and likely not what you want.  The game engine should simply be able to take any stage data and have your character be able to walk through it, etc.



L. Spiro


Thanks for your answer. :-)

So, as I see it, I'll have a level (gameplay) state and an overworld state, and have the overworld determine what level file should be loaded, kind of like a glorified menu.

Seems simple enough. :-)

Thanks again. :-)

In Topic: Help understanding Component-Entity systems.

22 February 2015 - 08:42 AM

One more question, about your first example:

struct Entity
  int Id;
  std::vector<TComponent*> Components;

Doesn't that vector cause problems with inheritance? If I try to run a function from a component that inherits from the base component class/struct, won't it only run the base component's function instead of the inheriting component's?

In Topic: Help understanding Component-Entity systems.

21 February 2015 - 08:39 AM

Thank you very much for your answer. It's a good starting point for me to start learning the more complicated aspects of programming. In the next days I will look at your journal posts and experiment. :-)


One question, though: I want to get an explanation on what exactly is going on in these parts:

TComponent(TEntityId entityOwner) : EntityOwner(entityOwner) {}

TPosition(float x, float y, TEntityId entityOwner) : TComponent(entityOwner), X(x), Y(y) {}

What exactly should I google? The reference on structures does not cover this part. :-/


Based on your second example, I made this little test which I will experiment with in the next days:

typedef int entity;

struct component
    component( entity id ) : ID( id ) {}
    entity ID;

struct message : component
    std::string Word;
    message( std::string word , entity id ) : component( id ) , Word( word ) { std::cout << Word << std::endl; }

int main( int argc , char * argv[] )
    entity e = 123;
    entity e2 = 456;
    message( "Hello! :-D I'm entity 1!" , e );
    message( "...And I'm entity 2! Goodbye! :-)" , e2 );

    return 0;

I know there won't be actual components like "message", it's just my way of testing the implementation with a "Hello world" type of test program. :-)

In Topic: Simple parsing.

20 February 2015 - 01:01 PM

Thank you very much SmkViper, this is exactly what I wanted. :-) As Krypt0n also suggested, I will eventually look into existing parsers, but for the time being I'd like to play a bit with this subject myself, at least for the small test programs.


Thanks again. :-)

In Topic: Hello World App won't run in emulator

30 July 2014 - 05:30 PM

OK, I googled it (didn't know exactly what to google at the time) and found the solution.

I downgraded the API Level to 17 just to be sure (Android version 4.2.2) and it works like a charm, both in the emulator and on my physical phone. :-)

Thanks for the help. :-)


A question though: Do I even need the API Level 20 stuff? Or is it safe to just uninstall them and just work with Level 17? Because the whole thing takes a billion trillion (rough estimate) Gigabytes on my HDD and it's a bit annoying since it's almost full... :-/