Castle Defender -> Atari conversion

Got a programming project in mind? Tell everyone about it!
matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Castle Defender -> Atari conversion

Post by matosimi » Mon Nov 26, 2018 9:14 am

Hi,

I would like to perform Atari XL/XE conversion of Castle Defender.
I have managed to export the data from .ssd disk and I have been playing around with the contents...

Both machines are based on 6502 cpu, so the game logic might be preserved/transferred w/o changes.
However Atari has slightly lower cpu clock (1.79 MHz)... and the main change is the structure of video ram.

Atari has nothing like Mode 1 (320x256x4), the closest matching mode is (320x192x2).
On Atari video ram is sequential, meaning 1 scanline consists of 40bytes (40*8 = 320) which are sequentially stored in memory.
I can see that BBC Micro on the other hand stores video data in 8byte chunks (in case of Mode 1 it is in two 8byte chunks) which could be represented in text mode of Atari, which uses similar memory structure).

So I wrote small utility which converts gfx data by ORing the 2 color bytes (to reduce color palette from 4 colors to 2) which should represent your Mode 4...that is quite close to what Atari can do.
However I can see there are some additional data in L.1 file at the beginning, so the resulting image is not correctly aligned:
CF_g2f_L1.png
@ChrisB: could you let me know what is stored at the beginning of the L.1 file? I have already disassembled the code, however it would be great if you could be kind to provide me the sourcecode, so I would not need to reverse engineer everything.

User avatar
tricky
Posts: 3366
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Castle Defender -> Atari conversion

Post by tricky » Mon Nov 26, 2018 10:55 am

Sorry, I can't help with the data, but have PMed Chris, yours will be activated after I think 25 posts.
I would love to see more ports between the two.
I think the Atom would also be a good candidate and I think that the memory map is much closer and hardware more basic (6847 based).
I have written a couple of "emulators" for running Atari arcade ROMs on the beeb, but I think the micro games might be more interesting.


URL:https://youtu.be/enupZbjSNck View at 720p+ for 50hz.


URL:https://youtu.be/yCnRqDsB8p4 View at 720p+ for 50hz.

User avatar
sydney
Posts: 2373
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne
Contact:

Re: Castle Defender -> Atari conversion

Post by sydney » Mon Nov 26, 2018 12:15 pm

I've activated PM's for you.

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Mon Nov 26, 2018 2:05 pm

@sydney: thanks
@tricky: there are several BBC Micro games already converted to Atari: http://a8.fandal.cz/search.php?search=b ... etails_x=x

User avatar
lurkio
Posts: 1975
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Castle Defender -> Atari conversion

Post by lurkio » Mon Nov 26, 2018 3:57 pm

matosimi wrote:
Mon Nov 26, 2018 2:05 pm
there are several BBC Micro games already converted to Atari: http://a8.fandal.cz/search.php?search=b ... etails_x=x
Wow, I’d heard about Spycat, but I didn’t know there were so many other Beeb-to-Atari conversions!

=D> =D>

Were you involved with all of them? Why did you choose Beeb games in particular to convert (apart from the fact that the Beeb and the Atari both have a 6502)?

:?:
Last edited by lurkio on Mon Nov 26, 2018 4:02 pm, edited 1 time in total.

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Mon Nov 26, 2018 5:04 pm

lurkio wrote:
Mon Nov 26, 2018 3:57 pm
Were you involved with all of them? Why did you choose Beeb games in particular to convert (apart from the fact that the Beeb and the Atari both have a 6502)?

:?:
I was not, but I know Fandal in person... so I was quite aware of what he has done already; anyway this game would be my first :)

Why? because of the same CPU, because Beeb does not have HW sprites or anything like that, so all is done SW way... (that's why C64 games could not be converted easily between other 6502-based platforms)

User avatar
ChrisB
Posts: 30
Joined: Wed Oct 05, 2011 9:37 pm
Location: Surrey
Contact:

Re: Castle Defender -> Atari conversion

Post by ChrisB » Mon Nov 26, 2018 8:33 pm

Yes - I did receive the PMs. The 1972 bytes before the screen are the path the enemies take (all pre-calculated - there's a lot of that) and the 32 bytes before that are the locations of the Towers. I'll see what can be done with the source code - it was never really meant for public consumption - give me a few days...
Last edited by ChrisB on Mon Nov 26, 2018 8:34 pm, edited 1 time in total.

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Mon Nov 26, 2018 10:14 pm

ChrisB wrote:
Mon Nov 26, 2018 8:33 pm
Yes - I did receive the PMs. The 1972 bytes before the screen are the path the enemies take (all pre-calculated - there's a lot of that) and the 32 bytes before that are the locations of the Towers. I'll see what can be done with the source code - it was never really meant for public consumption - give me a few days...
thanks for info.
I'm glad you are willing to help me. Regarding the sources, do not worry about it. I really dont need a lot of explanations or comments. The thing that will help me the most would be the labels, especially zero page and labels of inline data.
So dont waste your time to comment the code for me, i will need to rewrite all drawing routines anyway... and also I will need to replace all HW calls incl. disk accesses.

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Sun Dec 23, 2018 9:27 am

Hi,
after some time, i was able to dig into CD code (since 2 days ago) and now I have running game on Atari Xl/Xe.
I had to remove all disk loads and interrupt stuff and replace them by direct data blocks (inline data).
Controls are not yet handled.
Video output looks like this:
cd_r08.png
cd_r08.png (11.92 KiB) Viewed 1670 times
I know it is maybe not what you have expected, but the videoram has different structure on BBC Micro than on Atari.
Good message is that the code is running, towers are being drawn, sprites are NOT being drawn (i had to cheat the sprite loading routine) and after some time the the "Defeat!" message is shown.

So my next steps are to fix sprite (enemy) loading and after that I can start with all gfx data conversions and drawing routines adjustments.

User avatar
tricky
Posts: 3366
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Castle Defender -> Atari conversion

Post by tricky » Sun Dec 23, 2018 9:38 am

Well done, hard bit done ;)

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Thu Dec 27, 2018 9:54 am

cd_r12.gif
cd_r12.gif (110.65 KiB) Viewed 1574 times
Finally the original game code is running properly...

User avatar
tricky
Posts: 3366
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Castle Defender -> Atari conversion

Post by tricky » Thu Dec 27, 2018 10:25 am

Looking good.
How far can you get :lol:

User avatar
ChrisB
Posts: 30
Joined: Wed Oct 05, 2011 9:37 pm
Location: Surrey
Contact:

Re: Castle Defender -> Atari conversion

Post by ChrisB » Thu Dec 27, 2018 12:13 pm

Well done! :D

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Thu Dec 27, 2018 1:23 pm

ChrisB wrote:
Thu Dec 27, 2018 12:13 pm
Well done! :D
Thanks

Current issue is that i have to convert all the assets to something like MODE4, which means that all sprites have to be preshifted to 8 positions instead of 4.
Also towers which are placed on odd x-position have to be preshifted and masked in order to put them nicely on desired spots in the map.
ATM I'm working on correct tower placement/look.

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Thu Dec 27, 2018 3:28 pm

cd_r16.gif
cd_r16.gif (10.23 KiB) Viewed 1531 times
another iteration: converted background, converted tower sprite incl.masking


tingo
Posts: 4
Joined: Fri Jul 06, 2018 12:56 pm
Contact:

Re: Castle Defender -> Atari conversion

Post by tingo » Fri Dec 28, 2018 2:14 pm

Yes, looking very nice.
--
Torfinn

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Tue Jan 01, 2019 12:30 pm

cd_r22.gif
cd_r22.gif (113.94 KiB) Viewed 1374 times
enemy sprites drawn correctly...

User avatar
tricky
Posts: 3366
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Castle Defender -> Atari conversion

Post by tricky » Tue Jan 01, 2019 2:21 pm

Looking great
PS what do you use to make the gifs?

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Tue Jan 01, 2019 2:51 pm

tricky wrote:
Tue Jan 01, 2019 2:21 pm
PS what do you use to make the gifs?
https://ezgif.com/video-to-gif

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Sat Jan 05, 2019 7:43 pm

cd_r25.gif
cd_r25.gif (34.26 KiB) Viewed 1284 times
controls work, towers are drawn, explosion animation almost works
(bullets drawing not yet converted, tower upgrades drawing not converted as well, hit sprite variation not adapted yet)

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Sun Jan 27, 2019 9:04 pm

finally i've found some time to dive into the "bullet storm".
good news is that bullets so so work, but some position adjustments would need to be applied... also bullet masking is required, otherwise they look quite bad

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Sun Feb 10, 2019 8:48 am

cd_r42.gif
cd_r42.gif (19.52 KiB) Viewed 934 times
bullets, hitsprites, explosions working
Last edited by matosimi on Sun Feb 10, 2019 8:49 am, edited 1 time in total.

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Mon Mar 11, 2019 10:13 pm

status bar works, however it does not fit to Atari screen (Atari does not have resolution with 256 scanlines), so I'm working on some alternative solution at the moment
cd.png
cd.png (11.38 KiB) Viewed 757 times
also added +1 color/luminance by using PMG(sprite) overlay (I had to code additional editor for this)
pmg_lvl1_final.png
pmg_lvl1_final.png (13.98 KiB) Viewed 757 times

User avatar
tricky
Posts: 3366
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Castle Defender -> Atari conversion

Post by tricky » Tue Mar 12, 2019 7:43 am

Looks great, isn't there room at the sides?

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Tue Mar 12, 2019 11:59 am

tricky wrote:
Tue Mar 12, 2019 7:43 am
Looks great, isn't there room at the sides?
Yes, it is. However the emulated gfx mode does not allow me to use them, so I can (will) put there 2 column sprites (1 left to the main screen, 1 right) with the status info.
i have some mockups already, but I will share after i develop the final look.
Last edited by matosimi on Tue Mar 12, 2019 11:59 am, edited 1 time in total.

User avatar
ChrisB
Posts: 30
Joined: Wed Oct 05, 2011 9:37 pm
Location: Surrey
Contact:

Re: Castle Defender -> Atari conversion

Post by ChrisB » Fri Mar 15, 2019 7:02 am

Looking really good. The luminance really lifts the look.

matosimi
Posts: 22
Joined: Thu Nov 22, 2018 7:39 am
Contact:

Re: Castle Defender -> Atari conversion

Post by matosimi » Sat Mar 16, 2019 9:10 am

cd_r62.png
cd_r62.png (15 KiB) Viewed 578 times
status bars are working

User avatar
tricky
Posts: 3366
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Castle Defender -> Atari conversion

Post by tricky » Sat Mar 16, 2019 1:59 pm

Looks great.
I think the beeb might be the only 8-bit with 256 vertical resolution.

User avatar
José Pereira
Posts: 1
Joined: Wed Mar 20, 2019 2:19 pm
Contact:

Re: Castle Defender -> Atari conversion

Post by José Pereira » Wed Mar 20, 2019 2:40 pm

Hi to all because I'm new here though not for Atari 8bits people :D ...
I saw the game at AtariOnline and looking really good.
I would just suggest that you could DLI to have PF1 dark gray (04) and PF2 white (0E) for the bottom panel and same as for the road you could use the same 4Players (as you seem to be using 2+2 Missiles in 5th Player PF3 colour register on the sides) to have creatures and right numbers in gray (0C) or (0A).
It would look something like this:
cd_r62.png
cd_r62.png (14.96 KiB) Viewed 403 times
:)
Last edited by José Pereira on Wed Mar 20, 2019 3:02 pm, edited 1 time in total.

Post Reply