A downloadable game

This 2-player game takes place on a green island featuring clearings, orchards and mountains. Take control of your people - let them spread, reproduce, fight against people of the other color!
Warning! It's an experimental project. BASIC's joystick control is extremely sluggish, so please apply firm and patient moves.

The game uses high-resolution multicolor graphics mode to provide a lively view. Two players can battle each other simultaneously using two colored selection boxes controlled by two - real or emulated - joysticks. (Please refer to your machine/emulator documentation on how to use joysticks.) Calculation of the winner happens on the fly.

Recommended emulator: YAPE http://yape.homeserver.hu/
How to start the game:
1. File / Attach disk image...
2. Select and open the .d64 image
3. Enter command: DLOAD"*" and press Enter
4. If you wish to LIST the program, see PROGRAM LINES OVERVIEW down below.
5. Enter command: RUN and press Enter

The game plays on a 8x6 map, totaling to 48 fields. There are 3 different types of fields: clearings, orchards and mountains. They differ only in their life support capacity: on mountains, people can't reproduce. On clearings, things go normal, in orchards, they reproduce faster.

People on fields
One field can support up to 500 people. (1 figure means 1-100 men, 2 figures mean 101-200 men, and so on.) If there is fewer than 500 people in a field, they reproduce, except in mountains - but even faster in orchards (marked with $ symbols).

Moving people
Both players can move their selection boxes using real or emulated joysticks (red is player 1, blue is player 2). Please use long, sturdy moves as BASIC's joystick control detection is poor. You can move to every direction, including diagonal ones. If trigger is pressed while moving, players can get their own people to move. Note that when there are more than 400 people in a field (depicted as 5 figures), only half of them will move, the rest will remain there, reproducing if possible. This way, you can spread your people. If you move your people over another tribe of yours, they join forces - but not more than 500 people in a field! The excess is lost.

Attacking the enemy
What would be the aim if not destroying people of other color? Both players can move their own people over the enemy, this way an instant fight will take place: the bigger number wins. There can be no multiple colors in a field, so a fight removes all fighting parties, leaving only the rest of one color.

Ending the game
The battle ends if there are no more people of a color - or at all. After a little while, people freeze (players can't move them), the game scans them, then ends with a message that tells which party has won. A tie is the most beautiful thing that can happen. Pressing space - whoever gets there first to press it - restarts the game.

Use the LIST command to view the program lines. You can use the LIST from-to syntax to list certain intervals, eg. LIST 0-4.

0 set multicolor gfx mode, colors and var dimensions
1 fill arrays, display short instructions
2 session init, display map
3 LOOP START: get X,Y, draw box, get joy; if none, go to 6
4 if trigger is pressed (and not in final men count) while moving over own men: take all or half of them
5 redraw field, move box; if men was brought, drop them; drop excess men, redraw field
6 count men based on colors, reproduce them, drop excess men, redraw field
7 swap player, next field, if one side won: go to 9: LOOP END
8 SUBroutine: draw field and men
9 if called 2nd time: display winner, wait for pressing space, restart program

Throughout multiple lines: color, joystick direction and field data

Scope Name&dimensions Purpose
----- --------------- -------
session F%(0-7,0-5) field type at X,Y (0:mountain,1:clearing,2:orchard)
const F$(0-2,0-1) field type gfx lines
temp I,J,K,L,M loop/temp variables
temp J joy input (0-8,128-136)
temp M picked up people count (-red,+blue,-500 - 500)
session M%(0-7,0-5) men count at X,Y (-red,+blue,-500 - 500)
const M$ men count display gfx
const O max men count at a field (500)
temp P actual player (0/1)
temp R actual player (alternative, -1/1)
temp S(0/2) stats (0:reds exist(0/1), 2:blues exist(0/1))
const S$(0-2) stats texts (who won: RED/NATURE/BLUE)
temp T% trigger pressed (0/1)
temp U,V actual reproducing sector (0-7,0-5)
session W final scanning in progress, can't move people (0/1)
temp X,Y actual player X,Y coordinates (0-7,0-5)
session X(0-1),Y(0-1) player# X,Y coordinates (0-7,0-5)
const X%(0-8),Y%(0-8) joy X,Y directions (-1 - 1)

Why high-res?
 - Because I wanted to use sprite-like selection boxes for practical reasons.
 - Because there is a line limit, but memory usage is unlimited in this contest :)

Why multicolor?
 - To be able to draw colored boxes around normal characters, obviously :D
 - Because standard characters look a little different on multicolor display, for example spades become human-like characters, and you can draw a good-looking mountain using some /s, Xs, \s and 's :)

Why joysticks?
 - Because BASIC 3.5 can't handle multiple keypresses.

Throughout the code:
- "." instead of "0" where applicable: 30% speed boost! :O
- DATA instructions in all usable places
- Using default variable values (0) without defining them, because new game starts with RUN
- DO WHILE ... :LOOP behaves like an "inner IF" when you are short in lines, you just need to arrange that the DO condition won't met again.

Formatting lines by: Plus4HTML 2.02 by Istvan Bozsik

Line 0:
 - When using all color sources from 0 to 4, you can do it as well! XD

DIM L, M, P, R, U, V, X, Y, ...
 - DIM simple variables to bring them to the start of variable space to quicker access!

Line 2:
F%(X, Y)=RND(0)*2.5
 - Spare INTs when putting real numbers into integer variables.

Line 3:
 - Cloning actual array values to simple variables to shorten references.

LOCATEX*20, Y*24:BOX P*2+1, +0, +0, +19, +23
 - Placing graphic cursor to certain coordinates then drawing a fixed-size box relative to it.

 - Players are marked as 0/1, whereas joystick ports are 1/2.

 - Again, sparing an INT to put integer 0 or 1 into T%.

J=J AND 15
 - J will contain the joystick move direction only.

Line 4:
IF T%>W ...
 - Trigger (T%=1) can't be higher than W=1 while running people detection a last time, so then you can't move your men!

 - M is men count at a position. If M is bigger than 400, (M*R>400) becomes -1, so M is halved (M=M/1 - -1). Negative M means player red's men. R is -1 when dealing with red, so - times - equals +.

Line 5:
 - After coordinates are updated to player's move, a simple trick is needed to keep values in their intervals. If X or Y becomes negative, (X<0) will be -1, so you subtract -1 from -1, and it becomes 0. Same for the other ends: If Y is 6, adding (Y>5) = -1 to it becomes 5.

 - Equal to "IF M <> 0 THEN ..."

Line 6:
 - Based on which player's (M)en are detected, either S(0) or S(2) are set to 1.

M=M*(1+F%(U, V)/5)
 - Men are multiplied by 1 (mountains), 1.2 (clearings) or 1.4 (orchards).

M%(U, V)=M+.5
 - When dealing with negative numbers, we must equalize the gains: INT(0.5) is 0, whereas INT(-0.5) is -1.

 - Variable swap for the subroutine and back!

Line 7:
 - Save and swap player. Line 3 (loop start) then uses the saved ones.

 - Skips GOSUB 9 (end check / game over) if both players have people (detected in line 6). LOOP UNTIL behaves like an independent end-of-loop check: it allows continuation if W is not 0 (and we set it to 1 in line 9). Next time, GOSUB 9 will be final: game terminates with a RUN, so there will be no stack overflow!

 - The inevitable self-badge. Luckily GOTO doesn't see it.

Line 8:
MID$(M$, INT(6-ABS(L/100)), 5)
 - Displays a 5-character "window" of M$, thus displaying the men count in 100s and a proper number of spaces to erase former display.

Line 9:
POKE 239, 0
 - Erase keyboard buffer, so players must surely press one after this.


Spread, Reproduce, Fight.d64 170 kB
program description and instructions.txt 8 kB

Leave a comment

Log in with itch.io to leave a comment.