1. 29 Dec, 2016 3 commits
    • Terence Martin's avatar
      Unplug blocked exits to Teleport entities · 437fa4d8
      Terence Martin authored
      It is possible for a ball to exit a Teleport and then not be able to
      drop further. When this happens, the ball movement stops and the ball
      gets put back into the maze at the location of the Teleport exit.
      This clobbers the Teleport out of the maze at this location, although
      it still visually renders at this location because the render is based
      on destinations (they all share the same entity). This results in that
      being an "exit only" teleport; the ball can't enter the teleport there
      because it's not in the maze any longer.
      Now when we determine that we are about to drop the ball down, we
      check to see if the position that we're currently occupying is empty
      and also a destination in the single teleport entity.
      If this is the case, we can re-insert the teleport, which allows this
      location to be the source of a teleport operation again.
    • Terence Martin's avatar
      Enhance Teleport; select non-blocked destination · 336736d5
      Terence Martin authored
      This change adds to the Teleport entity the ability to ensure that the
      position that it returns in response to ballTouch() is a location to
      which the ball can be transported without blocking.
      This is done by conducting a pre-check to ensure that there is at
      least one valid destination to select, so that it won't loop forever
      if all of the destinations are blocked.
    • Terence Martin's avatar
      Include extra balls for testing purposes · 17284159
      Terence Martin authored
      In order to make debugging easier, we add a few extra balls to the
      pool instead of the exact number that we need. That way there are some
      left in reserve for adding to a level.
  2. 28 Dec, 2016 7 commits
    • Terence Martin's avatar
      Clear unplayed balls at the appropriate time · 770002c1
      Terence Martin authored
      This ensures that if any balls are unplayed for either player (due to
      being blocked), they are visually removed from the screen while all of
      the blocked balls are being removed, so that they don't remain just
      dangling there at the end of the run.
    • Terence Martin's avatar
      Fix blocked player playing ball bug · ef9e9917
      Terence Martin authored
      This is the bug where the player can try to push the ball while its
      blocked and it still works. This would get things all out of sync
      and mess everything up.
    • Terence Martin's avatar
      Cleanup; remove redundant code · 517aaf44
      Terence Martin authored
      This removes some methods that used to be used to generate randomly
      selected columns and rows. Now each method does this on their own,
      so that they can customize the range if they want to.
    • Terence Martin's avatar
      Change bonus brick generation to be per column · a51f866a
      Terence Martin authored
      This works the same as the gray brick code. In fact, so similar that
      it seems like I should actually make that one method that does both.
    • Terence Martin's avatar
      Change gray brick generation to be per column · be1798e4
      Terence Martin authored
      This now works the same as the arrow generation, although we now
      possibly have no gray bricks in a column, where an arrow always has
      at least one.
    • Terence Martin's avatar
      Change arrow generation to be per column · 056d8c83
      Terence Martin authored
      We now generate arrows by column instead of by row. This makes for a
      more pleasing layout, as it ensures that the arrow are a bit less
      clumpy and that there are no paths through the maze that don't take a
      weird circuitious route.
    • Terence Martin's avatar
      Tweak black hole generation · 7d2bfa79
      Terence Martin authored
      We now generate the black holes into a narrower band in the maze
      content area; they will not populate near the top or bottom of the
      grid, and they won't spawn next to the walls.
      Additionally, the range between them has been extended a tile and we
      ensure that there is only ever a single teleport per column at most,
      to maximize the chaos of the ball jumping around in the maze.
  3. 27 Dec, 2016 13 commits
    • Terence Martin's avatar
      Update game thumbnail · b6433ae9
      Terence Martin authored
    • Terence Martin's avatar
      Update Ball API to use new scores · 2e2bb546
      Terence Martin authored
      Now that the values for the scores are in place, the AI code has been
      modified to use the proper values during it's evaluation process.
    • Terence Martin's avatar
      Score for blocked balls at round end · 6f1de1c6
      Terence Martin authored
      Score partial points based on ball position whenever a ball is
      vanished during the game without it having reached the goal line. This
      can happen when a ball is blocked and removed before the final ball
      drop, or when the final ball drop does not end the ball at the goal
    • Terence Martin's avatar
      Score for balls at the goal line · 9213c393
      Terence Martin authored
      When a ball reaches the goal at the bottom of the screen (regardless
      of when this happens), score points for that ball.
    • Terence Martin's avatar
      Score for bonus bricks · 831ec388
      Terence Martin authored
      When a ball passes through a bonus brick during the regular game,
      apply a score change to the owner of that ball.
    • Terence Martin's avatar
      Update ball drop finished event handler · 9c54b987
      Terence Martin authored
      The ballDropComplete() handler now takes a boolean flag that indicates
      if this ball drop was finalized as part of a regular ball drop (false)
      or a final ball drop (true).
      This allows us to apply score to the ball when it stops, if we need
    • Terence Martin's avatar
      Add player property to Ball · 91733a2c
      Terence Martin authored
      This gives the Ball the ability to return what player owns it based on
      its own type. This will be used during the score modifications to
      determine who gets the points.
    • Terence Martin's avatar
      Render scores and reset on maze generation · 9aed72e4
      Terence Martin authored
      This will need to be tweaked when we have multiple rounds, but it's
      good enough for now.
      The scores are unadorned, but are enough for us to be able to track
      what is going on.
    • Terence Martin's avatar
      Include code for tracking and rendering score · 2dc295c4
      Terence Martin authored
      This includes the global game state routines and values that will be
      used to track the score, alter it, and render it to the screen.
    • Terence Martin's avatar
      Include KenVector font · 1e2b7768
      Terence Martin authored
      This is freely available and my font of choice for nice looking
      monospace text.
      This font is set as the default font at a set size upon activation of
      the game scene, so that we don't have to keep swapping it into the
    • Terence Martin's avatar
      Make maze regeneration a debug key · ff660aec
      Terence Martin authored
      This should only happen while in debug mode, not during game mode. If
      you're trying to play a game to test and you press the key by mistake,
      it's the sad maker.
    • Terence Martin's avatar
      Refactor final ball drop flag setting · 0d43c88a
      Terence Martin authored
      Instead of code needing to remeber to set the flag to some value, we
      now just make it a parameter to the drop function.
    • Terence Martin's avatar
      Fix drop ball bug introduced yesterday · 5e7cb088
      Terence Martin authored
      Yesterday I introduced some new code where we could detect a vanished
      ball but not trigger the notification that a ball drop was complete if
      the ball was being vanished due to it being a blocked ball.
      This was a bit flawed but unfortunatey I didn't notice it until it was
      too late. Basically it would not trigger for a ball that vanished
      because it got to the goal, because I used the wrong variable to track
      if the event should trigger or not (_droppedBall instead of
      _lastDroppedBall) and since _droppedBall gets cleared as soon as the
      vanish is called, such a ball is treated like a blocked ball.
      This has been fixed by using the correct variable.
  4. 26 Dec, 2016 6 commits
    • Terence Martin's avatar
      Add a new event for removing blocked ball · f3d4974f
      Terence Martin authored
      This adds in a new event that tells us when a blocked ball is being
      removed (happens once when the ball is told to vanish).
      This can be used to add blocked balls to the final score when that
    • Terence Martin's avatar
      Tweak the ball drop event · e71e3ed4
      Terence Martin authored
      It no longer gets the boolean indication; this can be determiend by
      the caller based on the map position of the ball when it stopped.
    • Terence Martin's avatar
      Fix bugs in blocked ball removal · b7594275
      Terence Martin authored
      This code went through several iterations, and so some things were not
      in the correct order (e.g. null test AFTER other tests).
      There was also an issue where a vanished ball would trigger the  ball
      drop complete method and then throw an error because there is no
      dropped ball, which I have currently patched away but this needs to be
      handled better.
    • Terence Martin's avatar
      Implement ball removal state · cacdab8a
      Terence Martin authored
      This hooks into the previously created method and will continuously
      try to remove blocked balls from the maze until the method tells it
      that there are no further balls to remove and all that were removed
      are now done with.
      We skip to this state when all plays are exhausted and then to the
      remove gray bricks state once this is completed.
    • Terence Martin's avatar
      Add a state for the new ball removal · 416c2951
      Terence Martin authored
      Adds in a new state for the purposes of handling when we are removing
      all blocked balls from the maze.
    • Terence Martin's avatar
      Include method to find and vanish blocked balls. · d9bc2a01
      Terence Martin authored
      This will be used during end game, just prior to vanishing all of the
      gray bricks and dropping the final balls.
      We want to be able to find all balls that have no chance of moving
      because they are either stopped on an arrow, or stopped on top of a
      ball waiting on an arrow, and then remove them away like the gray
      bricks do.
  5. 25 Dec, 2016 5 commits
    • Terence Martin's avatar
      Hide players before final ball drop · cd982101
      Terence Martin authored
      Now when we enter the phase for the final ball drop, we make sure that
      the human and computer Player entities are hidden.
    • Terence Martin's avatar
      Fix possible premature state change · 05a53006
      Terence Martin authored
      The code for starting the next ball dropping in the final ball drop
      was incorrectly only checking to see if a ball is hidden without also
      checking to see if it's still actively hiding; fixed.
    • Terence Martin's avatar
      Clean up pushed ball marking · 366ba91e
      Terence Martin authored
      Now that we know the dropping of balls works for removing balls from
      the two player arrays, remove the debug logging.
      This was particulary annoying in that it would warn about pushing a
      ball not in one of those arrays when the final ball drops were going
    • Terence Martin's avatar
      Fix final ball drop bug · c3da8655
      Terence Martin authored
      It turns out that the reason for this failure was entirely because I
      incorrectly stopped the search for balls to remove for being vanished
      one column short of the edge.
      This means that any final ball dropped in the last column of the maze
      will vanish but not be reaped. Thus the flag for the ball being done
      will never get set and everything stalls out.
    • Terence Martin's avatar
      Allow for the notion of no gray bricks · d4a3f817
      Terence Martin authored
      This is probably only of use when debugging, but as originally written
      the code would get stuck and not be able to enter the final ball drop
      if there are no gray bricks in the level because in that case there
      are none to reap.
      This is fixed by having the method that would normally remove such a
      brick return false if there are none left to remove; when this happens
      the code can immediately jump to the next phase.
  6. 24 Dec, 2016 5 commits
    • Terence Martin's avatar
      Put final ball drop under the control of states · 4b351244
      Terence Martin authored
      This puts the final ball drop into the control of the state machine;
      when we are in the final ball drop state, we select a ball and drop
      it, and then return to this state once the ball is done.
      There is currently a bug in this in which sometimes during the final
      ball drop a ball (that is blocked?) starts dropping, but the flag that
      says that it is done moving is not set.
    • Terence Martin's avatar
      Swap to final ball drop state when bricks gone · 1f9e5ca8
      Terence Martin authored
      Now the maze will invoke a method on the listener to tell it that all
      of the gray bricks have vanished out of the maze and have been reaped.
      The Game state uses this to transition into the final ball drop state,
      so that it can start the final ball drop of the round.
    • Terence Martin's avatar
      Switch to removing gray bricks when no moves left · 364531a8
      Terence Martin authored
      Now instead of swapping to the final ball drop state, we swap to the
      state in which we remove all gray bricks. We handle this state by
      using the state timer to slowly remove all of the gray bricks (telling
      them to vanish).
      Currently the code that reaps vanishing bricks is just spewing a
      console log every time it knows all of the gray bricks are gone.
    • Terence Martin's avatar
      Clarify the usage of currently defined states · c0cd298d
      Terence Martin authored
      Now that we have a better idea of the exact flow that we're going for,
      update the documentation comments for how all the states are used.
    • Terence Martin's avatar
      Remove Maze handling of removing gray bricks · beb4c0db
      Terence Martin authored
      The code in the Maze entity that tries to determine for itself if it
      should remove all gray bricks has been removed. Now no gray brick
      removal happens at all.
  7. 23 Dec, 2016 1 commit
    • Terence Martin's avatar
      Check that a play is possible before switching · 41bc2c35
      Terence Martin authored
      We can now check to ensure that if it is to be a player's turn, that
      there is a valid move for that player first. If not, we instead skip
      to the next player's turn.
      In the case that neither player has a valid move, we transition to the
      state that handles the final ball drop, although currently that's not
      how this state is handled.