Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object system unification #243

Open
6 tasks
zackthehuman opened this issue Sep 5, 2016 · 0 comments
Open
6 tasks

Object system unification #243

zackthehuman opened this issue Sep 5, 2016 · 0 comments

Comments

@zackthehuman
Copy link
Member

zackthehuman commented Sep 5, 2016

Summary

The current object system discourages code reuse because it is overly specific. The system should be simplified.

Tasks

Description

I think that enough time has passed, and requirements have changed enough to necessitate an overhaul of the object system. There are very minute differences between the subclasses of Entity. The difference between a GameObject and an Entity is also questionable since there is basically no application of plain GameObject besides lookups, which then get casted.

By unifying the objects in the system with a simpler definition, it should make it easier to handle the kinds of features we haven't been able to implement due to complexity of interaction between objects.

At a high level, the notion of classes separating Enemies, Items, Projectiles, etc. no longer makes sense because most of these object types need to do the same kind of things.

There should just be "GameObject".

Additionally, scripting via Squirrel may not be necessary, and possibly can be replaced by behavior trees with special hooks for certain events (onDeath, onBirth, onParentDeath, etc).

Object Types / Attributes
Attribute Item Enemy Particle Projectile Spawner
`id`
`active` flag
`onActivated` hook
`onDeactivated` hook
`onBirth` hook
`onDeath` hook
`onWake` hook
`onSleep` hook
`update` hook
`reset` hook
behavior

A simple type of base object without subclasses should be able to cover all the cases we see in the game. "Optional" parts of an object can just be pointers to other structures. Overall the current system is over-engineered to its own detriment.

Definition

What is a GameObject, then? A GameObject is any object that can appear on-screen within the game world. For example:

  • Enemies
  • Items (drops, collectibles, etc.)
  • Particles
  • Projectiles

This means the following things are not GameObjects:

  • Forces (wind, magnets, conveyors, etc.)
  • Spawners
  • Block Sequencers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant