Author: dfwgreencars at gmail.com (David Murray), SDL port by vesuri at jormas.com (Vesa Halttunen) Uploader: polluks+aminet sdf lonestar org (Stefan Haubenthal) Type: game/misc Requires: SDL2 Architecture: ppc-morphos URL: https://www.the8bitguy.com/product/petscii-robots/ Date: 2023-03-07 Readme: http://aminet.net/game/misc/PETSCIIRobots-SDL.readme Downloads: 0
=> http://aminet.net/game/misc/PETSCIIRobots-SDL.lha
Attack of the PETSCII Robots SDL
=> ==============================
Ported by Vesa Halttunen
This work is licensed under the Creative Commons Attribution 4.0
International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative
Commons, PO Box 1866, Mountain View, CA 94042, USA.
About
files PETROBOTS.ASM and BACKGROUND_TASKS.ASM
implementation classes
with different features using the same platform implementation
based on the existing ones and instantiate it in main() (petrobots.cpp)
feel free to get rid of the unnecessary PLATFORM_ #ifdefs manually or using
a preprocessor
customized for each actual target platform
Building
brew install sdl2 sdl2_image
make setup
make
cd SDL
../petrobots
Making of
The first task was to convert the 6502 assembler PET source code to C++
line by line. Even though this won't produce the most elegant high level
language code it ensures that the code behaves exactly like the original
does. PET KERNAL calls and memory accesses were abstracted to an interface
which can be implemented for different platforms.
To make initial testing and verification of the ported code easier an SDL
platform implementation was written first. This allowed the game logic to
be tested on a modern operating system. When eveything seemed to work it
was time to write an implementation of the platform interface for the
Amiga. Since the game shouldn't necessarily require every last drop of the
Amiga's resources to run, the interface was implemented in an AmigaOS
friendly way, multitasking in it's own AmigaOS screen.
The first implementation was very naive: each write to the PET screen
memory would result in copying the respective bytes from the font to the
Amiga bitmap memory using the CPU. This would be highly inefficient on the
Amiga, so the next step was to implement tile based rendering. Tiles would
be copied in 24x24 pixel blocks using the Amiga's blitter, which on 68000
systems is much faster. Initially the tile bitmaps were generated during
startup using the font and the tile data but pre-drawn bitmaps could be
used just as well. After adding support for four bitplanes to get 16 colors
it was already possible to switch to the tiles provided by the graphics
artist.
Double buffering was implemented to hide artefacts caused by modifying the
screen while it's being drawn on display. However, the increase in memory
consumption combined with the highly inefficient manner of switching
between the buffers in an AmigaOS friendly manner called for a better
approach. The bitmaps were made interleaved so that instead of the four
bitplanes following each other in memory, the data for each bitplane row
follows each other in memory. This way any changes to the screen memory
while it's being drawn on display are limited to a small area. Each tile
could be copied with a single blit, improving performance. To reduce the
amount of memory required, a transparency mask was only generated for tiles
requiring one.
The one channel PET-like sound was replaced with a ProTracker module based
sound implementation. Sound effect samples were injected programmatically
to each module upon loading. The module player was modified to allow the
sound effects to be triggered by the game as if they were notes in the song
data. This way there was no need for a separate sound effect player or a
need to make the music and sound effect playback routines aware of each
other. The songs were modified to leave the fourth channel free for sound
effects as often as possible. A separate "no music" module was then added
which has no notes at all and allows sound effects to be played on all four
channels. This completely transformed the game's audio.
Support for pre-drawn graphics for the intro screen, game screen and game
over screen was added. Then it was time to render the current weapon, item,
keys and health using bitmap graphics. Animated player and robot sprites
were implemented. Hardware based screen shaking was implemented and
hardware sprites were used for the cursor. Palette fading made transitions
between different screens a lot smoother. It also allowed the screen to
smoothly flash when taking damage or using the EMP. Suddenly the game
started to look like an Amiga game!
In order to fit the game on one disk, assets had to be compressed. A hand
written 68000 assembler implementation of deflate was used to decompress
gzipped assets. In order to fit the game in memory, these assets had to be
loaded on demand. On Amigas with only 512 kilobytes of chip memory there
was no way to fit both music and sound effects into memory, so a decision
was made to only support sound effects on such systems. On Amigas with more
memory in-game music is loaded from disk on demand. Other assets, like the
intro screen, intro music, game over screen and game over screen are loaded
at startup and kept in memory to make the game over experience more
pleasant.
When the game was mostly complete otherwise, it was time to implement the
live map. While simple in principle, Amiga does not make the implementation
trivial due to its planar graphics. Instead of modifying a single byte to
modify the color of a single pixel, one bit in four different bytes needs
to be modified, making single pixel modifications very slow. Various chunky
to planar implementations were looked into, but ultimately a custom 68000
assembler chunky to planar routine was written for drawing the entire map
and an another custom implementation for manipulating the pixels relevant
for each unit. The end result was a map performant enough to be usable also
on 68000 systems.
Last but not least joystick support was implemented. Most Amiga games only
support a single button Atari style joystick. However, there are Amiga
games that do support the 7 button Amiga CD32 gamepad either natively or
via patches, so it made sense to add support for such a pad as well. In
this mode all the game commands are available through the gamepad. Getting
this code right required digging up some obscure information from forum
discussions and such. Atari style joysticks can also have two buttons, so
support for the second button was added to the joystick mode. This way most
of the game commands are available using such a joystick as well. While not
optimal, at least the game is now fully playable using a traditional
joystick.
TODO
be determined on startup
PERMISSION UID GID PACKED SIZE RATIO METHOD CRC STAMP NAME ---------- ----------- ------- ------- ------ ---------- ------------ ---------- [generic] 4569 4716 96.9% -lh5- 66a8 Dec 24 2003 PETSCIIRobots-SDL.info [generic] 8464 8464 100.0% -lh0- 03ae Nov 19 2015 PETSCIIRobots-SDL/animtiles.png [generic] 7386 7386 100.0% -lh0- ca0f Nov 19 2015 PETSCIIRobots-SDL/c64font.png [generic] 413 413 100.0% -lh0- dc70 Nov 19 2015 PETSCIIRobots-SDL/faces.png [generic] 18214 18214 100.0% -lh0- f539 Nov 19 2015 PETSCIIRobots-SDL/gameover.png [generic] 8487 8487 100.0% -lh0- b2ea Nov 19 2015 PETSCIIRobots-SDL/gamescreen.png [generic] 11094 11094 100.0% -lh0- 3c4a Nov 19 2015 PETSCIIRobots-SDL/health.png [generic] 32356 32356 100.0% -lh0- 13bd Nov 19 2015 PETSCIIRobots-SDL/introscreen.png [generic] 14704 14704 100.0% -lh0- 1775 Nov 19 2015 PETSCIIRobots-SDL/items.png [generic] 751 751 100.0% -lh0- 2e10 Nov 19 2015 PETSCIIRobots-SDL/keys.png [generic] 2710 8960 30.2% -lh5- 4a58 Nov 19 2015 PETSCIIRobots-SDL/level-a [generic] 2465 8960 27.5% -lh5- 2c7e Nov 19 2015 PETSCIIRobots-SDL/level-b [generic] 2489 8960 27.8% -lh5- c9c1 Nov 19 2015 PETSCIIRobots-SDL/level-c [generic] 1758 8960 19.6% -lh5- b35c Nov 19 2015 PETSCIIRobots-SDL/level-d [generic] 2518 8960 28.1% -lh5- 963f Nov 19 2015 PETSCIIRobots-SDL/level-e [generic] 2483 8960 27.7% -lh5- 19c7 Nov 19 2015 PETSCIIRobots-SDL/level-f [generic] 1959 8960 21.9% -lh5- e420 Nov 19 2015 PETSCIIRobots-SDL/level-g [generic] 2389 8960 26.7% -lh5- 2095 Nov 19 2015 PETSCIIRobots-SDL/level-h [generic] 2025 8960 22.6% -lh5- 1c52 Nov 19 2015 PETSCIIRobots-SDL/level-i [generic] 2495 8960 27.8% -lh5- b95d Nov 19 2015 PETSCIIRobots-SDL/level-j [generic] 1833 8960 20.5% -lh5- 5f2e Nov 19 2015 PETSCIIRobots-SDL/level-k [generic] 1731 8960 19.3% -lh5- c672 Nov 19 2015 PETSCIIRobots-SDL/level-l [generic] 2072 8960 23.1% -lh5- 711a Nov 19 2015 PETSCIIRobots-SDL/level-m [generic] 2844 8960 31.7% -lh5- 8786 Nov 19 2015 PETSCIIRobots-SDL/level-n [generic] 56679 103754 54.6% -lh5- 0a5c Nov 19 2015 PETSCIIRobots-SDL/mod.get psyched [generic] 8670 17182 50.5% -lh5- f9ea Nov 19 2015 PETSCIIRobots-SDL/mod.lose [generic] 35158 69536 50.6% -lh5- 97cd Nov 19 2015 PETSCIIRobots-SDL/mod.metal heads [generic] 28387 71432 39.7% -lh5- a4e7 Nov 19 2015 PETSCIIRobots-SDL/mod.metallic bop amiga [generic] 60010 105654 56.8% -lh5- 8fc2 Nov 19 2015 PETSCIIRobots-SDL/mod.robot attack [generic] 36437 86504 42.1% -lh5- 4e28 Nov 19 2015 PETSCIIRobots-SDL/mod.rushin in [generic] 51 2108 2.4% -lh5- 2a2c Nov 19 2015 PETSCIIRobots-SDL/mod.soundfx [generic] 15904 33792 47.1% -lh5- 74df Nov 19 2015 PETSCIIRobots-SDL/mod.win [generic] 6281 6281 100.0% -lh0- cd3b Nov 19 2015 PETSCIIRobots-SDL/petfont.png [generic] 141444 433660 32.6% -lh5- 9a43 Feb 15 20:59 PETSCIIRobots-SDL/petrobots [generic] 604 1846 32.7% -lh5- 1cde Feb 16 02:36 PETSCIIRobots-SDL/petrobots.info [generic] 3017 6985 43.2% -lh5- 9974 Nov 19 2015 PETSCIIRobots-SDL/README [generic] 54 54 100.0% -lh0- 7bbb Oct 16 2016 PETSCIIRobots-SDL/README.info [generic] 7564 8216 92.1% -lh5- d6f1 Nov 19 2015 PETSCIIRobots-SDL/sounds_dsbarexp.raw [generic] 2617 3470 75.4% -lh5- 749f Nov 19 2015 PETSCIIRobots-SDL/sounds_dspistol.raw [generic] 1160 1372 84.5% -lh5- 9469 Nov 19 2015 PETSCIIRobots-SDL/SOUND_BEEP.raw [generic] 1969 2015 97.7% -lh5- 459e Nov 19 2015 PETSCIIRobots-SDL/SOUND_BEEP2.raw [generic] 2262 2768 81.7% -lh5- 7e7c Nov 19 2015 PETSCIIRobots-SDL/SOUND_CYCLE_ITEM.raw [generic] 2704 4096 66.0% -lh5- 00b8 Nov 19 2015 PETSCIIRobots-SDL/SOUND_CYCLE_WEAPON.raw [generic] 7108 9744 72.9% -lh5- e2aa Nov 19 2015 PETSCIIRobots-SDL/SOUND_DOOR_FASTER.raw [generic] 6225 7936 78.4% -lh5- d08a Nov 19 2015 PETSCIIRobots-SDL/SOUND_EMP.raw [generic] 1929 2090 92.3% -lh5- dff8 Nov 19 2015 PETSCIIRobots-SDL/SOUND_ERROR.raw [generic] 5402 6004 90.0% -lh5- b397 Nov 19 2015 PETSCIIRobots-SDL/SOUND_FOUND_ITEM.raw [generic] 12018 13516 88.9% -lh5- 04e5 Nov 19 2015 PETSCIIRobots-SDL/SOUND_MAGNET2.raw [generic] 5399 5588 96.6% -lh5- 0073 Nov 19 2015 PETSCIIRobots-SDL/SOUND_MEDKIT.raw [generic] 1231 1486 82.8% -lh5- 92eb Nov 19 2015 PETSCIIRobots-SDL/SOUND_MOVE.raw [generic] 4557 5072 89.8% -lh5- 1b08 Nov 19 2015 PETSCIIRobots-SDL/SOUND_PLASMA_FASTER.raw [generic] 1388 2380 58.3% -lh5- d68e Nov 19 2015 PETSCIIRobots-SDL/SOUND_SHOCK.raw [generic] 5071 5071 100.0% -lh0- 4039 Nov 19 2015 PETSCIIRobots-SDL/sprites.png [generic] 12466 12466 100.0% -lh0- 827f Nov 19 2015 PETSCIIRobots-SDL/spritesalpha.png [generic] 2868 2868 100.0% -lh0- 59a3 Nov 19 2015 PETSCIIRobots-SDL/spritesmask.png [generic] 26244 26244 100.0% -lh0- 0e7e Nov 19 2015 PETSCIIRobots-SDL/tiles.png [generic] 27977 27977 100.0% -lh0- a56d Nov 19 2015 PETSCIIRobots-SDL/tilesalpha.png [generic] 184 514 35.8% -lh5- fcad Nov 19 2015 PETSCIIRobots-SDL/tileset.amiga [generic] 1632 2818 57.9% -lh5- a5ef Nov 19 2015 PETSCIIRobots-SDL/tileset.pet ---------- ----------- ------- ------- ------ ---------- ------------ ---------- Total 59 files 670880 1324524 50.7% Mar 8 05:08
Aminet © 1992-2023 Urban Müller and the Aminet team. Aminet contact address:
text/gemini
This content has been proxied by September (ba2dc).