Jump to content

Photo

Maxximum Confusion


83 replies to this topic

#1 The Maxx OFFLINE  

The Maxx

    Star Raider

  • 89 posts

Posted Wed Dec 7, 2016 7:39 PM

Questions answered in this thread:
 
1. Is there a way to run a loop to check variables by an index?
 
http://atariage.com/...ions/?p=3646843
 
 
2. Player collision event is triggered when player0 comes into contact with player2 or player3
 
(ie. if collision(player0,player1) then bopFish=3)
 
http://atariage.com/...ions/?p=3646508
 
 
3. DPC Starfield not working (http://atariage.com/...ld#entry3638997)
 
http://atariage.com/...ions/?p=3646508
 
 
4. Can the starfield be resized horizontally?
 
http://atariage.com/...ions/?p=3646874
 
 
5. Is there some sort of modulo operator?
 
http://atariage.com/...ions/?p=3649164
 
 
I don't quite understand the bitwise stuff yet.  For now, I am using something like:
 
temp4=eatSnot/16 temp5=eatSnot*16-temp4     ; temp5 returns eatSnot mod 16
 
6.  What about gosub and bankswitching?
 
http://atariage.com/...ions/?p=3651610
 
7.  Can the background be stretched?
 
http://atariage.com/...ions/?p=3651974
 
8.  On functions:
 
http://atariage.com/...ions/?p=3655650

 

9. Can you toggle a bit on/off...?

 

http://atariage.com/...here/?p=3656980

 

10. Can you cycle through colors in a sprite with the DPC+ kernel?

 

http://atariage.com/...here/?p=3657551

 

11. What is this pointer stuff?

 

http://atariage.com/...sion/?p=3659304

 

12. Use a table for subpixel movement:

 

http://atariage.com/...sion/?p=3665480

 

13. Can I give a label to bits?

 

http://atariage.com/...ions/?p=2092258

 

14. What's up with missile0?  Every time I try to change the height, it draws weird diagonal lines.  Is there a way to get it to behave more like missile1?  Short answer - if you download the starfield effect for one project, but don't plan on using it for another.... don't store your new project in the folder that has the starfield .asm file. 

 

http://atariage.com/...sion/?p=3676875

 

15. Can I get missile1 to be any wider than 8 pixels?

http://atariage.com/...sion/?p=3677122

 

16. If I understand correctly (which is unlikely), all of the graphics are crammed into one bank.  I am running out of room in that bank - is there a way to store more in another bank?

http://atariage.com/...sion/?p=3677122

 

Unanswered questions in this thread:
 
1. In the DPC+ kernel, can you assign a single color to a sprite?  If so, will it save cycles?
 
2. My Visual bB does not have the options listed in the manual.  Am I using the wrong version of Visual bB?

 

3. Can anyone offer an explanation/example of SeaGtGruff's read/write array? 

http://atariage.com/...rays/?p=2116346

 


Edited by The Maxx, Sun Jan 22, 2017 7:01 AM.


#2 Mountain King OFFLINE  

Mountain King

    Dragonstomper

  • 615 posts
  • Location:Philadelphia, PA

Posted Thu Dec 8, 2016 12:08 PM

I'll try to help you as best I can. But personally I'm somewhat of a programming noob.

 

1. Is there a way to run a loop to check variables by an index?

No Idea. But when you compile I think it generates a file that lists the variables you used.

2. Player collision is not working the way I expected.  For example:

if collision(player0,player1) then bopFish=3

The event is also triggered whenever player0 comes into contact with player2 or player3.  Is this normal?

 

Yes, I ran into this with my game as well. Player Sprites 1-9 are all copies of the Player1 sprite. So when you call collision with player1, you are calling a collision with all the copies. You will need to create some kind of system that identifies what sprite you are trying to interact with. There is a demo on Random Terrain's site that creates a coordinate system for virtual sprites. I used for my game and it worked like a charm.

3. I would really like to use the starfield code in my project:

http://atariage.com/...ld#entry3638997

The example DPC+ .bas file compiles, but the starfield effect is not present.  The starfield .bas for the default kernel works fine, but my game needs some of the extras that DPC+ provides.  I ran the .bin file in Stella and it works correctly.  Am I missing something?

 

I'm guessing you have a vertical line running across your screen. There is an .asm file you need to save in your game file that makes the star field work. You can download the file in the second message of the star field thread.

It also helps if you post your code, bin file and screenshot.

 

Hope that helps a little.



#3 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Thu Dec 8, 2016 8:42 PM

Thanks!

Edited by The Maxx, Tue Dec 13, 2016 11:00 PM.


#4 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,181 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Thu Dec 8, 2016 8:46 PM

Does #1 mean that you want to see what variables have been used in a program? If so, you can right click in the code editor and select "Audit Variables." It only works for people who use dim.

 

[I typed that before seeing your reply above.]



#5 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Thu Dec 8, 2016 8:49 PM

Cool! I'll check it out. :)

Edited by The Maxx, Tue Dec 13, 2016 11:02 PM.


#6 RevEng ONLINE  

RevEng

    River Patroller

  • 4,701 posts
  • Bitnik
  • Location:Canada

Posted Thu Dec 8, 2016 9:45 PM

If the variables are in consecutive memory locations, you can access them as an array with a loop.
 
  dim playerPos = a
  dim bomb1Pos = b
  dim bomb2Pos = c
  dim bomb3Pos = d
  dim bomb4Pos = e

  for temp1=0 to 3
     if playerPos = bomb1Pos[temp1] then goto PlayerGoesBoom
  next

Generally speaking, using an array this way only saves rom if you use it for 3 or more elements.

#7 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Thu Dec 8, 2016 10:24 PM

sweet! thank you! this should come in handy!!!  You guys have been loads of help! Thanks!


Edited by The Maxx, Sat Dec 24, 2016 12:30 PM.


#8 RevEng ONLINE  

RevEng

    River Patroller

  • 4,701 posts
  • Bitnik
  • Location:Canada

Posted Thu Dec 8, 2016 10:39 PM

The height and vertical position of the starfield can be changed (with the missile height and y coordinate variables), but not the width.

#9 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Sun Dec 11, 2016 6:42 PM

Awesome!  BTW, the loopindex tip saved my game! You rock!


Edited by The Maxx, Sat Dec 24, 2016 12:30 PM.


#10 Mountain King OFFLINE  

Mountain King

    Dragonstomper

  • 615 posts
  • Location:Philadelphia, PA

Posted Sun Dec 11, 2016 8:39 PM

Looks pretty cool! I look forward to trying it out.



#11 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Mon Dec 12, 2016 8:06 AM

<edit>

 

This was formerly a big ugly comment that described several methods I'd tried to use to get my for loop working.  As it turns out, I was using too much ROM and needed to condense some code or bankswitch.


Edited by The Maxx, Sat Dec 24, 2016 12:31 PM.


#12 bogax OFFLINE  

bogax

    Dragonstomper

  • 710 posts

Posted Mon Dec 12, 2016 1:44 PM

 
 I don't quite follow you so maybe I'm missing something
 
 why don't you just do something like
 
 
  
 schnooga=0
 
 for temp1=0 to 17
 
  if shnooga = 2 then skip_schnooga
  if ooga-2=booga[temp1] then schnooga=1
  if ooga-1=booga[temp1] then schnooga=2
 
skip_schnooga 
 next
 
you can do somthing like modulo for powers of 2 in binary using AND (ie "&" in bB)
 
 15 mod 8 is
 15 & 7
 7 being 8 - 1
 in binary %00001000 (8 ) and %00000111 (7)
 
 bB does a bitwise AND
 bits in the result are the ANDing of corresponding bits in the operands
 
 AND is 
 0 AND 0 = 0
 0 AND 1 = 0
 1 AND 0 = 0
 1 AND 1 = 1
 
  %00001111 (15)
& %00000111  (7)
= %00000111  (7)
 
  %00001110 (14)
& %00001101 (13)
= %00001100 (12)
 
 
 
the player 1..9 variables are in order in memory
so you should be able to eg address player3x as player1x[2]
but I haven't tryed it

Edited by bogax, Mon Dec 12, 2016 1:59 PM.


#13 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Mon Dec 12, 2016 7:46 PM

It worked after I went through, optimized some code, and freed up some ROM. I use the term "optimized" loosely. I think you'd be horrified to see my script! Haha!


Edited by The Maxx, Sat Dec 24, 2016 12:31 PM.


#14 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Tue Dec 13, 2016 7:59 AM

With your help, I managed to cram in 18 bombs! The game is more challenging now.

Edited by The Maxx, Tue Dec 13, 2016 11:07 PM.


#15 Mountain King OFFLINE  

Mountain King

    Dragonstomper

  • 615 posts
  • Location:Philadelphia, PA

Posted Tue Dec 13, 2016 11:17 AM

What do the colors mean? Proximity to a mine? Have you worked in sound yet? This looks pretty cool so far.



#16 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Tue Dec 13, 2016 2:24 PM

<edit>

 

Yes, you are exactly right. 

 

In an effort to keep this thread about batari Basic in general, I am moving Mine Dig junk here: http://atariage.com/...60288-mine-dig/


Edited by The Maxx, Sat Dec 24, 2016 12:54 PM.


#17 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Tue Dec 13, 2016 2:43 PM

I am using the DCP+ kernel. I have each player's color set like:

player0color:
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
$C4
end

However, for my first game, I don't think I'm going to go beyond a single color for each player. Is there a way to choose a single color (ie $C4) for the sprite. If so, would it be beneficial... save rom/cycles, etc?

Edited by The Maxx, Tue Dec 13, 2016 11:17 PM.


#18 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Thu Dec 15, 2016 8:09 AM

<edit>

 

It turns out that the flash was eliminated by calling defining the playfield and calling drawscreen again.  :)


Edited by The Maxx, Sat Dec 24, 2016 12:35 PM.


#19 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Fri Dec 16, 2016 8:23 AM

I was reading up on bankswitching and I think I know how it could make my game better.  At the very least, it would serve to organize my code in a more readable way.  I'm a little confused about gosub.  I need to read more, maybe?  I don't see how it differs from goto...?


Edited by The Maxx, Sat Dec 24, 2016 12:35 PM.


#20 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,181 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Fri Dec 16, 2016 10:56 AM

I was reading up on bankswitching and I think I know how it could make my game better.  At the very least, it would serve to organize my code in a more readable way.  I'm a little confused about gosub.  I need to read more, maybe?  I don't see how it differs from goto...?


When I learned about GOTO and GOSUB in the 1980s for the Commodore VIC-20, GOSUB was used if multiple places in the program needed to use the same code.

That still seems to be true when using batari Basic. New users of bB will often use GOSUB when they don't even need it. They just hop all over the place and create tangled spaghetti code that is almost impossible to follow.

Another reason to only use GOSUB when it is absolutely necessary is that it wastes more cycles:

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#cycle_count_goto

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#cycle_count_gosub



#21 Mountain King OFFLINE  

Mountain King

    Dragonstomper

  • 615 posts
  • Location:Philadelphia, PA

Posted Fri Dec 16, 2016 11:47 AM

Some of the kids at school thought that the miners looked like galaga spaceships.  So this morning I decided to experiment with color.

 

If you're using the DPC+ Kernal, I would take full advantage of the color capabilities. It's wasted if you don't.



#22 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Fri Dec 16, 2016 3:20 PM

Thanks guys.  This is great information, as always.  :)

 

I'll play some more with color today.  I tried adding a couple of things this morning and started crashing stuff.  I might have to tear things up and start a new .bas file.  Admittedly, I didn't have a plan laid out when I started (I never do) and there is some "spaghetti code" in the mix.  Hopefully there are some meatballs as well... but it's my first shot, so I won't cry too much if I fall flat on my face.  :D

 

<edit>

 

"Crashing" due to running out of ROM.


Edited by The Maxx, Sat Dec 24, 2016 12:36 PM.


#23 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Fri Dec 16, 2016 7:07 PM

Can the background color be resized horizontally to match the playfield?  I am assuming probably not... like the starfield effect?

Edited by The Maxx, Sun Dec 18, 2016 12:01 AM.


#24 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,181 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Fri Dec 16, 2016 9:13 PM

New question:  can the background color be resized horizontally to match the playfield?  I am assuming probably not... like the starfield effect?


Run this program and press the select switch over and over again:

randomterrain.com/atari-2600-memories-batari-basic-commands.html#ex_dpc_frac



#25 The Maxx OFFLINE  

The Maxx

    Star Raider

  • Topic Starter
  • 89 posts

Posted Fri Dec 16, 2016 10:38 PM

Cool program!  :)  I looked at it once before, but I couldn't make heads or tails of it then.  Now that I've played around in bB, I can see what it's illustrating.  Thanks!


Edited by The Maxx, Sat Dec 24, 2016 12:37 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users