# [final] Monkey King

## Recommended Posts

Hi all

I've finished my 2nd Atari game.

Monkey King is an endless runner with a strategic twist. Made for one or two players, played with the joystick controllers.

---Backstory---

You are a monkey prince, one of two children of the Monkey King. Your father is old and wants to retire, but not before a suitable successor is chosen for the throne. The king, like his father before him, obtained the crown by participating in an ancient monkey ritual, the climbing one of the two sacred trees. No-one knows how tall these identical trees are and if there is a top at all, but the top of the tree is not the goal. The goal is getting higher than your competitor.

During the ritual two royal candidates run up one of the trees while avoiding its many branches, running faster and faster until one of the two bumps their head once too many. On the tree the monkeys can find magical stones that can be used in their advantage, or their competitors disadvantage.

Only one monkey can be the Monkey King, will it be you?

Thanks to: RevEng, Random Terrain, Karl G, Lillapojkenpaon, Arenafoot, StanJr.

Uses minikernel by CurtisP edited by Karl G, score graphics kernel by RevEng and music example by RandomTerrain.

Edited by Coolcrab

##### Share on other sites

I watched your game on Zeropage Homebrew last night and made the suggestion with the falling coconuts.

• Make the speed increase even more gradually (e.g. using fractional math), so that there are no noticeable speed jumps. Currently the increase might still catch a player and cause unfair deaths.
• The minimal gap of one block between branches is IMO too small. Also for switching sides. It should at least be 2 blocks. That or make the blocks taller or the monkeys smaller
• How about using the missiles for the coconuts too? That would avoid the flicker and the coconut would not hide behind branches. For doing that with the simple kernel, either the dots or the coconuts could be on the screen at the same time.
• Coconuts should only fall if the player has a fair chance to escape. So there must be a gap of at least 2 blocks on the opposite side somewhere when the coconut passes.
• The dots should usually be in a fair position (not inside a branch or within a too minimal distance).
• Coconuts should appear on both sides of the trunk.
• The coconuts should fall faster.
• In single player game the sprite of the other player glitches on death
• The game sometimes displays 264 instead of 262 scanlines
• The branches at the bottom should disappear a smoothly as the appear on the top.
• Last not least: The game is missing some sprite animations. :)

Fractional math is simple: Instead of e.g. moving every 4th frame, add 256/4 = 64 to a sum variable each frame. When it overflows, move. That will cause moving every 4th frame. To accelerate, simply increase the added value one by one. E.g. if you add 65, the game will move every 3.94th frame. This will result into a very smooth speed increase.

Eventually the added value may 256 and overflow to 0. Then you need a 2nd variable, which contains the high byte of the speed. If it is e.g. 2, the movement will be 2 plus the fractional movement from the added low speed byte.

##### Share on other sites

Thanks for the comments! I have implemented what I could with a small changelog below. I slightly edited your message to number the bullets for easier replying.

I watched your game on Zeropage Homebrew last night and made the suggestion with the falling coconuts.

1. Make the speed increase even more gradually (e.g. using fractional math), so that there are no noticeable speed jumps. Currently the increase might still catch a player and cause unfair deaths.
2. The minimal gap of one block between branches is IMO too small. Also for switching sides. It should at least be 2 blocks. That or make the blocks taller or the monkeys smaller
3. How about using the missiles for the coconuts too? That would avoid the flicker and the coconut would not hide behind branches. For doing that with the simple kernel, either the dots or the coconuts could be on the screen at the same time.
4. Coconuts should only fall if the player has a fair chance to escape. So there must be a gap of at least 2 blocks on the opposite side somewhere when the coconut passes.
5. The dots should usually be in a fair position (not inside a branch or within a too minimal distance).
6. Coconuts should appear on both sides of the trunk.
7. The coconuts should fall faster.
8. In single player game the sprite of the other player glitches on death
9. The game sometimes displays 264 instead of 262 scanlines
10. The branches at the bottom should disappear a smoothly as the appear on the top.
11. Last not least: The game is missing some sprite animations.  :)
1. Done and works great, thanks for the tips!
3. Not sure if that will work, as far as I know the missile cannot be made into a square. It only extends in 1 direction.
4. This is difficult to do as it depends on where the monkey is in the tree and how quickly you react. I don't think that it traps people very often, but more playtests would be needed to see how annoying this is.
5. I tried to fix this. With the smaller monkey it is possible to catch most of them and live. The most annoying ones are the ones in between two branches. But those can be obtained now.
6. Fixed
7. Are you sure? They are quite deadly already, if they fall faster people will have too little time to react I think.
8. Fixed
9. Fixed (I think)
10. I'm not sure if this is possible as there is no 'invisible' row at the bottom to shift into. And I can't let it wrap back up as it will interfere with the branch creation then.
11. I had a look at this. and tried to animate the new monkey. (As can be seen in this version) but it doesn not really look good imo. If anyone is good at making small sprites and has a better animation idea then please share! :)

##### Share on other sites

3. Missiles can be displayed 1, 2, 4, or 8 pixel wide. Not sure if bBasic supports that though.

4. You only need to know the tree, the monkey can move to the right position. There has to be at least one a large enough (probably at least two blocks) gap on the opposite side when the coconut passes.

##### Share on other sites

bB can change the value of NUSIZ0 and NUSIZ1.  Plus, the kernel he's using can change the height of the ball and missiles.  Should be able to make some easier to see bonus items.

Good use of scrolling!

##### Share on other sites

Found a nice page that gives some very good definitions. So a larger missile is possible, but it would have the same color as the player so I am not sure yet if I like it. (Red and blue coconuts?)

The mirror sprite option freed up a lot of ROM though.

##### Share on other sites

Found a nice page that gives some very good definitions. So a larger missile is possible, but it would have the same color as the player so I am not sure yet if I like it. (Red and blue coconuts?)

The mirror sprite option freed up a lot of ROM though.

The ball has the same color as the playfield.

The first missile shares the color of the first sprite.

The second missile shares the same color as the second sprite.

It's sometimes a pain but it can be made useful.  For instance: in games with an entrance you could use the ball as the trigger inside the door to transition to a new screen.  Ball is the same color as the playfied so it just looks like the inside of the door.

##### Share on other sites
That is a good tip! I'll need to remember that for other projects. I'm also thinking about a shooter.

I don't think that red/blue coconuts would work well for this though.

##### Share on other sites

New update, game now has icons for powerups! Are they clear to people?

1) Slows down time for both monkeys. (Scrolling slows down)

4) Makes opponent invisible. (So he can't see where he's going?)

5) Ads a branch to enemies tree at height of player on the left for Player 0 and on the right for player 1.

##### Share on other sites

I added a simple AI to the game that can be toggled with the left difficulty switch. (The AI is a dark and edgy shadow monkey!) and with the right switch you can toggle the mode to either stop when either player dies or to keep going after one of the two dies.

http://atariage.com/forums/topic/274433-beta-monkey-king-formerly-climb-the-tree/

##### Share on other sites

Newest version is up, now with PAL and NTSC version. See top post for downloads and images. There is also a Javatari link for online play.

##### Share on other sites

There seems to be a bug with the slow down power-up.  It no longer allows you to slow down the game to a snail's pace, but 5 slow downs in a row cause the game to instantly accelerate to a fast pace, at which point it no longer responds to slow downs at all AFAICT.

Otherwise, the power-up progression(now that I understand it:-))  works well.  The rocks may spawn just slightly too often however, as careful power-up management now seems to allow me to easily play as long as I wish on AI, endless mode.

Ah, yes- is the remove branches power-up supposed to also remove coconuts?  It does.

Edited by fluxit

##### Share on other sites

There seems to be a bug with the slow down power-up.  It no longer allows you to slow down the game to a snail's pace, but 5 slow downs in a row cause the game to instantly accelerate to a fast pace, at which point it no longer responds to slow downs at all AFAICT.

Otherwise, the power-up progression(now that I understand it:-))  works well.  The rocks may spawn just slightly too often however, as careful power-up management now seems to allow me to easily play as long as I wish on AI, endless mode.

Ah, yes- is the remove branches power-up supposed to also remove coconuts?  It does.

Yes the slowdown speedup is unintentional, the variable goes below 0 and then starts out high again. You should be able to slow it down again but you will need about 5-6 of them to get back to the start again.

(The game starts at speed 75 and goes up to 250, every point adds one speed and the slow down subtracts 30)

I can easily remove it, but this might be a good strategy to thwart others. What do you think?

I could make the rocks a bit more rare, maybe only in the 1p mode. In 2p it's a lot more difficult if the other player also grabs them. It's very much designed for 2p and hacked to be fun for 1p I would say.

What was your too score btw? Is it above 748? That's the current high score.

And yes the coconut is supposed to die with the remove branch power. It makes it a lot more useful to carry around.

##### Share on other sites

Yes the slowdown speedup is unintentional, the variable goes below 0 and then starts out high again. You should be able to slow it down again but you will need about 5-6 of them to get back to the start again.

(The game starts at speed 75 and goes up to 250, every point adds one speed and the slow down subtracts 30)

I can easily remove it, but this might be a good strategy to thwart others. What do you think?

I could make the rocks a bit more rare, maybe only in the 1p mode. In 2p it's a lot more difficult if the other player also grabs them. It's very much designed for 2p and hacked to be fun for 1p I would say.

What was your too score btw? Is it above 748? That's the current high score.

And yes the coconut is supposed to die with the remove branch power. It makes it a lot more useful to carry around.

I like your point about the slow down to speed.  That definitely could be a useful tactic in 2 player.

[attachment=591640:Screenshot crop at 2018-09-02 00-48-45.jpg]

To increase the difficulty, I was allowing my power-ups to reach 'add branch(though the AI was long dead)' before activating every time I would fully refill my hearts.

My game finally ended when I became too distracted by the video I was listening to in the background.  I'm playing with a NES type gamepad FWIW.

##### Share on other sites

I like your point about the slow down to speed.  That definitely could be a useful tactic in 2 player.

To increase the difficulty, I was allowing my power-ups to reach 'add branch(though the AI was long dead)' before activating every time I would fully refill my hearts.

My game finally ended when I became too distracted by the video I was listening to in the background.  I'm playing with a NES type gamepad FWIW.

Woow you just killed my record by a factor of 10! :p

Want me to put you on the webpage?

Also if you want more challenge, play in gamemode b for right difficulty. (So game ends when either player dies) and try to keep the AI alive allongside yourself and see how far you can get.

You can remove the coconuts before they hit him and let him take points to heal up. (He doesn't chase them, but if they are on his path he will take them and if he has 3 he will use it to heal up. Oh and if he has two he will use it to kill the coconut if it falls)

##### Share on other sites

I just played Monkey King a bit, nice little game! You made some good progress since the version that was shown at ZeroPage Homebrew.

I have a few suggestions:

- Let players start the game with the fire button, that's always better than having to press the reset switch.

- Remove the sound when the score increases. That constant beeping is quite annoying especially when the game gets faster IMO.

That would also make it easier to concentrate on the coconut sound.

Or just play a sound for each 100 points reached.

- Maybe don't allow more than 3 branches in a row, having 4 or 5 in a row looks a bit weird and not much like a tree.

Looking forward to see how this one comes along. :)

##### Share on other sites

I just played Monkey King a bit, nice little game! You made some good progress since the version that was shown at ZeroPage Homebrew.

I have a few suggestions:

- Let players start the game with the fire button, that's always better than having to press the reset switch.

- Remove the sound when the score increases. That constant beeping is quite annoying especially when the game gets faster IMO.

That would also make it easier to concentrate on the coconut sound.

Or just play a sound for each 100 points reached.

- Maybe don't allow more than 3 branches in a row, having 4 or 5 in a row looks a bit weird and not much like a tree.

Looking forward to see how this one comes along. :)

-It used to start when you pressed the fire button, but I noticed that it often restarted after you died. (thus losing the chance to see the score, etc.) So that might be annoying for people who are going for high scores. its a good one to ask around for though!

-I can make the sound quieter compared to the other sounds. Its already 60% vs 100%. Maybe 40% is better. But I would like to keep the sounds in, it helps me estimate how quick its moving.

-I'll look into that. I agree that it looks weird.

##### Share on other sites

-It used to start when you pressed the fire button, but I noticed that it often restarted after you died. (thus losing the chance to see the score, etc.) So that might be annoying for people who are going for high scores. its a good one to ask around for though!

-I can make the sound quieter compared to the other sounds. Its already 60% vs 100%. Maybe 40% is better. But I would like to keep the sounds in, it helps me estimate how quick its moving.

-I'll look into that. I agree that it looks weird.

For starting the game with the fire button just add a delay - ignoring fire button presses for ~3 seconds or so after game over should do the trick.

Check the batari Basic forum for examples, this was used in a few bB games IIRC.

Good point about the moving sound, i find it too noisy as it is but making it quieter should help.

If you have enough variables and rom-space left maybe make the winning player flash or make him bigger to give a visual cue who won the round at the end.

##### Share on other sites

For starting the game with the fire button just add a delay - ignoring fire button presses for ~3 seconds or so after game over should do the trick.

Check the batari Basic forum for examples, this was used in a few bB games IIRC.

Good point about the moving sound, i find it too noisy as it is but making it quieter should help.

If you have enough variables and rom-space left maybe make the winning player flash or make him bigger to give a visual cue who won the round at the end.

- Running out of space so have to prioritize. But that would be a good idea if it fits.

- Uhu, its a bit quieter now.

- Thats a good idea. maybe change the BG or something. I should be able to do that. (but it would take space away from point 1 :P) I like this more though.

In the rightdifficulty button A game mode the game ends when one player dies, so you still see lives of the surviving one. In the endless game mode there should be something. I'll try this idea. Thanks. :). I'll try to implement it after work.

##### Share on other sites

Could not let the sound go lower as it would be off. But the color of the winner is now shown as the BG in endless mode.

##### Share on other sites

Greetings!

Just spent some time playing Monkey King.  Here are my initial thoughts:

• Allow fire button to start game, both when you first power up the system and after you've completed a game.  If you were having a problem with people restarting the game immediately after ending, add a slight delay before accepting another button press, and/or make sure the button wasn't already depressed when the game ends.

• The computer player is quite good, too good in fact. Watched him play for a while after I died and he makes very few mistakes.  Pretty much the only thing that would kill him is when coconuts was dropped on him, but he'd just get the stones and give himself more lives to keep on going indefinitely.

• It seems once the speed reaches some maximum, the game does not get any harder.  This is allowing the computer to pretty much play indefinitely once you die (if you have the right difficulty set to A), especially as the computer uses the stones to give himself extra lives.  Presumably a good human player could do the same thing.  I think the difficulty needs to keep ramping up to just short of "impossible".  Either the speed can keep going up, or other elements introduced to make it more difficult.  Obviously monkeys can only climb so fast, so I'd be for new gameplay elements as you progress up the infinite tree, which would also help make the game more interesting.

• It would be nice if the branches at the bottom don't just "disappear", but scroll off in the same fashion as the branches from the top of the screen do.

• Once the game speeds up, I'm not sure it's even possible to get the stones that are between two branches, where there's only one space between them.  I noticed the computer doesn't even try for these.  :)

• It would be nice if the tree's graphics could be improved so the trees look more like trees.  Same thing with the coconuts and stones.  Not sure what is possible in batari Basic, though.

• I would prefer that the SELECT switch be used to select between single and multiplayer, with some sort of visual indicator on the screen (like showing one or two monkeys).  Difficulty switches are a bit of a pain without reading the manual.

• The computer player does not move up and down like a human player does.  Since the human player can always get a bit above the computer player, the human can always get the stones first.   Would be nice if that could be added to make it feel more like another player instead of a robotic AI.

• Maybe change the background color as the difficulty ramps up?  Would help add some visual variety.

• Redefine the score digits so they aren't the stock batari Basic digits?
I understand the game is 4K now, are you hoping to keep it at 4K?  I'm guessing some of this would be difficult to do without going to 8K at a minimum.

That's all for now.  :)

..Al

##### Share on other sites
Also if you want more challenge, play in gamemode b for right difficulty. (So game ends when either player dies) and try to keep the AI alive allongside yourself and see how far you can get.

You can remove the coconuts before they hit him and let him take points to heal up. (He doesn't chase them, but if they are on his path he will take them and if he has 3 he will use it to heal up. Oh and if he has two he will use it to kill the coconut if it falls)

That is more challenging.

[attachment=592414:Screenshot crop at 2018-09-06 03-07-27.jpg]0.18b

I'm probably mistaken, but I could swear that the AI sometimes fails to pick up rocks, even when I let him 'go first,' and they are directly in his path.

##### Share on other sites
I find it handy sometimes to slow down Stella's emulation speed to 10% to be able to catch things like that.

##### Share on other sites

I find it handy sometimes to slow down Stella's emulation speed to 10% to be able to catch things like that.

That's one option, but using the TimeMachine is even better IMO.

##### Share on other sites

V0.19 is in the Bb topic, it has a graphics glitch so I won't post it here until that is solved. But Fire button has been implemented as a game starter, the speed can be twice as fast which outright kills me and some glitches are solved. I also switched game modes so that A/A is a multiplayer game that ends when either player dies. B/B is single player endless game. This was done to empathize that its a multiplayer game. (Javatari versions might stay the way they are, just to make it more accessible, but otherwise this seems more logical.)

That is more challenging.

I'm probably mistaken, but I could swear that the AI sometimes fails to pick up rocks, even when I let him 'go first,' and they are directly in his path.

Damn you are good! I let him walk for 1000+ points on his own and he did not miss any dots. But I'll test it some more.

If you have time, could you check if you can keep up with the new top speed? Its twice as fast as the speed in the last version. I can't survive without using slowdown.

I find it handy sometimes to slow down Stella's emulation speed to 10% to be able to catch things like that.

How do you turn that on?

That's one option, but using the TimeMachine is even better IMO.

You mean frame back in the debugger or some other function?

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.