# Realistic pinball physics on the Atari 2600?

## Recommended Posts

How were the pinball physics handled with Midnight Magic? I noticed that the flippers don't exactly act like real flippers when the ball hits them, but it's better than what I can do since I don't know where to start.

I'd like to make a DPC+ pinball example program for the batari Basic page so new users can start working on their own pinball games without needing to reinvent the wheel.

I know this is the assembly language programming forum, but this is usually where the big brains hang out. I'd have to know how to make a ball bounce and move in a realistic way and interact with the flippers in a realistic way. I'm not even sure how many animation frames should be used for a flipper.

##### Share on other sites

You probably need to make a physics engine. This requires squaring numbers, as shown in most physics formulae...

You're in for a lot of memory usage

Edit: oh and trigonometry... LOTS of it. I took a physics course and it still was hard for most (although i did excellent)

##### Share on other sites

This topic is one I keep returning to over and over.

Back in 800XL there was a type-in program that simulated a bouncing ball.

I really loved tweaking that simple program.

It is fun to change the "laws of physics" and decrease gravity over time, or increase rebound every bounce.

Changing 2 or 3 numbers would result in very unexpected impossible behavior.

I couldn't translate that Atari Basic program into batari Basic though.

Your "numbers" have to be floating point because things can get down into the negative or up into large positive numbers.

I don't think 0 to \$ffffffff is a large enough range.

Simply you need to track forces (which are represented in math by square root fractions and other algorithms.)

(You REALLY want to make a program with hundreds of variables, it seems!. This is a case where more variables means more realistic movement.)

Gravity (g) equals (D) distance times 2, divided by (t) time squared.

And that's a simple one. And beautiful if you think of that grand weak forced represented as: g=2D / t x t

Force equals gravity times acceleration.

Acceleration equals Force divided by mass.

Time has a formula, Distance...

Velocity

Momentum

Pressure

Gravitational Accelleration

Energy

The more forces you represent the more your video "ball" will act like a Pinball.

P.S. I also wanted to mention to you if you would want to add how to set up jEdit on your website, that I'd write.

SpiceWare's blog has it started, with the colored data entry, dasm compiling assembly files, and launching Stella.

It works just as nice with batari Basic entry, compiling and Stella.

Everytime mine "breaks" I have to relearn how I set it up!

And then I wish I could visit your website and it will show me the steps to set it up.

Last week I had Windows refusing to launch Stella, and the Mac side refusing to compile bB! In addition to my video card flaking out and then I can't boot either system!

With jEdit, I can work on adding sound data and compiling assembly player programs, and at the same time code batari Basic, compile and run that in Stella.

jEdit could be extended into what Visual bB is now, but someone would need to program Java plugins for the things that are missing like keyboard note / sound entry, Player design, Playfield design.

jEdit is nice because it is Java it is platform independent and is the same on Mac, Windows and Linux.

It can do way more than entering and compiling .asm and .bas files and launching Stella, but it can be as simple as just doing that well.

##### Share on other sites

I believe it is a topic that has been discussed in many places over the years. Ulf Mandorff supposedly devoted all his time in the development of Pinball Dreams only on the ball physics engine, and that engine was further enhanced over the next few years.

Here is a discussion that might have some valuable input. The mention of lookup tables might be useful on the Atari 2600 if you have enough ROM but not so much CPU time for live math calculations.

https://www.gamedev.net/forums/topic/125515-pinball-game-physics/

##### Share on other sites

Thanks for the replies. I'll read them in detail when I get done with my Atari 2600 history pages. I made a YouTube playlist that shows real flippers interacting with the ball and there are also split screen videos of real pinball games that show an overhead view:

I used to wish I could watch videos like those since in the 1980s when I wanted to make a pinball game on the VIC-20 and the Commodore 64. The best I could get back then were glimpses of pinball games in movies. I'm very happy that these videos finally exist so we can view them as many times as we want for free.

##### Share on other sites

I know you're a visual thinker and there are some diagrams at this link. I think the Pinball Dreams bitmap idea (mentioned previously) is a good one for an eight bit system aside from the memory required but since you are thinking DPC+ anyway, using cart space for the physics bitmaps seems like a good solution.

Note the link to the 6502 source code (For the C64)

https://files.scene.org/view/resources/code/sources/pindreams64_src.zip

Video of Pindreams 64

Edited by djmips

##### Share on other sites

I know your a visual thinker and there are some diagrams at this link. I think the Pinball Dreams bitmap idea (mentioned previously) is a good one for an eight bit system aside from the memory required but since you are thinking DPC+ anyway, using cart space for the physics bitmaps seems like a good solution.

gamedev.stackexchange.com/questions/43705/2d-collision-detection-for-pinball-game

Note the link to the 6502 source code (For the C64)

files.scene.org/view/resources/code/sources/pindreams64_src.zip

Video of Pindreams 64

Thanks. I'll save the page, video, and file to my computer in case they disappear and look at them in more detail when I get a chance.

##### Share on other sites

Your physics engine doesn't need to square numbers or even multiply numbers. Since you're calculating at regular time intervals, that is, every frame, you can work with differences. Parabolic motion like that of a pinball rolling on an inclined plane, or that of a lunar lander (http://atariage.com/forums/topic/152903-my-first-kernel/?do=findComment&comment=1871217), comes from maintaining only two accumulators, velocity and position, for each axis. Each frame you add a constant to your velocity, and then you add your new velocity to your position. The only trick is getting the scaling right. Collisions are a little harder though.

##### Share on other sites

Yeah. I could see two DATA tables (upward and downward) that have the x/y forward movement values for angles.

_\ | /_

If momentum is zero on collision you'd switch which table and angle to use.

When momentum decrements to zero gravity "bally = bally - 1" takes over.

Probably a heap of confused half baked statements. If so I apologize in advance

##### Share on other sites

I have to give a bump for the mention of Midnight Magic. I wouldn't have picked the title up yesterday if it wasn't for this thread, and the game is just spectacular for the 2600.

##### Share on other sites

I was just going over some old posts of mine today and I forgot that Pinball Construction Set (6502) source code was released on GitHub

https://github.com/billbudge/PCS_Atari800

##### Share on other sites

This thread is not popping up when I click on My Content. I wonder what else I'm missing out on.

##### Share on other sites

There's a talking head for over 10 minutes, but if you jump to 10:41, there are pinball video overlays. Might be useful in the future.

## 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.

×   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.