H-Tron

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

H-Tron

Post by RobertK » Fri Mar 02, 2018 11:34 am

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 20 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: 1387
Joined: Fri May 09, 2008 2:48 pm
Location: notts UK

Re: H-Tron

Post by Andy Rea » Fri Mar 02, 2018 11:44 am

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
6 x ZX81, 1 x TS1500 , 1 x +3e, 1 x timex 2040 printer, 1 x timex 2020 cassette deck, siclair printer and some spectrum

Moggy
Posts: 1606
Joined: Wed Jun 18, 2008 2:00 pm

Re: H-Tron

Post by Moggy » Fri Mar 02, 2018 11:59 am

Nice one :D

Time for a bit of UDG tinkering if that's ok with you Robert?

User avatar
RobertK
Posts: 33
Joined: Tue Dec 19, 2017 4:29 pm
Location: Vienna

Re: H-Tron

Post by RobertK » 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 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: 182
Joined: Sat May 10, 2008 8:26 am
Location: a Basement in Nienburg / Germany

Re: H-Tron

Post by zx81jens » Fri Mar 02, 2018 6:39 pm

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

Re: H-Tron

Post by Moggy » Fri Mar 02, 2018 7:36 pm

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: 33
Joined: Tue Dec 19, 2017 4:29 pm
Location: Vienna

Re: H-Tron

Post by RobertK » 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. :)

User avatar
gammaray
Posts: 433
Joined: Sun Apr 17, 2016 2:44 am
Location: Texas

Re: H-Tron

Post by gammaray » Sat Mar 03, 2018 12:51 am

Round corners? ;)
Finish what you start. Truth is over the mountaintop or six feet under.
4 x TS1000, 2 x TS1500 , 2 x timex 2040 printer, 1/2 x timex 2020 cassette deck, ZXPAND+AY, ZeddyNET, ZXBlast..., unfinished Spectrum...Still no life!

Moggy
Posts: 1606
Joined: Wed Jun 18, 2008 2:00 pm

Re: H-Tron

Post by Moggy » Sat Mar 03, 2018 8:39 pm

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: 433
Joined: Sun Apr 17, 2016 2:44 am
Location: Texas

Re: H-Tron

Post by gammaray » Sat Mar 03, 2018 11:15 pm

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 10 times
Last edited by gammaray on Mon Mar 05, 2018 6:43 am, edited 1 time in total.
Finish what you start. Truth is over the mountaintop or six feet under.
4 x TS1000, 2 x TS1500 , 2 x timex 2040 printer, 1/2 x timex 2020 cassette deck, ZXPAND+AY, ZeddyNET, ZXBlast..., unfinished Spectrum...Still no life!

Post Reply