Search Unity

Phase Jump Pro: Open Source Code for 2D Games/Design Patterns

Discussion in 'Assets and Asset Store' started by coinbump, Jul 4, 2019.

  1. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    I have developed several games for iOS that have been played by millions of users.

    I noticed there are a set of common design patterns for game creation, so I created an OpenSource project with some of those called Phase Jump Pro. The code is primarily focused on 2D games, but anything that's not position-specific can be used in a 3D game as well.

    LinL: https://github.com/coinbump/PhaseJumpPro

    The code contains common design patterns for games in C#:
    • Behavior Trees
    • Weighted randoms (Spawn/Loot Tables + Spawner2D with spawn radius)
    • Common Shaders (Stencil, Desaturate, Invert, Single Color, RGB-Recolor, etc.)
    • 2D Movement paths (straight line, circle)
    • Directional Velocity (2D-Kinematic)
    • Emitters/Auto Emitters (firing bullets with time/count limits, Auto Emitter for shmups)
    • Formations (auto populate template objects into a formation). EXAMPLE: line of hearts to show health
    • Valves (for animated doors, switches, etc.)
    • Interpolation curves
    • Broadcast-Listener
    • Command (for undo-redo)
    • Timers
    • ObservedValue
    • Goals (for game goals (complete N tasks to continue))
    • Signal-Receptor (for tutorials)
    • State Machines
    • Concept-Demo (for tutorials)
    • Bank for Currency (freemium apps)
    • TopDown2D characters and basic steering (Flip, Wander, Wander-to-Target)
    • Input Schemes (Move to Mouse for Cursors, Aim at Mouse for shooters)
    • Grid-Based Games (Bejeweled, Tetris, etc.)
    There's also some scripts in there for setting up pixel art game assets.
     
    mgear and Circool like this.
  2. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    Haven't had much time to work on this, but I added a couple of common special FX:

    - CameraShake2D: attach to main camera and call shake for a camera shake effect
    - SpriteTrail2D: creates a fading trail of sprite-image copies as your sprite moves (see image).
     

    Attached Files:

  3. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    New Release adds some useful utilities for games.

    https://github.com/coinbump/PhaseJumpPro/releases/tag/1.1
    • New Class: MouseOverFocuser2D <- gives focus to object that is under the mouse

    • New Class: ScaleFocusable <- scales the object when it has focus

    • New Class: TransformFocusable <- transforms the object when it has focus

    • New Class: AttachFocusable <- attaches a child object when it has focus
    • New KAxisControlScheme2D for kinematic objects that move in response to joystick input with deadzone support and basic interpolation (optional). Useful for Gradius/1942 type games with no physics
     
  4. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    New Release adds some useful utilities for layout of Game Objects outside of a canvas:

    https://github.com/coinbump/PhaseJumpPro/releases/tag/1.2

    - `HFlow`: Arranges 2D objects horizontally
    - `VFlow`: Arranges 2D objects vertically
    - `GridFlow`: Arranges 2D objects in a grid
    - `SpriteOrderer`: Sets the sort order of sprites based on their order in their parent. Useful for stacks of things like cards
     
  5. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    New Release adds drag and drop support for 2D games:

    https://github.com/coinbump/PhaseJumpPro/releases/tag/1.3

    - `Dragger2D`: Handles drag behavior (attach to any persistent object in scene)
    - `Draggable2D`: Attach to objects that can be dragged (also attach a Rigidbody2D and a Collider for mouse-hit testing)
    - `DropTarget`: Behavior for targets of a drag
    - `SpriteDropTarget`: Changes the sprite for an object when the drag is over it
     
  6. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    New release adds Plane mesh builder, node-based mesh warping:

    https://github.com/coinbump/PhaseJumpPro/releases/tag/1.4

    Introduced a node-based mechanism for building and warping plane meshes:

    - PlaneMesh: builds an NxN plane mesh. Useful as a starting point for warping (FX, terrain, etc.)
    - PlaneMeshBuilder: MonoBehaviour. Attach to object for `PlaneMesh` (requires a MeshFilter to be attached)
    - SinMeshBuilder: warps a plane mesh with a sin curve. Animates (optional)
    - PerlinNoiseMeshBuilder: warps a plane mesh with Perlin noise
    - GoStandardNode: used to build up a serial node graph for mapping noise maps, sin maps, etc. to an output that can be then used to warp a mesh
    - Map1DToMap2DNode: Converts a 1D map to a 2D map
    - MultiplyMaps2DNode: Multiplies two 2D maps together (multiply two noise maps)
    - PerlinNoiseNode: Outputs Perlin noise based on Vector2 input
    - RandomNoiseNode: Outputs random noise based on Vector2 input
    - SerialBuilder: Utility to make building serial node graphs easier
    - SinMap1DNode: 1D map of a sin wave with normalized or non-normalized output
     
  7. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    New release adds Mesh builders for common shapes used in Computer graphics:

    https://github.com/coinbump/PhaseJumpPro/releases/tag/1.6

    - EllipseMesh: builds an ellipse mesh
    - CircleMesh: builds a circle mesh
    - EllipseFrameMesh: builds an ellipse frame mesh
    - PolyFrameMesh: builds an ellipse for a poly-line or closed polygon render
    - QuadFrameMesh: builds a quad frame mesh
    - SeparatedPlaneMesh: builds a plane mesh where no vertices are shared. Can be used for shatter-type animations


     
  8. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    Phase Jump 2.0 is out, with support for TopDown shooters, better animations, life timers, life timer that starts an animation when the object is about to be destroyed, functionality for seeker missiles, objective arrows, etc.

    Link: Phase Jump Pro 2.0

    ## Changes
    - **Graphs**: support for both Acyclic and Cyclic graphs
    - **WeaponEmitter2D**: logic for emitting burst, auto, or rate limited bullets
    - **Better animations**: Animations can now animate the color of a sprite, TextMeshPro, or material (shared or copy)
    - **Blink animation**: flicker renderer on and off (used for hit animations)
    - **Flash animation**: flash render color (used for hit animations)
    - **LifeTimer**: destroys object after N seconds
    - **LifeTimerAnimation**: links to another animation component attached to the object, and enables that animation just before the object is destroyed. Example: coin appears, lives for 5 seconds, then starts blinking at 3 seconds to indicate its life timer is about to run out
    - **RotateAnimation2D**: animation moved out of Node2D and into its own animation class
    - **FadeAnimation**: fades node in or out
    - **GridSpawner2D**: spawns objects into grid cells
    - **KinematicSwitcher**: switches all objects in the scene between kinematic and non kinematic behavior for testing
    - **MultiCollider**: allows code that can operate on either Collider or Collider2D through the wrapper
    - **Node2D**: improved logic, naming, tested with kinematic/non-K systems
    - **SceneObjectRegistry**: register gameobjects, audio objects by name for access later
    - **TextMeshValueObserver**: listens to a PublishedValue<string> and updates the text mesh when it changes
    - **Unit Tests: ** Even more unit tests (> 100 to ensure code quality)
    - **Input System**: Upgraded to new Unity Input system
    - **Polygons**: Polygon type for defining polygons
    - **TiledMaterialBuilder**: sets up material for tiling (repeat texture)
    - **Grids**: Better grid code. Grid has been renamed to Matrix (more accurate)
    - **Random**: Random class allows us to inject either Unity’s random value or or own for testing scenarios
    - **AngleAxisLimiter2D**: limits degree angles to a fixed number examples for 4-way, 8-way topdown game movement
    - **Binding**: binds one PublishedValue to another. When value A changes, value B is modified
    - **CounterLimiter**: limits an action to be performed up to N times
    - **PublishedValue**: broadcasts events when its value changes
    - **RateLimiter**: limits rate that events can occur to min delta between events
    - **Core**: Core has StateMachine<type> now instead of StateMachine<string>
    - **SomeListener**: SomeListener is now an interface instead of an abstract class (makes it easier for classes to add this interface)
    - **Interfaces**: Updatable (handles OnUpdate), Statable (has state)
    - **Materials**: OpaqueColor, TransparentColor, LinearGradientOpaque, LinearGradientTransparent
    - **Steering**: BounceSteering2D: bounces 2d node on collision (reflect off normal)
    - **MeshScroller**: scrolls a mesh either by TextureOffset or by altering the UV coordinates
    - **Bullet2D**: stores damage value for bullets
    - **GravityWell2D**: adds gravity force to attract objects within radius
    - **Pointer2D**: points at a specific target onscreen (use for objective arrows)
    - **RectTransformLimiter2D**: limit a kinematic objects’ bounds to a rect
    - **Seeker2D**: seeks out a target for N seconds (use for homing missiles)
    - **SegmentProgressBar2D**: show progress as a row of unfilled/filled images
    - **Weapon, Weapon2D**: provides specs for weapon for games with bullet-based behavior
    - **WeaponEmitter2D**: handles bullet emits based on Weapon2D blueprint
    - **Better TopDownInputControlScheme2D**:, using new Input Scheme (currently broken: mouse input, Draggable2D, Dragger2D, MouseOverFocuser2D)
    - **Optional<T>**: to pass optional values
    - **SomeReferenceType**: pass values as either strong or weak reference
    - New Example Unity project uses URP render pipeline
    - **HueAnimation**: cycles hue
     
  9. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    Phase Jump 2.7 Adds support for

    2D Sensors with Occlusion testing: Area and Scan sensors that support occlusion testing.



    Matrix Boards/Pieces/Nodes. A Matrix Board has matrix pieces. Each game object has a Matrix piece that is placed in the board. The Matrix Board Runner animates moving pieces across the board. Used for game types such as: Grindstone, Match-3, Tetris.



    - Animator: handles run-once, loop, ping-pong animations
    - Move Paths: new and improved, using Animator
    - Signal Timer: fires a signal when finished (useful for dealing card animations)
    - Arc Mesh: Builds a mesh in an arc shape
    - CirclePathLayout: lays out objects along a circle path
    - BezierPathLayout: lays out objects along a bezier path
    - ObjectListBuilder: populates a game object with a list of templates (useful for building grids or collections of things)
    - PublishedList: sends events when the content of a list changes
    - State Machine Graphs: State machines are now graphs and can accept OnInput for input-based transitions
     
  10. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    Link: https://github.com/coinbump/PhaseJumpPro

    v2.21 Adds support for
    - Cards, card decks, card deck parsing
    - New meshes: Rounded Rects, Ellipse Frame, Capsule, Capsule frame, Arc
    - Mouse Hover effects (using UISystem)
    - Buttons with button tracking
    - Toggle buttons
    - Step-based simulations (Example: Conway's game of life)
    - Click-and-drag marquee selection (Selects objects that have a `SelectHandler` attached)
    - SelectHandler to select objects (using `UISystem`)
    - FocusHandler for focus
    - CannonEmitter2D for 2D shooters
    - CycleAnimator for animating properties
    - More Example projects: Checkers, Deal Cards, MineSweeper, Matrix Runner, TopDown Shooter, etc.





     
  11. coinbump

    coinbump

    Joined:
    Jan 24, 2014
    Posts:
    12
    Link: https://github.com/coinbump/PhaseJumpPro

    v2.22 Release adds support for

    - UI Layers. UISystem automatically sets the Z position of parent objects to make z-sorting easier
    - SQLite Wrappers for C#/C++ (C++ is Xcode only for now). NOTE: Using SQlite with Unity requires installing some plugins