Jump to content
IGNORED

[Final] Monkey King


Coolcrab

Recommended Posts

 

Major AI overhaul, it now chases after stones and gives you a good challenge.

I also changed the graphics of the UI a bit.

2 bytes left, I want to add two more if statments, so need to free up space somehow. After that I think that its done. :)

 

Oh wow! This version 23 is REAL challenging (for the 1 player game)!!!!

Link to comment
Share on other sites

 

Major AI overhaul, it now chases after stones and gives you a good challenge.

I also changed the graphics of the UI a bit.

2 bytes left, I want to add two more if statments, so need to free up space somehow. After that I think that its done. :)

 

It will only gain you a few bytes, but putting initializations of variables to the same value on the same line will save a little bit. So, e.g.:

 

 _invisible0 = 0
 _invisible1 = 0


Should be:


 _invisible0 = 0 : _invisible1 = 0
  • Like 2
Link to comment
Share on other sites

 

Major AI overhaul, it now chases after stones and gives you a good challenge.

I also changed the graphics of the UI a bit.

2 bytes left, I want to add two more if statments, so need to free up space somehow. After that I think that its done. :)

 

I just played v0.23 a bit and the AI is really challenging now. An old bug returned - the game speed doesn't reset after game over. When you start a new game it starts at high speed.

  • Like 1
Link to comment
Share on other sites

All bugs fixed! I managed to make the framerate stable by changing the pfread to a playfieldpos check and using it at playfieldpos=1. This shifted the top block creation to playfieldpos 1 instead of 0 and for some reason that fixed everything. I think that that is a good reason to stop touching it and just tweak some starting numbers. (Unless more bugs are found of course!) I'm quite happy with the game in this state. :)

 

I also added an option to play vs the old AI (non moving one) by flipping the B/W switch. See it as a practice mode.

 

Oh wow! This version 23 is REAL challenging (for the 1 player game)!!!!

Glad you like it. I think that the AI is quite cool no.

 

 

 

It will only gain you a few bytes, but putting initializations of variables to the same value on the same line will save a little bit. So, e.g.:

 

 _invisible0 = 0
 _invisible1 = 0


Should be:


 _invisible0 = 0 : _invisible1 = 0

 

I tried some of that and removed 2 pfchecks which gave me a lot. They are super heavy commands!

 

 

I just played v0.23 a bit and the AI is really challenging now. An old bug returned - the game speed doesn't reset after game over. When you start a new game it starts at high speed.

Glad you like it! Bug is fixed in v24

  • Like 1
Link to comment
Share on other sites

All bugs fixed! I managed to make the framerate stable by changing the pfread to a playfieldpos check and using it at playfieldpos=1. This shifted the top block creation to playfieldpos 1 instead of 0 and for some reason that fixed everything. I think that that is a good reason to stop touching it and just tweak some starting numbers. (Unless more bugs are found of course!) I'm quite happy with the game in this state. :)

 

 

The gamespeed works correctly now, will play some more later to check everything.

 

You probably don't need it anymore but you could save 7 bytes by drawing the playfield directly with playfield variables:

 
var1 = %00000001 : var2 = %00000001 : var5 = %00000001 : var6 = %00000001 : var9 = %00000001 : var10 = %00000001 : var13 = %00000001
var14 = %00000001 : var17 = %00000001 : var18 = %00000001 : var21 = %00000001 : var22 = %00000001 : var25 = %00000001 : var26 = %00000001
var29 = %00000001 : var30 = %00000001 : var33 = %00000001 : var34 = %00000001 : var37 = %00000001 : var38 = %00000001 : var41 = %00000001 : var42 = %00000001

http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#playfield

 

 

 

 

Link to comment
Share on other sites

 

The gamespeed works correctly now, will play some more later to check everything.

 

You probably don't need it anymore but you could save 7 bytes by drawing the playfield directly with playfield variables:

 
var1 = %00000001 : var2 = %00000001 : var5 = %00000001 : var6 = %00000001 : var9 = %00000001 : var10 = %00000001 : var13 = %00000001
var14 = %00000001 : var17 = %00000001 : var18 = %00000001 : var21 = %00000001 : var22 = %00000001 : var25 = %00000001 : var26 = %00000001
var29 = %00000001 : var30 = %00000001 : var33 = %00000001 : var34 = %00000001 : var37 = %00000001 : var38 = %00000001 : var41 = %00000001 : var42 = %00000001

http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#playfield

 

 

 

 

Do you put that into the playfield enviroment or outside? It gives me errors. However I just tried pfvlines and that freed a lot up, got 43 now.

 

pfvline 8 0 10 on
pfvline 24 0 10 on
I'm almost sad, it feels like I should fill it. :P
  • Like 1
Link to comment
Share on other sites

 

Do you put that into the playfield enviroment or outside? It gives me errors. However I just tried pfvlines and that freed a lot up, got 43 now.

 

pfvline 8 0 10 on
pfvline 24 0 10 on
I'm almost sad, it feels like I should fill it. :P

 

 

You use the variables instead of the playfield - delete the playfield and paste the code from my post where your playfield was.

 

D'OH! I forgot about pfvline, that works even better for straight line playfields like yours. :D

Link to comment
Share on other sites

The AI is quite aggressive, which is fun. Where before I would take the occasional coconut to the face in order to save 'player 2,' I've now seen it bang right through a coconut, beating me to the stone. It can be challenging at times to actually collect that third stone to replenish your life while the AI is active.

Link to comment
Share on other sites

The AI is quite aggressive, which is fun. Where before I would take the occasional coconut to the face in order to save 'player 2,' I've now seen it bang right through a coconut, beating me to the stone. It can be challenging at times to actually collect that third stone to replenish your life while the AI is active.

I'm glad that you like it. Is the behaviour good you think? I could make it keep going for stones even after getting 3, but that seemed a bit much.

 

Got some space left though so open for suggestions.

Link to comment
Share on other sites

  • 2 weeks later...

The 10,000s digit on one of the scores has a '1' in it at boot. This is seen in MAME and Stella.

 

The AI can kick my butt at speed now if I don't use 'add branch' to kill it off. I let it play out after a silly death on my part, and it reached a high score of 7155.

Link to comment
Share on other sites

  • 3 weeks later...

We'll be featuring the NEW FINAL UNRELEASED version Monkey King LIVE on today's ZeroPage Homebrew stream on Twitch at 6PM PT/9PM ET! We'll also be playing the boxed version of Zippy the Porcupine!

Twitch Stream: https://www.twitch.t...ropagehomebrew/

Games Today:

- Alien Attack (2018) by Edward Smith (easmith)
- Alien Revenge (2018) by Edward Smith (easmith)
- Monkey King (FINAL) (2018) by Alex Pietrow (coolcrab)
- Zippy The Porcupine by (2015) by Chris Spry (Sprybug)

 

post-37205-0-89896600-1539809450_thumb.jpg

  • Like 1
Link to comment
Share on other sites

The code wont compile (missing goto's)


The invicible icon in score_graphics.asm is different than shown


You don't need pfvline here it's already in the branch clearing stuff




; pfvline 8 0 11 on
; pfvline 24 0 11 on

gosub clearP0left
gosub clearP0right
gosub __sprite_color : drawscreen
gosub clearP1left
gosub clearP1right



you don't need all these joy0fire clauses in the if statements

you already tested that in the first if statement




; power up activation
if !joy0fire then __skipfire
; if joy0fire && player0score > $0 then gosub __firesound
; if joy0fire && player0score = $a then gosub __slowdown : player0score = $0
; if joy0fire && player0score = $b then gosub __killbranch1
; if joy0fire && player0score = $c then gosub __livesplus1
; if joy0fire && player0score = $d then player0score = $0 : _invisible0 = 1
; if joy0fire && player0score = $e then player0score = $0 : gosub __mkbranch1
; if joy0fire && player0score = $f then player0score = $0 : _invincible = 25 : _left_right{6} = 1 : _F0 = 25

if player0score > $0 then gosub __firesound
if player0score = $a then gosub __slowdown : player0score = $0
if player0score = $b then gosub __killbranch1
if player0score = $c then gosub __livesplus1
if player0score = $d then player0score = $0 : _invisible0 = 1
if player0score = $e then player0score = $0 : gosub __mkbranch1
if player0score = $f then player0score = $0 : _invincible = 25 : _left_right{6} = 1 : _F0 = 25



You can flatten the killbranch routines a little (but you still need the labels for the individual routines

since you're calling them to setup the playfield)




killbranch1
player0score = $0 : bally = 100
gosub sprite_color
if left_right{4} then clearP0left
clearP0right var1 = 1 : var5 = 1 : var9 = 1 : var13 = 1 : var17 = 1 : var21 = 1 : var25 = 1 : var29 = 1 : var33 = 1 : var37 = 1 : var41 = 1 : var45 = 1 : return
clearP0left var0 = 0 : var4 = 0 : var8 = 0 : var12 = 0 : var16 = 0 : var20 = 0 : var24 = 0 : var28 = 0 : var32 = 0 : var36 = 0 : var40 = 0 : var44 = 0 : return



Since you allways call the sprite_color routine before drawscreen you can move drawscreen into sprite_color and get rid of a bunch of calls to drawscreen

and you can do it with a tail call optimization (you need the prepended dot because that's what bB assumes

ie "goto drawscreen" becomes "jmp .drawscreen" so you need to declare .drawscreen)




if startgame then sprite_color_return
;Check if player is invisible
if invisible0 then invisible0 = invisible0 + 1 : COLUP1 = $C4
if invisible0 = 200 then invisible0 = 0

if invisible1 then invisible1 = invisible1 + 1 : COLUP0 = $C4
if invisible1 = 200 then invisible1 = 0



const .drawscreen = drawscreen

sprite_color_return

goto drawscreen



I think you're calling drawscreen a lot more than you need to



Since your pfreads are with constants, just use the screen variables




; if pfread(9,1) then return
; if pfread(25,1) then return

if var5{1} || var7{1} then return

Edited by bogax
Link to comment
Share on other sites

 

The code wont compile (missing goto's)
The invicible icon in score_graphics.asm is different than shown
You don't need pfvline here it's already in the branch clearing stuff
 ; pfvline 8 0 11 on
 ; pfvline 24 0 11 on
 
 gosub clearP0left
 gosub clearP0right
 gosub __sprite_color : drawscreen
 gosub clearP1left
 gosub clearP1right
you don't need all these joy0fire clauses in the if statements
you already tested that in the first if statement
 ; power up activation
 if !joy0fire then __skipfire
 ; if joy0fire && player0score > $0 then gosub __firesound
 ; if joy0fire && player0score = $a then gosub __slowdown : player0score = $0 
 ; if joy0fire && player0score = $b then gosub __killbranch1
 ; if joy0fire && player0score = $c then gosub __livesplus1
 ; if joy0fire && player0score = $d then player0score = $0 : _invisible0 = 1
 ; if joy0fire && player0score = $e then player0score = $0 : gosub __mkbranch1
 ; if joy0fire && player0score = $f then player0score = $0 : _invincible = 25 : _left_right{6} = 1 : _F0 = 25
 
 if player0score > $0 then gosub __firesound
 if player0score = $a then gosub __slowdown : player0score = $0 
 if player0score = $b then gosub __killbranch1
 if player0score = $c then gosub __livesplus1
 if player0score = $d then player0score = $0 : _invisible0 = 1
 if player0score = $e then player0score = $0 : gosub __mkbranch1
 if player0score = $f then player0score = $0 : _invincible = 25 : _left_right{6} = 1 : _F0 = 25
You can flatten the killbranch routines a little (but you still need the labels for the individual routines
since you're calling them to setup the playfield)
killbranch1
   player0score = $0 : bally = 100
   gosub sprite_color
   if left_right{4} then clearP0left
clearP0right  var1 = 1 : var5 = 1 : var9 = 1 : var13 = 1 : var17 = 1 : var21 = 1 : var25 = 1 : var29 = 1 : var33 = 1 : var37 = 1 : var41 = 1 : var45 = 1 : return
clearP0left   var0 = 0 : var4 = 0 : var8 = 0 : var12 = 0 : var16 = 0 : var20 = 0 : var24 = 0 : var28 = 0 : var32 = 0 : var36 = 0 : var40 = 0 : var44 = 0 : return
Since you allways call the sprite_color routine before drawscreen you can move drawscreen into sprite_color and get rid of a bunch of calls to drawscreen
and you can do it with a tail call optimization (you need the prepended dot because that's what bB assumes
ie "goto drawscreen" becomes "jmp .drawscreen" so you need to declare .drawscreen)
   if startgame then sprite_color_return
   ;Check if player is invisible
   if invisible0 then invisible0 = invisible0 + 1 : COLUP1 = $C4
   if invisible0 = 200 then invisible0 = 0
 
   if invisible1 then invisible1 = invisible1 + 1 : COLUP0 = $C4
   if invisible1 = 200 then invisible1 = 0
 
 
 
   const .drawscreen = drawscreen
 
sprite_color_return
 
    goto drawscreen
I think you're calling drawscreen a lot more than you need to
Since your pfreads are with constants, just use the screen variables
  ; if pfread(9,1) then return
  ; if pfread(25,1) then return
 
  if var5{1} || var7{1} then return

 

 

Strange it worked when I uploaded it, but I was in a rush so maybe I messed up :S I'm stuck on a mountaintop on a island until the end of the month (looking at the Sun, or trying at least), but maybe I can get bB to work on my Mac. All my saves are on my home PC though, so I can't access them. I'm hoping that its just the .asm files that are wrong. I'll get back to you asap.

 

Thanks for the upgrades also, this should shave off quite some bits again. :)

Link to comment
Share on other sites

  • 4 weeks later...

The ghost monkey is a cool addition.

 

It's a very small thing and may only be an emulator issue, but the leftmost pixel of the left ghost monkey shows up on the right side of the screen.

 

I need to spend some more time with this release, but I've not seen any real issues so far.

Link to comment
Share on other sites

wXVyCf8.png

Added a ghost function in 'keep going mode' that behaves as a normal monkey but does not interact with any objects. As suggested by Fluxit and KarlG

 

The ghost monkey is a cool addition.

 

It's a very small thing and may only be an emulator issue, but the leftmost pixel of the left ghost monkey shows up on the right side of the screen.

 

I need to spend some more time with this release, but I've not seen any real issues so far.

 

Kinda like the "ghosts" of dead players in Warlords when the screen flashes. I doubt those were intentional, but it was a neat effect, so she probably decided to keep it instead of fix it, at a guess.

Edited by Coolcrab
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...