| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
The AutomatableComponent now links to the Runnable entity representing the behavior script.
Also reordered the SystemManager and EntityManager members of the Game class such that the EntityManager is destroyed before the SystemManager is. This fixes a bug where the destruction of a component has some affect on the state of a system. Specifically, if the ScriptingSystem (and thus the Lua state) is destroyed before the EntityManager is and there are any Runnable entities, the game will crash when trying to destroy them.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The AutomatingSystem has been renamed to the ScriptingSystem, since the automatic behavior script is just a special case of the scripts that an entity can exhibit. The AutomatableComponent has largely been moved to the new RunnableComponent (might not be the final name for it).
The Lua state object, previously living on the singleton RealizableComponent, is now a member of the ScriptingSystem itself, because it A) doesn't really belong on the realizable entity, and B) a singleton entity seems weird and like a cumbersome attempt to apply the ECS rules to places they don't apply. In a similar vein, the RealizableComponent itself will probably soon be integrated into the RealizingSystem too.
The attempt at using Lua environments in order to encapsulate the different behaviors that objects exhibit was scrapped in preference of just creating differently named Lua tables for each prototype.
The new PrototypableComponent contains some information about entities which were prototyped. It is partially used by the ScriptingSystem to figure out what event handlers are appropriate, which may not be the best approach. It also has some data about automatic behavior, which also maybe does not belong in this component.
The OnTouch event is raised by a player colliding with a physics body with the collider type "event", which may not be the best way to implement this.
The result of all of this is that checkpoints now work, although no sound is played, and the result is not persistent across exiting the game.
|
| |
|
| |
|
|
|
|
| |
Currently moving platforms are able to have their movement controlled by a script rather than by XML, which is probably a better implementation and scales better to other things. The scripts, instead of using the components as state, use the stack as state. In this way, they pretend to be multithreaded. For instance, the moving platform calls moveRight and then moveLeft. Both of those functions internally make calls that say to wait until the next tick. When the AutomatingSystem ticks, it continues execution of all scripts (sequentially, of course) until they ask for the next tick again. This is implemented using coroutines.
|
|
|
|
|
|
| |
Ferries now pretend that their passengers have already moved by the appropriate delta when detecting collision in the direction of their passengers. This allows a ferry to move into the space where their passengers are when there is nothing else blocking it. It also allows for special behavior when a passenger is crushed between its ferry and a wall, but this is not yet implemented.
This fixes the first issue described in 8f1c4f1 -- that ferries cannot push their passengers. With this fix, ferries are basically functional.
|
|
|
|
| |
Positions and sizes are now stored as vectors (of doubles and ints, respectively). This allows for at least minor code simplification in many places, and cleans up the CollisionParams code in PonderingSystem quite a bit.
|
|
|
|
| |
Because there was a lot of code replication with collision detection, this new implementation uses a functor that takes a parameter object describing the things that are different between the four directions. This allows the collision detection code to be writen only once. It's currently very ugly, but should work identically to before.
|
|
|
|
| |
A body moving upward would have its transform incorrectly measured against the map collision boundaries.
|
|
|
|
| |
The collidable flag, previously unused, now correctly disables collision detection when unset. This has the side effect of platforms being able to move through a dying player. It is undecided whether this behavior is wanted.
|
|
|
|
|
|
| |
Frozen bodies are now still ticked, but their velocities and positions are no longer changed. This change was made so that frozen bodies can still be ungrounded/unferried, and that passengers of frozen bodies can still be ticked.
Also fixes a compile error.
|
|
|
|
| |
PonderingSystem now recursively ticks bodies, starting with unferried bodies at the top level, and recursively ticking their passengers. This fixes the second issue described in 8f1c4f1 -- that passengers may be ticked before their ferries, causing it to use out-of-date information about the ferry's location.
|
| |
|
|
|
|
| |
This fixes the third problem described in 8f1c4f1 -- that if a ferried body's transform is modified outside of the PonderingSystem, it will not be unferried as appropriate. This does still require that any future code that modifies a body's transform also unferries the body first.
|
|
|
|
|
|
|
|
|
|
|
|
| |
A freefalling body is considered to be "ferried" if it is grounded by another body (not a map). Its location is then dependent on the ferry's location; in this way, the ferry carries the passenger around.
This implementation is kind of buggy currently: first of all, ferrying does not work vertically upward, because the ferry will consider the passenger to be a wall and will not continue moving upward.
Second, ferries are not processed before passengers, so passengers can move in a physics tick using the knowledge of a ferry's location before it moves in that tick.
Third, if the transform coordinates are set by any system other than the PonderingSystem, the relative coordinates to the ferry will not be updated and the body will not be unferried if necessary.
This is still a cool commit because, three years later, we have finally overcome the issue that stopped development on the original branch in 2015.
|
|
|
|
|
|
|
|
| |
The new AutomatingSystem and AutomatableComponent are responsible for simple AI tasks. This currently is limited to moving entities at a certain speed for certain periods of time. These tasks are arranged as a set of behaviors, which are picked randomly when automation starts or when a behavior finishes executing. A behavior is a sequence of actions that run one after another.
Currently, if an automated entity is blocked from moving by a collision, it will be coerced out of its intended path. This is because the automation parameters are stored as a speed and a duration, rather than a starting location and an ending location. This may end up being changed, or made configurable, as this is an early implementation of this feature and will need to be more complex later.
Added an RNG object to the Game class, so that the AutomatingSystem can pick behaviors at random.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Collision checking in PonderingSystem was rewritten to work as follows: horizontal movement is step first, then vertical. In each step, the closest environmental boundary to the body is found on the axis of movement in the space traversed by the body. Then, if any map objects fall in the region between the body's old position and the environmental boundary (or body new position if no boundary was found), process collision with those bodies in increasing distance order, stopping if a collision stops movement short of where the next collision would take place. After this, process collision with all of the environmental boundaries at the axis distance found earlier, as long as movement hasn't stopped short.
This is not the most optimal implementation, and there is a lot of code repetition, but it is a start and it works.
All map objects currently function as walls.
This fixes the bug where you could, with pixel-perfect precision, jump into the corner of a wall tile.
The top of the hitbox for the spike tile was lowered by one pixel. This fixes a problem where if the player is halfway on a floor tile and halfway over a spike tile, the floor tile would not stop the spike tile from being processed, and the player would die.
|
|
|
|
| |
Map objects cannot be interacted with or collided with yet but the sprites are loaded.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The World class was removed and replaced by the RealizingSystem and RealizableComponent. The realizable entity is intended to be a singleton and to represent the world. The Map class was also removed and integrated into the MappableComponent.
These changes are to facilitate implementation of map objects without needing special intermediary objects (including the Map class). Now, map entities are created as soon as the world is created, and map object entities will be as well. They will simply be deactivated while the map is not active. Multiple players are now slightly better supported, which will be important in the future.
This will likely become inefficient as the world becomes bigger, and some sort of sector-loading process will have to be designed. This also reduces the usefulness of EntityManager's entity-searching capabilities (which are not the most efficiently implemented currently anyway), and will likely in the future require some added functionality to better search subsets of entities.
A lot of the components were also rewritten to use bare member variables instead of accessor methods, as they never had special functionality and just took up space. These components were also documented.
|
| |
|
| |
|
|
|
|
| |
Also added ability to make sprites flicker, to freeze physics for an entity, and to freeze progression of a sprite's animation loop.
|
|
|
|
|
|
| |
This brings along with it the ability to move to different maps, for which the PlayingSystem and PlayableComponent were introduced. The PlayingSystem is a general overseer system that handles big picture stuff like initializing the player and changing maps. The PlayableComponent represents the player. While the ControllableComponent is also likely to always only be on the player entity, the two are distinct by separation of concerns.
This also required a refactoring of how collisions are processed, because of a bug where the player can move to a new map when horizontal collisions are checked, and vertical collisions are skipped, causing the player to clip through the ground because the normal force was never handled.
|
|
|
|
|
|
| |
Renderer is basically now more C++'y, as it makes more use of classes (a lot of GL types have been wrapped), and the renderer itself is now a class. The monitor mesh is also now indexed.
Tweaked the NTSC artifacting after inadvertently fixing a bug with the way the image was loaded.
|
|
|
|
|
|
|
|
|
|
| |
The issue appears to have been caused by blending with unset alpha channels.
Also included the re-ordered player character sprite image.
The CMake file has been updated to include linking against some Apple libraries that are usually already included in GLFW3.
refs #1
|
|
|
|
|
|
|
|
| |
A lot of the stuff that ControllingSystem did to control the player character was moved into the new OrientingSystem. This is so that the player, or any player-like entities, can also be controlled by AI, with the underlying behavior being delegated in the same way as if the player were being controlled by the user.
Fixed the issue where, if the player were blocked while moving horizontally, they would remain blocked even if vertical movement were to remove the collision.
Fixed cases of the player animating incorrectly after performing certain movements.
|
|
|
|
| |
Only wall and platform collision currently works, and map edges are not currently implemented.
|
|
|
|
| |
Refactored how systems work slightly. Now, rendering can be done by a number of systems working together. Since the AnimatingSystem handles the animation of sprites, it should also handle the rendering of them. Because of this, the RenderingSystem has been removed.
|
|
|
|
| |
Also restyled a lot of the code.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| | |
This is pretty old so I'm not exactly sure what it does but without it,
the monitor gets rendered upside down.
|
| |
| |
| |
| |
| |
| |
| |
| | |
This should improve speed, because entity lookup will be O(1) instead of O(log n). Deletion is also O(1). Insert stays at potentially O(n), but still should be overall faster than the previous method.
Also replaced some asserts with exceptions.
Also made Component polymorphic so that deletion actually works properly.
|
| | |
|
| |
| |
| |
| | |
Also whitespace changes.
|
| | |
|
| | |
|
|/ |
|
|
|
|
|
|
| |
boundary
It turns out that it is somewhat confusing that GAME_HEIGHT != MAP_HEIGHT*TILE_HEIGHT
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|