H-Tron
H-Tron
I proudly present "H-Tron", my first ever game for the ZX81 (16K RAM required):
This is the classic overhead view "Tron" game from the movie of the same title (motorcycles that leave "wall trails" behind them). If you crash into a wall, your opponent scores a point. The player who first reaches a score of 5 wins.
Controls:
Turn left/right:
Left Player: A/S
Right Player: Cursor left/right (5/8) or N/M
(in one-player mode, human is right player)
Press Space or 0 to start a round
Pause game: P
End game: X
Thanks to Andy Rea for providing ASM plot functions (zx81plot.h), now you can see how they perform in a "plotting" action game. Two more functions were taken from z8048.c written by sirmorris.
@Fruitcake: is there a way to plot in colour using the Chroma Interface? I assume that this would go beyond it's capabilities. [EDIT: Andy's function plots by putting the appropriate graphical character on the screen - so colourising would work in theory, but it wouldn't make much sense. At least there is no way to give both player's trails a different colour.]
P.S. My stardom may be marred a little by the fact that Andy has already done a Tron game a few years ago (Tron Trails), so it seems that I have "re-invented the wheel". But I noticed that his AI logic seems to be a little different from mine, so we can compare our two approaches. Furthermore, I use rotational controls (left/right only) while Andy uses directional steering.
P.P.S. The history behind my game: in 2016 I decided to write a game for XT-class DOS PCs equipped with a Hercules graphics card, since there are so few games that truly support the Hercules card (most 1980s games simply blew up their 320x200 CGA graphics, but very few produced a real 720x348 Hercules screen).
So H-Tron was born (the "H" stands for "Hercules"), written in December 2016 in Borland Turbo C 2.01.
Later I found the great z88dk C compiler for Z80 computers that allowed me to port the game to the ZX81.
This is the classic overhead view "Tron" game from the movie of the same title (motorcycles that leave "wall trails" behind them). If you crash into a wall, your opponent scores a point. The player who first reaches a score of 5 wins.
Controls:
Turn left/right:
Left Player: A/S
Right Player: Cursor left/right (5/8) or N/M
(in one-player mode, human is right player)
Press Space or 0 to start a round
Pause game: P
End game: X
Thanks to Andy Rea for providing ASM plot functions (zx81plot.h), now you can see how they perform in a "plotting" action game. Two more functions were taken from z8048.c written by sirmorris.
@Fruitcake: is there a way to plot in colour using the Chroma Interface? I assume that this would go beyond it's capabilities. [EDIT: Andy's function plots by putting the appropriate graphical character on the screen - so colourising would work in theory, but it wouldn't make much sense. At least there is no way to give both player's trails a different colour.]
P.S. My stardom may be marred a little by the fact that Andy has already done a Tron game a few years ago (Tron Trails), so it seems that I have "re-invented the wheel". But I noticed that his AI logic seems to be a little different from mine, so we can compare our two approaches. Furthermore, I use rotational controls (left/right only) while Andy uses directional steering.
P.P.S. The history behind my game: in 2016 I decided to write a game for XT-class DOS PCs equipped with a Hercules graphics card, since there are so few games that truly support the Hercules card (most 1980s games simply blew up their 320x200 CGA graphics, but very few produced a real 720x348 Hercules screen).
So H-Tron was born (the "H" stands for "Hercules"), written in December 2016 in Borland Turbo C 2.01.
Later I found the great z88dk C compiler for Z80 computers that allowed me to port the game to the ZX81.
Last edited by RobertK on Tue Mar 06, 2018 4:17 pm, edited 1 time in total.
Re: H-Tron
Cool job I look forward to trying this out once I return home, iirc my AI logic was more random that anything, think I used the ROM contents as a very crude random number gen, to choose a new direction if a collision was imminent. Also I used a 2D array to store used cells for collision detection rather than testing the actual screen men.
Anyway looks good
Regards Andy
Anyway looks good
Regards Andy
what's that Smell.... smells like fresh flux and solder fumes...
Re: H-Tron
Nice one
Time for a bit of UDG tinkering if that's ok with you Robert?

Time for a bit of UDG tinkering if that's ok with you Robert?
???????????????????????????PIINKEY$?????RND????????????????????????????????????????????????????????PI????????
Re: H-Tron
I forgot to mention that I have included the source code in the zip. I hope that this will help other z88dk newcomers with their own work.

If you take a look at my source code you will see how simple (but effective) it is.
There was the additional problem to solve that in demo mode both computer players would be doing exactly the same if their first few moves would accidently be the same. To avoid this, and to make the computer's moves less predictable, I used a very simple trick, see the source for details.

My logic is also purely mainly random, but still the computer's behaviour is different in our two games.

If you take a look at my source code you will see how simple (but effective) it is.
There was the additional problem to solve that in demo mode both computer players would be doing exactly the same if their first few moves would accidently be the same. To avoid this, and to make the computer's moves less predictable, I used a very simple trick, see the source for details.
We will see what the future will bring.

Last edited by RobertK on Sat Mar 03, 2018 3:47 pm, edited 1 time in total.
Re: H-Tron
One of my favorite Games!!! Thanx for that...
Great fun
Greetings
Jens
Great fun

Greetings
Jens
eyerything will be okay in the end.
if it´s not okay, it´s not the end.
and: uıɐbɐ ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ɹǝʌǝ ɹǝʌǝu ןןıʍ ı
if it´s not okay, it´s not the end.
and: uıɐbɐ ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ɹǝʌǝ ɹǝʌǝu ןןıʍ ı
Re: H-Tron
What I meant to say Robert is I will do the UDG if that is ok?RobertK wrote: ↑Fri Mar 02, 2018 2:20 pm I forgot to mention that I have included the source code in the zip. I hope that this will help other z88dk newcomers with their own work.
My logic is also purely random, but still the computer's behaviour is different in our two games.
If you take a look at my source code you will see how simple (but effective) it is.
There was the additional problem to solve that in demo mode both computer players would be doing exactly the same if their first few moves would accidently be the same. To avoid this, and to make the computer's moves less predictable, I used a very simple trick, see the source for details.
We will see what the future will bring.![]()
???????????????????????????PIINKEY$?????RND????????????????????????????????????????????????????????PI????????
Re: H-Tron
Ah, I see, ok. If you think you can further improve the game, try it, no problem for me. Although I don't know yet what can be done in terms of UDGing to such a game that only plots, but I will probably soon find out.

Re: H-Tron
Round corners? 

5-TS1000,UK ZX81<-Sheelagh, US ZX81, 2-TS1500/KDLX , 3-TS2040 printer, 2-TS2020 cassette decks, ZXPAND+AY, ZeddyNET, ZXBlast, UDG, ZX8CCB, AERCO, BUILDS/REPAIRS ZX Spectrum, ZX80 Minstrel, ZXMAX48 v1 v2, 2-TS-2068, ROM, 16kRAM
Re: H-Tron
I don't know how this game is constructed as I don't have the brains to understand such things but what I do know is that it isn't just simply "plotting".
After every right/left turn it uses a combination of a few different printed characters for the vertical and horizontal trails not simple plots,the screen border is also constructed this way

I will work on it further.
???????????????????????????PIINKEY$?????RND????????????????????????????????????????????????????????PI????????
Re: H-Tron
I worked on the character choices for this type of plotting. Ill find and post what I have so far.
- Attachments
-
- PLOTTING USING ONLY CHARACTERS.XLS.xls
- (24.5 KiB) Downloaded 474 times
Last edited by gammaray on Mon Mar 05, 2018 6:43 am, edited 1 time in total.
5-TS1000,UK ZX81<-Sheelagh, US ZX81, 2-TS1500/KDLX , 3-TS2040 printer, 2-TS2020 cassette decks, ZXPAND+AY, ZeddyNET, ZXBlast, UDG, ZX8CCB, AERCO, BUILDS/REPAIRS ZX Spectrum, ZX80 Minstrel, ZXMAX48 v1 v2, 2-TS-2068, ROM, 16kRAM