H-Tron

General games-related topics
User avatar
RobertK
Posts: 52
Joined: Tue Dec 19, 2017 4:29 pm
Location: Vienna

H-Tron

Post by RobertK »

I proudly present "H-Tron", my first ever game for the ZX81 (16K RAM required):

HTron_ZX81.jpg
HTron_16K_2018-03-02.zip
(12.13 KiB) Downloaded 364 times

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.

2017-01-02_H-Tron_800px.jpg

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.
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: H-Tron

Post by Andy Rea »

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
what's that Smell.... smells like fresh flux and solder fumes...
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: H-Tron

Post by Moggy »

Nice one :D

Time for a bit of UDG tinkering if that's ok with you Robert?
User avatar
RobertK
Posts: 52
Joined: Tue Dec 19, 2017 4:29 pm
Location: Vienna

Re: H-Tron

Post by RobertK »

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.

Andy Rea wrote: Fri Mar 02, 2018 11:44 am 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.
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.

Moggy wrote: Fri Mar 02, 2018 11:59 am Time for a bit of UDG tinkering if that's ok with you Robert?
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.
User avatar
zx81jens
Posts: 201
Joined: Sat May 10, 2008 8:26 am
Location: a Basement in Nienburg / Germany

Re: H-Tron

Post by zx81jens »

One of my favorite Games!!! Thanx for that...

Great fun :mrgreen:

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 ןןıʍ ı
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: H-Tron

Post by Moggy »

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.

Andy Rea wrote: Fri Mar 02, 2018 11:44 am 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.
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.

Moggy wrote: Fri Mar 02, 2018 11:59 am Time for a bit of UDG tinkering if that's ok with you Robert?
We will see what the future will bring. :-)
What I meant to say Robert is I will do the UDG if that is ok?
User avatar
RobertK
Posts: 52
Joined: Tue Dec 19, 2017 4:29 pm
Location: Vienna

Re: H-Tron

Post by RobertK »

Moggy wrote: Fri Mar 02, 2018 7:36 pm What I meant to say Robert is I will do the UDG if that is ok?
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. :)
User avatar
gammaray
Posts: 590
Joined: Sun Apr 17, 2016 2:44 am
Location: Texas

Re: H-Tron

Post by gammaray »

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
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: H-Tron

Post by Moggy »

RobertK wrote: Fri Mar 02, 2018 11:07 pm
Moggy wrote: Fri Mar 02, 2018 7:36 pm What I meant to say Robert is I will do the UDG if that is ok?
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. :)
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.
User avatar
gammaray
Posts: 590
Joined: Sun Apr 17, 2016 2:44 am
Location: Texas

Re: H-Tron

Post by gammaray »

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 361 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
Post Reply