Skip to main content
removing a banned tag. If you see this, please start editing the tag out from lowest voted posts to get this done tonight.
Link
added 12 characters in body
Source Link
omgnoseat
  • 1.2k
  • 1
  • 8
  • 16

The title is a bit confusing, but I couln't think of how to explain my question in a short phrase. So here it is:

Whenever I'm writing game engines, wheter it's physics/tilebased etc, I always get to the point where I'm not sure how I should manage things. Should objectsentities in the world handle on their own, or should theirthere be some global system managing them?

Here's an easy example: Moving things. Should each object see the world around him (check for collisions) and move based on that.

[note, this is a tile based game where object move per tile, so I'm not using physics to move from tile to tile]

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            if (world.getTile(location) != solid && world.objAtTile(location) == null)
            {
                Tweener.addTween(this, location);
            }
          }
        }

Or should the movement of each object be handeled in the world, where the world checks everything?

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            world.moveTo(location);
          }
        }

public class World
{

    public void moveObject(GameObject obj, Vector2 location)
    {
      //called from object

      if (getTile(location) != solid && objAtTile(location) == null)
         {
                Tweener.addTween(obj, location);
         }
    }
}

It doesn't really matter that much for this example I suppose, but I can see myself getting into trouble later on. Thanks in advance.

The title is a bit confusing, but I couln't think of how to explain my question in a short phrase. So here it is:

Whenever I'm writing game engines, wheter it's physics/tilebased etc, I always get to the point where I'm not sure how I should manage things. Should objects handle on their own, or should their be some global system managing them?

Here's an easy example: Moving things. Should each object see the world around him (check for collisions) and move based on that.

[note, this is a tile based game where object move per tile, so I'm not using physics to move from tile to tile]

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            if (world.getTile(location) != solid && world.objAtTile(location) == null)
            {
                Tweener.addTween(this, location);
            }
          }
        }

Or should the movement of each object be handeled in the world, where the world checks everything?

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            world.moveTo(location);
          }
        }

public class World
{

    public void moveObject(GameObject obj, Vector2 location)
    {
      //called from object

      if (getTile(location) != solid && objAtTile(location) == null)
         {
                Tweener.addTween(obj, location);
         }
    }
}

It doesn't really matter that much for this example I suppose, but I can see myself getting into trouble later on. Thanks in advance.

The title is a bit confusing, but I couln't think of how to explain my question in a short phrase. So here it is:

Whenever I'm writing game engines, wheter it's physics/tilebased etc, I always get to the point where I'm not sure how I should manage things. Should entities in the world handle on their own, or should there be some global system managing them?

Here's an easy example: Moving things. Should each object see the world around him (check for collisions) and move based on that.

[note, this is a tile based game where object move per tile, so I'm not using physics to move from tile to tile]

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            if (world.getTile(location) != solid && world.objAtTile(location) == null)
            {
                Tweener.addTween(this, location);
            }
          }
        }

Or should the movement of each object be handeled in the world, where the world checks everything?

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            world.moveTo(location);
          }
        }

public class World
{

    public void moveObject(GameObject obj, Vector2 location)
    {
      //called from object

      if (getTile(location) != solid && objAtTile(location) == null)
         {
                Tweener.addTween(obj, location);
         }
    }
}

It doesn't really matter that much for this example I suppose, but I can see myself getting into trouble later on. Thanks in advance.

Components changed to objects to try and get a better answer for the example given.
Source Link

Game engines: handle from component point of view or from world Object updates, internal vs external?

The title is a bit confusing, but I couln't think of how to explain my question in a short phrase. So here it is:

Whenever I'm writing game engines, wheter it's physics/tilebased etc, I always get to the point where I'm not sure how I should manage things. Should componentsobjects handle on their own, or should their be some global system managing them?

Here's an easy example: Moving things. Should each object see the world around him (check for collisions) and move based on that.

[note, this is a tile based game where object move per tile, so I'm not using physics to move from tile to tile]

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            if (world.getTile(location) != solid && world.objAtTile(location) == null)
            {
                Tweener.addTween(this, location);
            }
          }
        }

Or should the movement of each object be handeled in the world, where the world checks everything?

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            world.moveTo(location);
          }
        }

public class World
{

    public void moveObject(GameObject obj, Vector2 location)
    {
      //called from object

      if (getTile(location) != solid && objAtTile(location) == null)
         {
                Tweener.addTween(obj, location);
         }
    }
}

It doesn't really matter that much for this example I suppose, but I can see myself getting into trouble later on. Thanks in advance.

Game engines: handle from component point of view or from world?

The title is a bit confusing, but I couln't think of how to explain my question in a short phrase. So here it is:

Whenever I'm writing game engines, wheter it's physics/tilebased etc, I always get to the point where I'm not sure how I should manage things. Should components handle on their own, or should their be some global system managing them?

Here's an easy example: Moving things. Should each object see the world around him (check for collisions) and move based on that.

[note, this is a tile based game where object move per tile, so I'm not using physics to move from tile to tile]

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            if (world.getTile(location) != solid && world.objAtTile(location) == null)
            {
                Tweener.addTween(this, location);
            }
          }
        }

Or should the movement of each object be handeled in the world, where the world checks everything?

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            world.moveTo(location);
          }
        }

public class World
{

    public void moveObject(GameObject obj, Vector2 location)
    {
      //called from object

      if (getTile(location) != solid && objAtTile(location) == null)
         {
                Tweener.addTween(obj, location);
         }
    }
}

It doesn't really matter that much for this example I suppose, but I can see myself getting into trouble later on. Thanks in advance.

Object updates, internal vs external?

The title is a bit confusing, but I couln't think of how to explain my question in a short phrase. So here it is:

Whenever I'm writing game engines, wheter it's physics/tilebased etc, I always get to the point where I'm not sure how I should manage things. Should objects handle on their own, or should their be some global system managing them?

Here's an easy example: Moving things. Should each object see the world around him (check for collisions) and move based on that.

[note, this is a tile based game where object move per tile, so I'm not using physics to move from tile to tile]

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            if (world.getTile(location) != solid && world.objAtTile(location) == null)
            {
                Tweener.addTween(this, location);
            }
          }
        }

Or should the movement of each object be handeled in the world, where the world checks everything?

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            world.moveTo(location);
          }
        }

public class World
{

    public void moveObject(GameObject obj, Vector2 location)
    {
      //called from object

      if (getTile(location) != solid && objAtTile(location) == null)
         {
                Tweener.addTween(obj, location);
         }
    }
}

It doesn't really matter that much for this example I suppose, but I can see myself getting into trouble later on. Thanks in advance.

Tweeted twitter.com/#!/StackGameDev/status/113459949794893825
Source Link
omgnoseat
  • 1.2k
  • 1
  • 8
  • 16
Loading