Jump to content

Photo

Minikernel - Player Scores


86 replies to this topic

#51 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,135 posts

Posted Sun Jul 8, 2018 9:41 AM

Not a answer but more personal experience and random thoughts.

 

I can confirm 6lives_statusbar.asm works with the multi sprite kernel.  Having "icons" that can be changed around more easily than score digits is great.  

lbms004.bas.png

 

Speaking of score you can edit the score character to be anything.  It's just a matter of figuring out the word game (EDIT: which I clearly failed ~_^):

 

0123456789
USEPNCSTA_

USE___
OPEN__
CAST__
ESCAPE

.

My gut feeling is that when SpiceC rolls around it will have a text mode kernel of some sort.  That should help greatly with strategy games.



#52 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 323 posts
  • Location:Stockholm

Posted Wed Aug 15, 2018 6:35 AM

is there a way to display just 1 digit per player? 



#53 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Wed Aug 15, 2018 9:15 AM

is there a way to display just 1 digit per player? 

 

I can attempt a mod for you to accomplish that if you like (good practice for me).



#54 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 323 posts
  • Location:Stockholm

Posted Wed Aug 15, 2018 9:25 AM

That would be great!



#55 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Wed Aug 15, 2018 11:37 AM

Okay - here is my first stab at this.  Use this like the original minikernel with the following exceptions:

 

  • Add the line " const onedigitscores = 1" to your code to enable single-digit mode
    • When using single-digit scores, there is no need to worry about the score being in BCD format
  • The original minikernel used a lot of stack variables, which caused issues for me when I've tries to use this minikernel in the past, so I changed around the variables to eliminate this usage.
    • If the kernel options pfheights or pfcolors is used, you will need to dim a variable to avoid incompatibility as follows: " dim temp0color = z".  "z" can be any valid bB variable that is not already in used.

 

Here is the revised minikernel and a revised sample program that uses it.  Let me know how this works for you!

 

 

Attached Files



#56 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 323 posts
  • Location:Stockholm

Posted Wed Aug 15, 2018 1:51 PM

Okay - here is my first stab at this.  Use this like the original minikernel with the following exceptions:

 

  • Add the line " const onedigitscores = 1" to your code to enable single-digit mode
    • When using single-digit scores, there is no need to worry about the score being in BCD format
  • The original minikernel used a lot of stack variables, which caused issues for me when I've tries to use this minikernel in the past, so I changed around the variables to eliminate this usage.
    • If the kernel options pfheights or pfcolors is used, you will need to dim a variable to avoid incompatibility as follows: " dim temp0color = z".  "z" can be any valid bB variable that is not already in used.

 

Here is the revised minikernel and a revised sample program that uses it.  Let me know how this works for you!

 

 

Oh wow that's cool! 

 

However I'd like to have the original 6 digits (or 4) down below. Then I can use the main number for score and the other two for powerups. So basically the original program with just 1 digit instead of two on both sides. 

 

Could you do that? Sorry to be picky :P



#57 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Wed Aug 15, 2018 2:19 PM

Oh wow that's cool! 

 

However I'd like to have the original 6 digits (or 4) down below. Then I can use the main number for score and the other two for powerups. So basically the original program with just 1 digit instead of two on both sides. 

 

Could you do that? Sorry to be picky :P

 

It is supposed to work that way when you set playerscores to 2, and do not set noscore, but it appears to not be working.  I will take a look and try to get you a version that works as you describe.



#58 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Wed Aug 15, 2018 2:33 PM

Here's attempt #2 that fixes my previous issue, and the sample program revised to use two single-digit scores in addition to the main score, each with its own color.

 

Screen Shot 2018-08-15 at 4.34.05 PM.png

 

Attached File  playerscores.asm   5.34KB   5 downloads

 

Attached File  playerscores.bas   570bytes   5 downloads



#59 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 323 posts
  • Location:Stockholm

Posted Wed Aug 15, 2018 3:18 PM

Here's attempt #2 that fixes my previous issue, and the sample program revised to use two single-digit scores in addition to the main score, each with its own color.

 

attachicon.gifScreen Shot 2018-08-15 at 4.34.05 PM.png

 

attachicon.gifplayerscores.asm

 

attachicon.gifplayerscores.bas

Awesome! Now to put this into my game. :)

I'm almost afraid to ask, but could you move the left number back by one so that they are symetrical? (Or the right one)

 

Also if I understand this correctly then this does not use any variables apart from pfheight and pfcolors? it seems to do something with my rand function because if I do this is always false. (and it was not before I implemented this)

 _rand1 = rand & 1
 if _left_right{0} && !_rand1 then gosub __branch 
 

I tried reading the asm file but its black magic to me :P

After some experimenting it doesn not seem to be the variables that I defined, as I turned them all off. It really is the .asm being included. (Code in attachement)

Could you take a look? 

Attached Files


Edited by Coolcrab, Wed Aug 15, 2018 3:45 PM.


#60 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Wed Aug 15, 2018 5:05 PM

Sure - I'll take a look at this again tomorrow  



#61 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 323 posts
  • Location:Stockholm

Posted Thu Aug 16, 2018 4:22 AM

Sure - I'll take a look at this again tomorrow  

 

Thanks! I tried to look at it but I have no idea where it is going wrong. Only thing that I can come up with is that the rand function stores in temp and the .asm overwrites it. But can't confirm it atm. 

 

It really makes the game look much better though! 



#62 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Thu Aug 16, 2018 7:31 AM

I've probably overwritten some area of memory that I should not have.  That's due to me still being a novice with minikernels, but like I said, it's good practice for me.  I'll see what I can figure out.

 

As for the number placement, I was thinking that it will look better if the width between individual scores is widened, anyway.  I'll work on this as well.

 

To answer your other question, as it stands now, no additional variables need to be defined, but that may change if I discover that I'm using a memory location that I shouldn't.



#63 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,135 posts

Posted Thu Aug 16, 2018 7:34 AM

Thank you Karl G for making this spiffy new mini kernel!  Displaying extra information is always a challenge - your work makes it possible to create much more informative displays (and thus more detailed games.)

 

As a side your recent changes made it almsot fully compatible with the multi sprite kernel.  The second score seems to point to, umm.. not the score font data?  I wonder if that could be turned into a feature.  Maybe have it point to a graphic data block different from the score font intentionally so we could display life icons and other goodies :)

 

Dunno if this is useful for this but Random Terrain has a memory map for both standard and MS kernels here: http://www.randomter...html#memorymaps

 

Again, thank you for taking an interest in mini kermels.  I hope it's more fun than hassle!  

 

playerscoresMS.bas.png

 

Multi sprite example (edited version from original Karl G code)

Attached File  KarlG_Playerscores.zip   69.94KB   4 downloads



#64 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Thu Aug 16, 2018 8:26 AM

I've been looking at the memory map for the standard kernel, which I believe is off by two bites if you compare to the values in 2600basic.h.  I haven't looked at the multisprite memory map yet to see what I may be overwriting there.  Perhaps the multisprite kernel has a define I can use for conditional compilation to ensure compatibility with both.

 

Just to clarify, this minikernel isn't my work originally; I'm merely messing with it now.  :-)



#65 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Thu Aug 16, 2018 8:31 AM

I see where I am overwriting rand now - it may be that I do need to have the user define a variable, or perhaps I can use one byte of stack, after all (better than the several bytes used in the original version, at least).

 

Edit: It looks like stack1 and stack2 are used as temp variables in the kernel, anyway, so perhaps I can make use of these without any risk.



#66 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 323 posts
  • Location:Stockholm

Posted Thu Aug 16, 2018 9:28 AM

Cool! Personally I don't mind if an extra variable is introduced, but I can see the esthetic reasons for keeping it minimal.

Many thanks for taking the time anyhow!

#67 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Thu Aug 16, 2018 9:40 AM

Attempt #3, now with less memory corruption!  Apart from that, improvements include:

 

  • Score spacing increased (I think it looks better this way)
  • Proper centering in both 1 and two digit modes

Here are some screenshots showing all 4 possible configurations:

 

one digit with score.png

 

two digit with score.png

 

one digit 4 scores.png

 

two digit 4 scores.png

 

Attached File  playerscores.asm   5.48KB   4 downloads

 

Attached File  playerscores.bas   628bytes   9 downloads



#68 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 323 posts
  • Location:Stockholm

Posted Thu Aug 16, 2018 9:53 AM

Attempt #3, now with less memory corruption!  Apart from that, improvements include:

 

  • Score spacing increased (I think it looks better this way)
  • Proper centering in both 1 and two digit modes

Here are some screenshots showing all 4 possible configurations:

 

attachicon.gifone digit with score.png

 

attachicon.giftwo digit with score.png

 

attachicon.gifone digit 4 scores.png

 

attachicon.giftwo digit 4 scores.png

 

Edit: Just found a bug - fixed version should be up shortly.

My program works again :) However.. (Feeling bad that I keep bothering you...) 

Player0score and player1 score seems to be tied to pfscore0 and pfscore1, is it possible to tie it to seperate variables? I want to use the pdscore's for tracking lives. 



#69 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Thu Aug 16, 2018 10:05 AM

Yeah, this minikernel uses those variables as do some other minikernels like e.g. 6lives_statusbar.  I can make a mod to optionally allow doing a dim for player0score and player1score using two of your variables easily enough.



#70 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Thu Aug 16, 2018 10:16 AM

Another revised version.  Once all of the obvious bugs have been ironed out, I will bundle it in a zip with updated documentation for any others that may benefit from these changes.

 

Anyway, give this version a shot, and let me know how it works for you.  You will define the variables with something like this:

 dim player0score = y ; Define a variable for this only if pfscore1 is used
 dim player1score = x ; Define a variable for this only if pfscore2 is used

Attached File  playerscores.asm   5.57KB   7 downloads



#71 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 323 posts
  • Location:Stockholm

Posted Thu Aug 16, 2018 10:27 AM

This works! thanks :)

I'll post an update of my game in the climb the tree thread soon. 



#72 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,135 posts

Posted Sat Aug 18, 2018 7:46 PM

The scores display properly on multi sprite kernel but don't seem to update.  Meaning, "player0score = player0score + 1" does not display am incremental change after the drawscreen.  Not a biggie since Coolcrab is using the standard kernel.  Again, it's amazing how you're picking this up KarlG.  Thank you!



#73 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Sat Aug 18, 2018 8:03 PM

I don't know how my latest version would even compile with the multisprite kernel since aux1 and aux2 don't appear to be defined. I can give it a try and see if I can make a version that is compatible with that kernel - I'm sure it's just a matter of using different variables given the different memory map.

#74 Karl G OFFLINE  

Karl G

    Moonsweeper

  • 442 posts

Posted Sun Aug 19, 2018 9:08 AM

Also - I've been working on my own minikernel inspired by this one that puts all 4 scores on the same line.  I'm wondering now if there are yet any 4-player bB games in existence.

 

Screen Shot 2018-08-19 at 10.59.08 AM.png



#75 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,135 posts

Posted Sun Aug 19, 2018 9:15 AM

It's a chicken/egg scenario.  batari BASIC has 4 player paddle support.  Sweet 4 player score support makes me want to create!






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users