TVOut library problems

Hi, im having a problem with the TVOut library, which seems only to happen when I test it on a NTSC television. When I use the default resolution (128x96), it hangs the arduino and the game doesn't start.
However, when I lower it to 128x95, the game starts but my character and the enemies draw some walls at certain points on the screen. Again, this happens only on the TV.

Here is the code PacJones - Wokwi ESP32, STM32, Arduino Simulator

I'm remixing a code from Giovanni Verrua for my college project. It's a version of Pacman - Indiana Jones themed.

Any help will be apreciated.

Edit - I forgot to mention, but the game works fine on the simulator (Wokwi)

You have some global "int" arrays that might be better as type "byte".

Go for the low-hanging fruit first.

1 Like

Sounds like the code is writing outside of array bounds, or more likely, you are running out of dynamic memory.

as for the type "byte" you mean "unsigned char"?

is there a way to check how much memory my program is consuming? is there a default limit for arduino uno?

After compiling the program, the IDE publishes a report of memory usage. That report does not include any dynamically allocated RAM memory, like a display buffer.

The Uno has 2048 bytes of RAM.

1 Like

Yes, in the Arduino ecosystem, the "byte" type is an "unsigned char" (aka "uint8_t"), unlike Java, where it's signed

1 Like

The performance improved but the "ghost" walls keep showing up. Thanks for the tip tho!

I used this library many years ago. I forget the details but I found it does have limitations.
I am not running the game but my own display which required tuning of the parameters
A snippet from the code I run after many attempts at getting a good image.
If I remember the values should be divisible by 8. Too high and the code doesn't work.
(I use a separate sync signal and PAL)

TV.begin(_PAL, 144, 80);
TV.select_font(font8x8ext);
initOverlay();

Lastly matching the impedance of the output can help. I had ghosting. Again I forget the details but a 75ohm resistor is well worth trying.

1 Like

We found another version of TvOut that solved the problem, is not bugging anymore.

Thanks everyone!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.