Character optical illusion

Basic and Machine Language

Moderator: Moderators

User avatar
kelp7
Vic 20 Amateur
Posts: 40
Joined: Fri Aug 29, 2008 4:16 am

Character optical illusion

Post by kelp7 »

Just wondering, would it be possible to swap between two ASCII characters that occupy the same x,y position on the screen so quickly that it would fool the eye into believing they occupy the same space at the same time (flicker-free)? Apologies if this is an exceptionally dumb question....
MZ-80A Secrets
http://mz-80a.com
rhurst
Omega Star Commander
Posts: 1371
Joined: Thu Jan 31, 2008 2:12 pm
Website: https://robert.hurst-ri.us
Location: Providence, RI
Occupation: Tech & Innovation

Re: Character optical illusion

Post by rhurst »

Absolutely, see my game Omega Fury that allows for a static cell (same X/Y on the playfield, but in 2 different video / color buffers that get switched from the update sequence); an integral part of the VIC Software Sprite Stack (VIC-SSS) library to allow for flick-free. You can get very interesting video effects at essentially no performance cost from the CPU.
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
User avatar
kelp7
Vic 20 Amateur
Posts: 40
Joined: Fri Aug 29, 2008 4:16 am

Re: Character optical illusion

Post by kelp7 »

Very interesting, I shall check it out thanks!
kelp
MZ-80A Secrets
http://mz-80a.com
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Re: Character optical illusion

Post by Boray »

Flicker free? Really???
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
rhurst
Omega Star Commander
Posts: 1371
Joined: Thu Jan 31, 2008 2:12 pm
Website: https://robert.hurst-ri.us
Location: Providence, RI
Occupation: Tech & Innovation

Re: Character optical illusion

Post by rhurst »

Oh Boray, in the literal sense, no; but I really don't think that was the question being posed. If only we could occupy the same time & space with another without limitation, eh? ;)
"Flick free" certainly for floating animations where a single character cell is logically merged with the underlying one, but even that has to deal with color clash, a VIC limitation. It's the "tricks" you can do with that effect which is of interest here. Else, it really is a dumb question! :lol:
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Re: Character optical illusion

Post by Vic20-Ian »

kelp7 wrote:Just wondering, would it be possible to swap between two ASCII characters that occupy the same x,y position on the screen so quickly that it would fool the eye into believing they occupy the same space at the same time (flicker-free)? Apologies if this is an exceptionally dumb question....

Do you want to do something like:

/

replaced quickly with:

\

in order to see something like:

X

or do you want to see some animation ?
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
User avatar
kelp7
Vic 20 Amateur
Posts: 40
Joined: Fri Aug 29, 2008 4:16 am

Re: Character optical illusion

Post by kelp7 »

Hi Vic20-Ian,

I was just about to post that I didn't think the original reply to my question quite got the concept. I am after the 1st of your examples, replacing \ with / very quickly to get X. I was about to say that I didn't think it was possible, but maybe the machine's quick enough to do this? I don't want to muck about changing character RAM or anything like that. That's not the challenge :) Obviously you can do what you like if you change character RAM and merge anything you like to create new characters. I want to do the equivalent of PRINT CHR$(whatever) at a certain x,y position on the screen and then quickly replace with CHR$(whatever-else) to form a new character, quickly enough to fool the eye that it is happening. Would this actually be possible?

Thanks
kelp
MZ-80A Secrets
http://mz-80a.com
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Re: Character optical illusion

Post by Vic20-Ian »

It is not fast enough in basic, it flickers.

You would need a small machine code routine

Load Accummulator with a char value
Store Accumulator at screen location
Load new char value
Store Accumulator at screen location
Repeat
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
User avatar
kelp7
Vic 20 Amateur
Posts: 40
Joined: Fri Aug 29, 2008 4:16 am

Re: Character optical illusion

Post by kelp7 »

Sorry, yes, the BASIC was just to get the point across. So it's possible in machine code and will not be visible to the eye that it's swapping between two characters? Would you have to wait for vertical blank otherwise get flicker or would it not matter at all in this case as there is no animation?
MZ-80A Secrets
http://mz-80a.com
User avatar
kelp7
Vic 20 Amateur
Posts: 40
Joined: Fri Aug 29, 2008 4:16 am

Re: Character optical illusion

Post by kelp7 »

and it would still be fast enough if there were multiple instances of this happening across the screen?

sorry for the beginner questions...... and thanks for all the answers so far...

kelp
MZ-80A Secrets
http://mz-80a.com
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Re: Character optical illusion

Post by Vic20-Ian »

With machine code you should be able to fill the screen with characters very quickly.

Double changes for the whole screen - I am not sure how much flicker there would be, you will have to try and wow us with the result.

Custom characters would get the same static effect more simply.
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
User avatar
kelp7
Vic 20 Amateur
Posts: 40
Joined: Fri Aug 29, 2008 4:16 am

Re: Character optical illusion

Post by kelp7 »

Thanks again.

Yes, unfortunately I am using your lovely forum to get generic advice that I am 'making fit' to a different machine that doesn't have re-definable character ROM. However, to re-pay all the great advice I will get a VIC emulator and make my very first VIC m/c program to demonstrate this very task :-)

kelp
MZ-80A Secrets
http://mz-80a.com
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Re: Character optical illusion

Post by Vic20-Ian »

Interesting What machine?

Try Vice.


Suggest moderator moves this topic to other systems / offtopic
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
User avatar
kelp7
Vic 20 Amateur
Posts: 40
Joined: Fri Aug 29, 2008 4:16 am

Re: Character optical illusion

Post by kelp7 »

Thanks, will give Vice ago. I'm programming the much unloved Sharp MZ-80A. It's not even a 6502 or 6510 machine but that doesn't bother me. It has the 'potential' for some great games I think having had nearly none (or at least no truly decent ones) in all its lifetime. The reason I'm asking here is because this is quite an active forum and sadly the Sharp's forums have about a tenth of the activity of somewhere like here (if that)... and obviously I love the VIC-20 so this was my first port of call :)

I'm sure you don't really need to move the post as it's a 'programming' question and I'm probably going to just try this quickly out on Vice first before hauling the actual Sharp computer out of the attic... (and therefore will post my Vic-20 results here)
MZ-80A Secrets
http://mz-80a.com
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Re: Character optical illusion

Post by Boray »

If you change the character every time the raster beam has passed you would get the fastest logical speed. (If you change faster, the change would not be shown at all). That would get you half of the frame rate of your TV and that will flicker.
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Post Reply