PMODE 4 Artifact Colored 8x8 Tileset Scene Maker

This forum is dedicated to those who want support programming in ugBASIC.
Questo forum è dedicato a chi desidera supporto per programmare in ugBASIC.
Ce forum est dédié à ceux qui souhaitent prendre en charge la programmation en ugBASIC.
Post Reply
User avatar
ericomont
Posts: 12
Joined: Sun Oct 08, 2023 11:31 am

PMODE 4 Artifact Colored 8x8 Tileset Scene Maker

Post by ericomont »

After looking at some posts from Allen Huffman on the COCO FB group and on his site:
https://subethasoftware.com/2024/01/20/ ... and-sound/

Here is one of his videos:
https://youtu.be/pV6_faXChGo

I thought about how would those 8x8 tiles, originally black and white, handle artifact colors.
Image
As we can see, it is very hard to get tanks with the 2 pure colors.
So what about a single color and some 3d?

Here is some testings:
Image

Image
So here are 4 frames for each single colored tank, tiles for the background and color ramped tiles for whatever FXs.

This is what they look, and is also the tile set file needed to run the code:
Image

Finally, a Scene Maker to test the tile set in action:
Image

Code: Select all

REM --- MAZE GENERATOR V0.1 - FUED 2024
REM --- VARIABLES ---------------------------------------------------------------
DIM bkg(32,24)		:REM MAP ARRAY
t%=0				:REM GENERAL TIMER
c%=0				:REM CURSOR VALUE
x%=0				:REM CURSOR X pos
y%=0				:REM CURSOR y pos

REM --- SET SCREEN / CLEAR MAP ARRAY --------------------------------------------
SCREEN #14:COLOR #0, #5:CLS
FOR y=0 TO 23:FOR x=0 TO 31:bkg(x,y)=8:NEXT:NEXT

REM --- LOAD TILE SET -----------------------------------------------------------
p01 := LOAD IMAGES("tanks_01.png")FRAME SIZE(8,8)

REM --- GENERATE MAP ------------------------------------------------------------
REM --- TITLE
FOR y=0 TO 21:FOR x=0 TO 31:bkg(x,y)=RND(24):NEXT:NEXT:GOSUB draw	:REM RND TILES
LOCATE 0,23:PRINT" MAZE GEN V0.1        FUED 2024 "					:REM TITLE
DO
FOR y=0 TO 23:FOR x=0 TO 31:bkg(x,y)=8:NEXT:NEXT					:REM CLS ARRAY
WAIT KEY:GOSUB draw
LOCATE 0,23:PRINT" LAYER GROUND <key>             "
'WAIT KEY

REM --- GRASS
FOR c=0 TO 400
	bkg(RND(31),RND(23))=RND(2)+16
NEXT
LOCATE 0,23:PRINT" LAYER GRASS <key>              "
GOSUB draw
'WAIT KEY	

REM --- TREES
FOR c=0 TO 10				:REM STAR
	x=RND(31):y=RND(21)
	bkg(x,y)=12:x=x-1
	bkg(x,y)=12:x=x+2
	bkg(x,y)=12:x=x-1:y=y-1
	bkg(x,y)=12:y=y+2
	bkg(x,y)=12:y=y+1
NEXT
LOCATE 0,23:PRINT" LAYER TREES - STAR <key>       "
GOSUB draw
'WAIT KEY
	
FOR c=0 TO 20				:REM QUAD
	x=RND(31):y=RND(21)
	bkg(x,y)=12:x=x-1
	bkg(x,y)=12:y=y-1
	bkg(x,y)=12:x=x+1
	bkg(x,y)=12:y=y+1
NEXT
LOCATE 0,23:PRINT" LAYER TREES - QUAD <key>       "
GOSUB draw
'WAIT KEY	

REM --- WALLS
FOR c=0 TO 10				:REM QUAD
	x=RND(31):y=RND(21)
	bkg(x,y)=10:x=x-1
	bkg(x,y)=10:y=y-1
	bkg(x,y)=10:x=x+1
	bkg(x,y)=10:y=y+1
NEXT
LOCATE 0,23:PRINT" LAYER WALL - QUAD <key>        "
GOSUB draw
'WAIT KEY	

x=1:y=1						:REM BORDER WALL PATH

FOR t=1 TO 6				:REM TOP WALL
	FOR c=1 TO 5
		bkg(x,y)=10:x=x+1	:REM draw 5 right
		IF x>31 THEN x=31
	NEXT
	IF RND(2)=1 THEN:		:REM choose y move
		bkg(x,y)=10
		y=y+RND(3)-1
		IF y<0 THEN y=0
	ENDIF
NEXT
LOCATE 0,23:PRINT" LAYER BORDER WALL - TOP <key>  "
GOSUB draw
'WAIT KEY	

x=31:y=1
FOR t=1 TO 6				:REM RIGHT WALL
	FOR c=1 TO 4
		bkg(x,y)=10:y=y+1	:REM draw 4 down
		IF y>21 THEN y=21
	NEXT
	IF RND(2)=1 THEN:		:REM choose x move
		bkg(x,y)=10
		x=x+RND(3)-1
		IF x>31 THEN x=31		
	ENDIF
NEXT
LOCATE 0,23:PRINT" LAYER BORDER WALL - RIGHT <key>"
GOSUB draw
'WAIT KEY

x=30:y=21
FOR t=1 TO 6				:REM LEFT
	FOR c=1 TO 5
		bkg(x,y)=10:x=x-1	:REM draw 5 left
		IF x<0 THEN x=0
	NEXT
	IF RND(2)=1 THEN:		:REM choose y move
		bkg(x,y)=10
		y=y+RND(3)-1
		IF y>21 THEN y=21		
	ENDIF
NEXT
LOCATE 0,23:PRINT" LAYER BORDER WALL - DOWN <key> "
GOSUB draw
'WAIT KEY

x=0:y=21
FOR t=1 TO 6				:REM UP
	FOR c=1 TO 4
		bkg(x,y)=10:y=y-1	:REM draw 4 up
		IF y<0 THEN y=0
	NEXT
	IF RND(2)=1 THEN:		:REM choose x move
		bkg(x,y)=10
		x=x+RND(3)-1
		IF x<0 THEN x=0		
	ENDIF
NEXT	
LOCATE 0,23:PRINT" LAYER BORDER WALL - LEFT <key> "
GOSUB draw
'WAIT KEY

REM --- WALL DROP
x=1:y=1	
FOR y=0 TO 23:FOR x=0 TO 31
	IF bkg(x,y)=10 THEN:
		y=y+1
		IF bkg(x,y)=8 OR bkg(x,y)=16 OR bkg(x,y)=17 THEN bkg(x,y)=11
		y=y-1
	ENDIF
NEXT:NEXT
LOCATE 0,23:PRINT" LAYER WALL DROP <key>          "
GOSUB draw
'WAIT KEY

REM --- TREE DROP
x=1:y=1	
FOR y=0 TO 23:FOR x=0 TO 31
	IF bkg(x,y)=12 THEN:
		y=y+1
		IF bkg(x,y)=8 OR bkg(x,y)=16 OR bkg(x,y)=17 THEN bkg(x,y)=13+RND(2)
		y=y-1
	ENDIF
NEXT:NEXT
LOCATE 0,23:PRINT" LAYER TREE DROP <key>          "
GOSUB draw
'WAIT KEY

REM --- FENCES
FOR c=0 TO 8
	x=RND(29)+1:y=RND(20)+1
	IF bkg(x,y)=8 OR bkg(x,y)=16 OR bkg(x,y)=17 THEN:
		bkg(x,y)=15
		FOR t=0 TO 2
			IF RND(2)=1 AND t>2 THEN t=2
			bkg(x,y)=15
			x=x+1:IF x>23 THEN x=23 
			IF bkg(x,y)<>8 AND bkg(x,y)<>16 AND bkg(x,y)<>17 THEN:
				x=x-1
			ENDIF
		NEXT
	ENDIF
NEXT	
LOCATE 0,23:PRINT" LAYER FENCES <key>             "
GOSUB draw
'WAIT KEY

LOCATE 0,23:PRINT" DONE <key>                     "
LOOP

REM --- SUB DRAW SCREEN FROM MAP ARRAY ------------------------------------------
draw:
	FOR y=0 TO 22:FOR x=0 TO 31 
		PUT IMAGE p01 FRAME bkg(x,y) AT x*8,y*8
	NEXT:NEXT
	RETURN
Last edited by ericomont on Tue Jan 23, 2024 9:09 pm, edited 1 time in total.
User avatar
ericomont
Posts: 12
Joined: Sun Oct 08, 2023 11:31 am

Re: PMODE 4 Artifact Colored 8x8 Tileset Scene Maker

Post by ericomont »

Latest Version!
Image
  • Code should be much easier to understand.
  • Randomicity on number of layer repetition (displayed on the lower right, when available).
  • Layer with tanks!
  • Got rid of the ugly fences.

Code: Select all

REM --- MAZE GENERATOR V0.2 - FUED 2024
REM --- VARIABLES ---------------------------------------------------------------
DIM bkg(32,24)		:REM MAP ARRAY
t%=0				:REM GENERAL TIMER
c%=0				:REM GENERAL TIMER
x%=0				:REM CURSOR X pos
y%=0				:REM CURSOR y pos

REM --- SET SCREEN  -------------------------------------------------------------
SCREEN #14:COLOR #0, #5:CLS

REM --- LOAD TILE SET -----------------------------------------------------------
p01 := LOAD IMAGES("tanks_01.png")FRAME SIZE(8,8)

REM --- MAZE GEN TITLE
FOR y=0 TO 21:FOR x=0 TO 31:bkg(x,y)=RND(24):NEXT:NEXT				:REM RND TILES
FOR x=0 TO 31:bkg(x,22)=8:NEXT:GOSUB draw							:REM WHITE ROW
LOCATE 0,23:PRINT" MAZE GEN V0.2        FUED 2024 "					:REM TITLE
WAIT KEY
DO
REM --- GENERATE MAP --------------------------------------------------[MAIN LOOP] 

REM --- GRASS
FOR y=0 TO 23:FOR x=0 TO 31:bkg(x,y)=8:NEXT:NEXT:REM CLS ARRAY
t=RND(600)										:REM SET AMOUNT
FOR c=0 TO t									:REM RND GRASS
	bkg(RND(31),RND(23))=RND(2)+16
NEXT
LOCATE 0,23:PRINT" LAYER : GRASS                ";t/60
GOSUB draw:WAIT 1200 MILLISECOND

REM --- TREES
t=RND(20)
FOR c=0 TO t									:REM STAR SHAPED TREES
	x=RND(29)+1:y=RND(19)+1
	bkg(x,y)=12:x=x-1
	bkg(x,y)=12:x=x+2
	bkg(x,y)=12:x=x-1:y=y-1
	bkg(x,y)=12:y=y+2
	bkg(x,y)=12:y=y+1
NEXT
LOCATE 0,23:PRINT" LAYER : TREES STAR SHAPED    ";t/2
GOSUB draw:WAIT 1200 MILLISECOND

t=RND(20)
FOR c=0 TO t									:REM QUAD SHAPED TREES
	x=RND(31):y=RND(21)
	bkg(x,y)=12:x=x-1
	bkg(x,y)=12:y=y-1
	bkg(x,y)=12:x=x+1
	bkg(x,y)=12:y=y+1
NEXT
LOCATE 0,23:PRINT" LAYER : TREES QUAD SHAPED    ";t/2
GOSUB draw:WAIT 1200 MILLISECOND

REM --- WALLS
x=1:y=1						:REM BORDER WALL PATH
FOR t=1 TO 6				:REM TOP WALL
	FOR c=1 TO 5
		bkg(x,y)=10:x=x+1	:REM draw 5 right
		IF x>31 THEN x=31
	NEXT
	IF RND(2)=1 THEN:		:REM choose y move
		bkg(x,y)=10
		y=y+RND(3)-1
		IF y<0 THEN y=0
	ENDIF
NEXT
x=31:y=1
FOR t=1 TO 6				:REM RIGHT WALL
	FOR c=1 TO 4
		bkg(x,y)=10:y=y+1	:REM draw 4 down
		IF y>21 THEN y=21
	NEXT
	IF RND(2)=1 THEN:		:REM choose x move
		bkg(x,y)=10
		x=x+RND(3)-1
		IF x>31 THEN x=31		
	ENDIF
NEXT
x=30:y=21
FOR t=1 TO 6				:REM LEFT
	FOR c=1 TO 5
		bkg(x,y)=10:x=x-1	:REM draw 5 left
		IF x<0 THEN x=0
	NEXT
	IF RND(2)=1 THEN:		:REM choose y move
		bkg(x,y)=10
		y=y+RND(3)-1
		IF y>21 THEN y=21		
	ENDIF
NEXT
x=0:y=21
FOR t=1 TO 6				:REM UP
	FOR c=1 TO 4
		bkg(x,y)=10:y=y-1	:REM draw 4 up
		IF y<0 THEN y=0
	NEXT
	IF RND(2)=1 THEN:		:REM choose x move
		bkg(x,y)=10
		x=x+RND(3)-1
		IF x<0 THEN x=0		
	ENDIF
NEXT	
LOCATE 0,23:PRINT" LAYER : BORDER WALLS           "
GOSUB draw:WAIT 1200 MILLISECOND

t=RND(20)
FOR c=0 TO t				:REM WALLS QUAD SHAPED
	x=RND(31):y=RND(21)
	bkg(x,y)=10:x=x-1
	bkg(x,y)=10:y=y-1
	bkg(x,y)=10:x=x+1
	bkg(x,y)=10:y=y+1
NEXT
LOCATE 0,23:PRINT" LAYER : WALL QUAD SHAPED     ";t/2
GOSUB draw:WAIT 1200 MILLISECOND

REM --- WALL DROP 
x=1:y=1	
FOR y=0 TO 23:FOR x=0 TO 31
	IF bkg(x,y)=10 THEN:
		y=y+1
		IF bkg(x,y)=8 OR bkg(x,y)=16 OR bkg(x,y)=17 THEN bkg(x,y)=11
		y=y-1
	ENDIF
NEXT:NEXT
LOCATE 0,23:PRINT" LAYER : WALL DROP              "
GOSUB draw:WAIT 1200 MILLISECOND

REM --- TREE DROP
x=1:y=1	
FOR y=0 TO 23:FOR x=0 TO 31
	IF bkg(x,y)=12 THEN:
		y=y+1
		IF bkg(x,y)=8 OR bkg(x,y)=16 OR bkg(x,y)=17 THEN bkg(x,y)=13+RND(2)
		y=y-1
	ENDIF
NEXT:NEXT
LOCATE 0,23:PRINT" LAYER : TREE DROP              "
GOSUB draw:WAIT 1200 MILLISECOND

REM --- TANKS!
t=RND(10)
FOR c=0 TO t
	x=RND(28)+1
	y=RND(20)+1
	IF bkg(x,y)=8 OR bkg(x,y)=16 OR bkg(x,y)=17 THEN:
		bkg(x,y)=RND(8)
	ENDIF
NEXT
LOCATE 0,23:PRINT" LAYER : TANK DROP            ";t
GOSUB draw:WAIT 1200 MILLISECOND

REM --- DONE
LOCATE 0,23:PRINT"              DONE              "
WAIT KEY
LOOP

REM --- SUB ROUTINES ------------------------------------------------------------
REM --- DRAW SCREEN FROM MAP ARRAY ----------------------------------------------
draw:
	FOR y=0 TO 22:FOR x=0 TO 31 
		PUT IMAGE p01 FRAME bkg(x,y) AT x*8,y*8
	NEXT:NEXT
RETURN

MrGW454
Posts: 2
Joined: Sun Oct 08, 2023 2:30 pm

Re: PMODE 4 Artifact Colored 8x8 Tileset Scene Maker

Post by MrGW454 »

Hi Erico,

Love what you expanded on with Allen's program. I'd like to try running your version, but need the "tanks_01.png" asset.

Thanks and looking forward to more!
User avatar
ericomont
Posts: 12
Joined: Sun Oct 08, 2023 11:31 am

Re: PMODE 4 Artifact Colored 8x8 Tileset Scene Maker

Post by ericomont »

AAAAma sooory that one is copyrighted!

:D It is hidden a few images above but I will add here.
Image
MrGW454
Posts: 2
Joined: Sun Oct 08, 2023 2:30 pm

Re: PMODE 4 Artifact Colored 8x8 Tileset Scene Maker

Post by MrGW454 »

Ssssshhhh! Thank you... :)
User avatar
ericomont
Posts: 12
Joined: Sun Oct 08, 2023 11:31 am

Re: PMODE 4 Artifact Colored 8x8 Tileset Scene Maker

Post by ericomont »

Where you able to run it? I'm really curious on what could be done with it.
I'm not sure we can currently move a bitmap per pixel instead of byte border, but it would be simple to cook a couple extra bitmaps for the tanks to cover for that, if one wants a smoother motion :)

I was thinking of taking this scheme to port "It Came from the West" to pmode4, made a few studies but other pressing projects are on the way.
Post Reply