Epic Combo Redux



Not familiar with Observables/RxJS v6?

Epic Combo Redux, Use legendary combinations to attack them as you gain money for awesome upgrades and more weapons.Controls: Arrows = Move, Space = Hit. Description: Cause the stickman to crush heaps of turtle shells in Epic Combo Redux, the continuation of the peculiar, fun-addicting activity game. Utilize unbelievable mixes to attack them as you pick up cash for magnificent redesigns and more weapons.

  • Tags: Epic game, Epic Combo game, Epic Combo Redux game, Epic Combo Redux 2 game,Epic Combo Redu 3 game, Epic Combo Redux Download Plays: 9,332 times Add this game to your web page!
  • Epic Combo Redux. 90: 5: 3M: Action Games of 2012 Speedrun Flash Quest. Quests; Overview; Player Levels; High Scores; Wiki; Quest Chat All Quests.

redux-observable requires an understanding of Observables with RxJS v6. If you're new to Reactive Programming with RxJS v6, head over to http://reactivex.io/rxjs/ to familiarize yourself first.

redux-observable (because of RxJS) truly shines the most for complex async/side effects. If you're not already comfortable with RxJS you might consider using redux-thunk for simple side effects and then use redux-observable for the complex stuff. That way you can remain productive and learn RxJS as you go. redux-thunk is much simpler to learn and use, but that also means it's far less powerful. Of course, if you already love Rx like we do, you will probably use it for everything!

An Epic is the core primitive of redux-observable.

It is a function which takes a stream of actions and returns a stream of actions. Actions in, actions out.

It has roughly this type signature:

While you'll most commonly produce actions out in response to some action you received in, that's not actually a requirement! Once you're inside your Epic, use any Observable patterns you desire as long as any output from the final, returned stream, is an action.

The actions you emit will be immediately dispatched through the normal store.dispatch(), so under the hood redux-observable effectively does epic(action$, state$).subscribe(store.dispatch)

Epics run alongside the normal Redux dispatch channel, after the reducers have already received them--so you cannot 'swallow' an incoming action. Actions always run through your reducers before your Epics even receive them.

If you let an incoming action pass through, it will create an infinite loop:

Combo

The pattern of handling side effects this way is similar to the 'process manager' pattern, sometimes called a 'saga', but the original definition of saga is not truly applicable. If you're familiar with redux-saga, redux-observable is very similar. But because it uses RxJS it is much more declarative and you utilize and expand your existing RxJS abilities.

A Basic Example

IMPORTANT: Our examples will not include any imports. Under normal circumstances, all operators (the functions used within the pipe() method) must be imported like import { filter, mapTo } from 'rxjs/operators';

Let's start with a simple Epic example:

Noticed how action$ has a dollar sign at the end? It's simply a common RxJS convention to identify variables that reference a stream.

pingEpic will listen for actions of type PING and map them to a new action, PONG. This example is functionally equivalent to doing this:

REMEMBER: Epics run alongside the normal Redux dispatch channel, after the reducers have already received them. When you map an action to another one, you are not preventing the original action from reaching the reducers; that action has already been through them!

The real power comes when you need to do something asynchronous. Let's say you want to dispatch PONG 1 second after receiving the PING:

Your reducers will receive the original PING action, then 1 second later receive the PONG.

Since filtering by a specific action type is so common, redux-observable includes an ofType operator to reduce that boilerplate:

Need to match against multiple action types? No problem! ofType accepts any number of arguments!action$.pipe(ofType(FIRST, SECOND, THIRD)) // FIRST or SECOND or THIRD

Try It Live!

Epic Combo Redux

A Real World Example

Now that we have a general idea of what an Epic looks like, let's continue with a more real-world example:

We're using action creators (aka factories) like fetchUser instead of creating the action POJO directly. This is a Redux convention that is totally optional.

We have a standard Redux action creator fetchUser, but also a corresponding Epic to orchestrate the actual AJAX call. When that AJAX call comes back, we map the response to a FETCH_USER_FULFILLED action.

Remember, Epics take a stream of actions in and return a stream of actions out. If the RxJS operators and behavior shown so far is unfamiliar to you, you'll definitely want to take some time to dive deeper into RxJS before proceeding.

You can then update your Store's state in response to that FETCH_USER_FULFILLED action:

Epic Combo Redux Hacked Unblocked

Try It Live!

Accessing the Store's State

Your Epics receive a second argument, a stream of store states.

With this, you can use state$.value to synchronously access the current state:

Epic Combo Redux 3

You can also use withLatestFrom for a more reactive approach:

REMEMBER: When an Epic receives an action, it has already been run through your reducers and the state updated.

Try It Live!

Combining Epics

Epic Combo Redux Kongregate

Finally, redux-observable provides a utility called combineEpics() that allows you to easily combine multiple Epics into a single one:

Note that this is equivalent to:

Next Steps

Next, we’ll explore how to activate your Epics so they can start listening for actions.

Epic Combo Redux is only supported on Armor Games. Please play it here.

This is a remake of the original one-day project Epic Combo. I wanted to revamp the graphics and give it a performance boost for modern computers. Jimp did the artwork for the game in this version, adding his graphic talent to the game. We also added a few more items to the game to boost the achievements and ways to build the playing field.

Programming: John
Art: Jimp
Music: Kevin MacLeod (Incompetech.com)
Produced by: Armor Games