Jump to content
IGNORED

Maze example program with Pac-Man style sprite


Random Terrain

Recommended Posts

After finding a better way to do things in the code of the 23 x 24 version of this, I came back and fixed the code in this 32 x 12 version. I often copy and paste REMs and I discovered some places where I forgot to change the text, so those places have been fixed too.

 

 

Latest Version

 

Here's the .bin file to use with an emulator or Harmony cart:

 

ex_maze_32x12_2011y_08m_02d_1337t.bin

 

 

Here's the bB code:

 

ex_maze_32x12_2011y_08m_02d_1337t.bas

 

 

post-13-0-43127300-1312307306_thumb.png

 

 

 

 

----------------------------------------------

 

 

 

 

Original Post

 

Below is the first draft of a maze example program that I'm working on for the bB page. You can move the Pac-Man style sprite around and you'll also see an enemy sprite that randomly moves around the maze. I didn't give the enemy any brains in this example program. It's stupid and can't hurt you at this time.

 

This started out as a 32 x 24 maze, but the scanline count kept going over 262 since there was a lot more pfread use. I had to drop back down to ugly town (32 x 12) for this example.

 

If anyone who is great at math wants to look at my code and make it better, please do so. There are probably a lot of ways to improve the code, so feel free to fix it up and post it here.

 

 

Here's the .bin file to use with an emulator or Harmony cart:

 

ex_maze_2011y_07m_31d_2108t.bin

 

 

Here's the bB code:

 

ex_maze_2011y_07m_31d_2108t.bas

Edited by Random Terrain
  • Like 1
Link to comment
Share on other sites

Hey RT, I haven't taken a look at your code yet, but I know I did a 32x24 pf-avoidance routine for Circus Galacticus. If I recall correctly, I wound up doing most of the sprite coord-to-pf coord and case conditions during vblank to get the timing right. You might want to try stuffing some of the math into a vblank routine to cut down on cycle use.

  • Like 2
Link to comment
Share on other sites

Hey RT, I haven't taken a look at your code yet, but I know I did a 32x24 pf-avoidance routine for Circus Galacticus. If I recall correctly, I wound up doing most of the sprite coord-to-pf coord and case conditions during vblank to get the timing right. You might want to try stuffing some of the math into a vblank routine to cut down on cycle use.

I totally forgot about that! :dunce:

 

It sure would be nice if I could go back up to 32 x 24. I'll try it tomorrow and see what happens.

 

 

Thanks!

Link to comment
Share on other sites

Can you please make one with dots worth 10 points each? That would be great!

Unless some code genius makes a special kernel or minikernel for bB that can create a bunch of dots out of a ball or a missile, it's not going to happen. We have two sprites, playfield pixels, a ball, and two missiles (but usually only one missile or no missiles depending on the kernel_options used).

Edited by Random Terrain
Link to comment
Share on other sites

Can you please make one with dots worth 10 points each? That would be great!

 

Why don't you make one with dots worth 10 points each?

 

Or is RT supposed to write "your" game? :ponder:

I need to learn before I write code. :roll: I don't know how. Isn't it possible, RT? How does the original Ms. Pac-Man/Pac-Man/Jr. Pac-Man/clones use it? It has to be possible.

Link to comment
Share on other sites

I need to learn before I write code. :roll: I don't know how.

 

Its normal to learn while you write code. If you can't handle RT's example you really should be experimenting with other peoples code or start with far simpler things before you try and write a full game.

  • Like 1
Link to comment
Share on other sites

Can you please make one with dots worth 10 points each? That would be great!

 

Why don't you make one with dots worth 10 points each?

 

Or is RT supposed to write "your" game? :ponder:

I need to learn before I write code. :roll: I don't know how.

 

If you mean that you don't have any programming experience at all, then perhaps you should start simple. I'd think that asking someone to write your game for you defeats the purpose of the hobby.

 

Isn't it possible, RT? How does the original Ms. Pac-Man/Pac-Man/Jr. Pac-Man/clones use it? It has to be possible.

 

RT is referring to the setup of the bB 1.0 standard kernel, which draws the entire screen at once, including the five objects he mentioned and the playfield pixels. Atari's Pac-Man "dots" were done with done with playfield pixels (which is why they look more like "dashes"), and the three ghosts were created by flickering player0 and player1 on alternating frames. I'd recommend you also go with playfield pixels for your dots.

Link to comment
Share on other sites

I need to learn before I write code. :roll: I don't know how.

 

Its normal to learn while you write code. If you can't handle RT's example you really should be experimenting with other peoples code or start with far simpler things before you try and write a full game.

:? I don't know what you mean. I can handle RT's code.

Link to comment
Share on other sites

Can you please make one with dots worth 10 points each? That would be great!

 

Why don't you make one with dots worth 10 points each?

 

Or is RT supposed to write "your" game? :ponder:

I need to learn before I write code. :roll: I don't know how.

 

If you mean that you don't have any programming experience at all, then perhaps you should start simple. I'd think that asking someone to write your game for you defeats the purpose of the hobby.

 

Isn't it possible, RT? How does the original Ms. Pac-Man/Pac-Man/Jr. Pac-Man/clones use it? It has to be possible.

 

RT is referring to the setup of the bB 1.0 standard kernel, which draws the entire screen at once, including the five objects he mentioned and the playfield pixels. Atari's Pac-Man "dots" were done with done with playfield pixels (which is why they look more like "dashes"), and the three ghosts were created by flickering player0 and player1 on alternating frames. I'd recommend you also go with playfield pixels for your dots.

I'm just asking for a snippet of code. What about the Pac-Man clones with dots, not "Video Wafers?" I would need extra big sprites for the characters to to make dots, because the "lanes" would have to be 3 playfield pixels wide.

Link to comment
Share on other sites

I need to learn before I write code. :roll: I don't know how.

 

Its normal to learn while you write code. If you can't handle RT's example you really should be experimenting with other peoples code or start with far simpler things before you try and write a full game.

:? I don't know what you mean. I can handle RT's code.

 

I think he means that you've just been handed a boat, a paddle, a net, a brand new fishing pole and a bucket of bait, but now you are asking someone to catch the fish and cook them for you. ;)

 

Before you go any further, you might want to spend a few days modifying and experimenting with RT's code here. All of us were beginner programmers at one time, and I guarantee that's how most of us began to understand code and start writing our own.

Edited by jrok
  • Like 1
Link to comment
Share on other sites

Can you please make one with dots worth 10 points each? That would be great!

 

Why don't you make one with dots worth 10 points each?

 

Or is RT supposed to write "your" game? :ponder:

I need to learn before I write code. :roll: I don't know how.

 

If you mean that you don't have any programming experience at all, then perhaps you should start simple. I'd think that asking someone to write your game for you defeats the purpose of the hobby.

 

Isn't it possible, RT? How does the original Ms. Pac-Man/Pac-Man/Jr. Pac-Man/clones use it? It has to be possible.

 

RT is referring to the setup of the bB 1.0 standard kernel, which draws the entire screen at once, including the five objects he mentioned and the playfield pixels. Atari's Pac-Man "dots" were done with done with playfield pixels (which is why they look more like "dashes"), and the three ghosts were created by flickering player0 and player1 on alternating frames. I'd recommend you also go with playfield pixels for your dots.

I'm just asking for a snippet of code. What about the Pac-Man clones with dots, not "Video Wafers?" I would need extra big sprites for the characters to to make dots, because the "lanes" would have to be 3 playfield pixels wide.

 

Oh, well that's simple then. Just write a custom kernel that allows you to display both missiles and the ball on every line. Then, perhaps with 30hz flicker, you could get up to 8 square "dots" on each scanline. It's an easy fix... just a "code snippet" really. :D

 

RT could you jump on that ASAP, so that Junior Pac can complete his masterpiece?

Link to comment
Share on other sites

Isn't it possible, RT? How does the original Ms. Pac-Man/Pac-Man/Jr. Pac-Man/clones use it? It has to be possible.

They used assembly language. You might want to read Racing the Beam:

 

http://www.amazon.com/Racing-Beam-Computer-Platform-Studies/dp/026201257X

 

 

And although it's not about Pac-Man games, you might want to watch this video:

 

http://www.youtube.com/watch?v=MBT1OK6VAIU&rel=0&fmt=35

 

 

batari Basic is amazing because it lets average people who only know BASIC style languages get the beginnings of a game up on the screen in minutes instead of days or months. The speed and ease of use come at a cost, though. For example, we can't have hundreds of dots on the screen and we can't have 50 multicolored sprites flying around. We have to figure out how to make fun games within the limitations of bB or learn assembly language or move on to something like Multimedia Fusion 2:

 

 

http://www.youtube.com/watch?v=2x-wq5RIwbA&rel=0&fmt=35

 

 

 

The guy is speaking French, but the two videos below show him making a Pac-Man type game:

 

http://www.youtube.com/watch?v=IuQT4oliWko&rel=0&fmt=35

 

http://www.youtube.com/watch?v=Jd90YtEfWcQ&rel=0&fmt=35

Edited by Random Terrain
  • Like 2
Link to comment
Share on other sites

For example, we can't have hundreds of dots on the screen and we can't have 50 multicolored sprites flying around.

 

Well, I doubt we could have 50 sprites flying around, but hundreds of dots should be possible. You would just have to make some creative use of the sprites and flicker.

 

For instance, in the following binary the first example shows a grid of 384 dots (using both P0 and P1), and the second example shows a 9x6 dot grid, using only a single player sprite. Press and release the fire button to toggle between examples.

 

Dots.bas.bin

 

It looks okay in Stella with Phospor turned on. I just mocked these up real quick, but ultimately for a "dot-eater maze game", I think the idea would be to make use of the multiplexed P1 in the DPC+ kernel. In that case, you could potentially have 9 independent sprite rows on one frame, resizing them to %00000011 to get 27 dots. Then you could do the same on the next frame, but reposition their x to create a 30hz grid of 54. By tracking the position of the "eater" versus the grid, you could resize each sprite accordingly, making the dots vanish as you "eat" them. 54 isn't a heck of a lot of dots, but it's probably doable in pure bB (DPC+).

Edited by jrok
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...