English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Contest

 
 
Thread Tools
Old 30 March 2019, 10:19   #901
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by turrican3 View Post
mcgeezer,
how and when did you learn assembler ??? from a book ??
I learned it when I had an Atari ST, so I guess from about the age of 14 in 1988/89, the only book I had at the time was Atari ST internals which had loads of 68K examples of calling GEMDOS.

But I mainly learned from inspecting other people's code inside MonST. In fact 99% of my debugging goes on inside MonAM (The Amiga equivalent) because I just find it super easy to use. When I got an Amiga with an Action Replay cart I was then able to understand the Amiga hardware as well.
mcgeezer is offline  
Old 30 March 2019, 11:08   #902
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,360
assembler isn't the biggest difficulty (apart from the fact that you have to have a strong discipline, and even with that you can make mistakes that take you days to uncover, like wrong size addressing, register corruption,...). The biggest difficulty is chipset & writing a game engine (with events, data loading, ...).

I see an issue with asm: it's difficult to reuse routines from someone else because there's no such thing as a calling convention/parameter passing, unlike C...

Writing the game in C or even C++ would be slightly easier, but still hard because of all the low level stuff happening.

EDIT: I never wrote a game in 68000 asm, only tools. I only wrote games in C/C++/Java for Windows most of them were remakes.

Last edited by jotd; 30 March 2019 at 22:51.
jotd is offline  
Old 30 March 2019, 11:53   #903
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by jotd View Post
assembler isn't the biggest difficulty (apart from the fact that you have to have a strong discipline, and even with that you can make mistakes that take you days to uncover, like wrong size addressing, register corruption,...). The biggest difficulty is chipset & writing a game engine (with events, data loading, ...).

I see an issue with asm: it's difficult to reuse routines from someone else because there's no such thing as a calling convention/parameter passing, unlike C...

Writing the game in C or even C++ would be slightly easier, but still hard because of all the low level stuff happening.
Yes, I'd agree with most of this, learning the chipset is not difficult if you have a copy of the HRM. The key to writing a game I've found is creating a sprite engine and event handling, from what I've seen nobody ever seems to teach you how to do that.

Some principles of object orientated programming have helped massively too in my learning too, I was able to take them and apply them to assembler.

I could probably give some examples if people are interested.
mcgeezer is offline  
Old 30 March 2019, 14:30   #904
john4p
Competition Moderator
 
john4p's Avatar
 
Join Date: Feb 2008
Location: Germany
Posts: 4,756
Looks, sounds and feels pretty genuine. I had the Lynx-port back in the day (the only Atari hardware I ever owned) - this Arcade conversion seems between 16 and 64 times better.

Had one freeze but that's it.

Certainly the most ambitious of the five submissions for the contest.
john4p is offline  
Old 31 March 2019, 22:04   #905
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Another quick update here....

Added the ropes on round 5 and the transition to round 6.

I need to tidy up the round transition when the previous round is shorter.

I'm pleased with the ropes though - thanks to the Amiga Hardware Reference Manual for the simple line drawing example routine too.

[ Show youtube player ]
mcgeezer is offline  
Old 31 March 2019, 22:45   #906
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Nice one Graeme, looking good
DamienD is offline  
Old 31 March 2019, 23:02   #907
JuanLuis
Registered User
 
Join Date: Dec 2018
Location: Málaga
Posts: 61
Quote:
Originally Posted by mcgeezer View Post
Another quick update here....

Added the ropes on round 5 and the transition to round 6.

I need to tidy up the round transition when the previous round is shorter.

I'm pleased with the ropes though - thanks to the Amiga Hardware Reference Manual for the simple line drawing example routine too.

[ Show youtube player ]
Good work. The movement of the rope is very smooth. Is the rope implemented using sprites, like arcade machine, or have you used blitter lines for the rope?
JuanLuis is offline  
Old 31 March 2019, 23:03   #908
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by JuanLuis View Post
Good work. The movement of the rope is very smooth. Is the rope implemented using sprites, like arcade machine, or have you used blitter lines for the rope?
Thanks.... using the blitter to draw the lines. Sprites would have used too much memory and too much DMA.
mcgeezer is offline  
Old 31 March 2019, 23:23   #909
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
I just want to plug here a thread I just created regarding some custom backgrounds that I'm thinking about...

if interested then pm me.

http://eab.abime.net/showthread.php?...50#post1314050
mcgeezer is offline  
Old 01 April 2019, 04:22   #910
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,053
Just some basic speed/size optimizations (lines starting with ;; ):
Looking at 020+ code makes me sad&angry, register scaling is soooo useful ;(.

Code:
;
; ANIMATE
;
; The sprite handler is called with the sprite to work on in d0
; Then ANIMATE is called from the handler with the animate type in d1
;
; In
; 	d0 = sprite number animate in sprite list (player 1 is 0)
; 	d1 = Type of animation ie. (0 standing, 1 walk left, 2 walk right)
; Out:
;	d6 = -1 = End of sprite loop reached
;
ANIMATE:	
		move.l	d0,-(a7)
		move.l	d1,-(a7)
	
		lea 	SPRITE_SLOTS,a0
		move.l	(a0,d0*4),a0		; PLR_RYGAR
; a0 points to sprite base.	
		
		move.l	a0,a1
		move.l	a0,a2
		move.l	a0,a3
		
;;		addq.w	#6,a0			; Point to Animation Sets
;;		add.w	(a0,d1*2),a1		; a1 now pointing to base animation set
		
;;		move.l	a1,a0
;;		move.l	a2,a1
		add.w	(6,a0,d1*2),a0		; a0 now pointing to base animation set

;;		add.w	0(a0),a1		; a1 points to variables
;;		add.w	2(a0),a2		; a2 points to frames
;;		add.w	4(a0),a3		; a3 points to speed
		add.w	(a0)+,a1		; a1 points to variables
		add.w	(a0)+,a2		; a2 points to frames
		add.w	(a0)+,a3		; a3 points to speed
		
		lea 	SPRITE_SLOTS,a0		
		move.l	(a0,d0*4),a0
		add.w	(a0),a0			; a0 points to global sprite vares
		
;----		
		move.w	(a1),d1			; Current frame
		move.w	(a3),d2			; Current speed
		
		moveq	#0,d6
		move.w	(a2,d1*2),d3		; Store the current frame

; need to compare $fffe here for play sprite once.
; if true then we need to disable and pop the sprite from the list.
; Are we at the end of the loop?
		bpl.s	.cont
; Yes we are, reset loop counter back to zero.
		clr.w	(a1)			; reset frame from start		
		addq.w	#1,d3			; is value $fffe->$ffff or $ffff->$0000?
		beq.s	.end			; If not zero then do not set end of animation flag.
		moveq	#-1,d6			; Was $fffe (-2) so set end flag.
		
.end:		moveq	#0,d1
		move.w	(a2,d1*2),d3		; 		

; Has the speed reached the set speed?
.cont:		move.w	d3,(a0)			; Set Frame
		cmp.w	2(a1),d2		; speed reached?  next frame
		bne.s	.loopdone
		move.w	#-1,2(a1)
		addq.w	#1,(a1)			; Next frame		
.loopdone:	addq.w	#1,2(a1)		; Increase speed.
.exit		
		move.l	(a7)+,d1
		move.l	(a7)+,d0

		rts


;
; CAST_SPRITE
;
; Adds a sprite in the sprite list
;
; In:
;       d0 = Sprite type (0, bombjack, 1=MUMMY
;       d1 = start xpos
;       d2 = start ypos
;       d3 = sprite control word to set
;       a0 = offset address of handler to assign
;
; Out:
;       d4 = Allocated Sprite number
PUSH_SPRITE:
        cmp.w   #MAX_ACTIVE_SPRITES-1,NUM_SPRITES_INPLAY                        ; Sprites may be pushed
        beq     .exit
        addq.w  #1,NUM_SPRITES_INPLAY
        lea     SPRITE_FREE_LIST,a1

        moveq   #0,d4
;;.spr1:  cmp.w   #-1,(a1)+               ; Find next spare sprite
;;        beq     .spare                  ; In free list.
;;        addq.w  #1,d4                   ; Slot count!
        moveq   #-1,d5
.spr1:  REPT 2
            cmp.w   d5,(a1)+                ; Find next spare sprite
            beq.s   .spare                  ; In free list.
            addq.w  #1,d4                   ; Slot count!
        ENDR
        bra.s   .spr1

.spare:
;;        move.w	d0,-2(a1)
        move.w	d0,-(a1)
        lea	SPRITE_DEF_BASE,a1
        lea     SPRITE_DEFS,a2
        add.w   (a2,d0*2),a1            ; CHECK THIS FOR OVERFLOW.
; a1 now points to source

        lea     SPRITE_SLOTS,a2         ; Pointer to available sprite list
        move.l  (a2,d4*4),a2
; a2 now points to available sprite space.
; copy the sprite to a2

        move.l   #$80808080,d6
.copy_sprite
;;        move.l  (a1)+,d5
;;        cmp.l   #$80808080,d5
;;        beq.s   .copy_done
;;        move.l  d5,(a2)+
        REPT 4
            move.l  (a1)+,d5
            cmp.l   d6,d5
            beq.s   .copy_done
            move.l  d5,(a2)+
        ENDR
        bra.s   .copy_sprite

.copy_done:
; a2 now has copy of the sprite data.
        lea     SPRITE_SLOTS,a1         ; Pointer to available sprite list
        move.l  (a1,d4*4),a1

; a1 now back at the head of the sprite data.

        move.l  a0,2(a1)                ; Save the sprite handler address
;;        move.l	a1,a2
;;        add.w   (a1),a2                 ; a2 now pointing to sprite vars
;;        move.w  d0,(a2)                 ; Initialize Sprite number (unused)
;;        move.w  d1,2(a2)                ; Store x pos
;;        move.w  d2,4(a2)                ; Store y pos
;;        move.w  d3,6(a2)                ; Store Type
        add.w    (a1),a1
        movem.w  d0-d3,(a1)                 ; Initialize Sprite number (unused)
.exit:  rts
a/b is offline  
Old 02 April 2019, 14:07   #911
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by a/b View Post
Just some basic speed/size optimizations (lines starting with ;; ):
Looking at 020+ code makes me sad&angry, register scaling is soooo useful ;(.

Code:
;
; ANIMATE
;
; The sprite handler is called with the sprite to work on in d0
; Then ANIMATE is called from the handler with the animate type in d1
;
; In
; 	d0 = sprite number animate in sprite list (player 1 is 0)
; 	d1 = Type of animation ie. (0 standing, 1 walk left, 2 walk right)
; Out:
;	d6 = -1 = End of sprite loop reached
;
ANIMATE:	
		move.l	d0,-(a7)
		move.l	d1,-(a7)
	
		lea 	SPRITE_SLOTS,a0
		move.l	(a0,d0*4),a0		; PLR_RYGAR
; a0 points to sprite base.	
		
		move.l	a0,a1
		move.l	a0,a2
		move.l	a0,a3
		
;;		addq.w	#6,a0			; Point to Animation Sets
;;		add.w	(a0,d1*2),a1		; a1 now pointing to base animation set
		
;;		move.l	a1,a0
;;		move.l	a2,a1
		add.w	(6,a0,d1*2),a0		; a0 now pointing to base animation set

;;		add.w	0(a0),a1		; a1 points to variables
;;		add.w	2(a0),a2		; a2 points to frames
;;		add.w	4(a0),a3		; a3 points to speed
		add.w	(a0)+,a1		; a1 points to variables
		add.w	(a0)+,a2		; a2 points to frames
		add.w	(a0)+,a3		; a3 points to speed
		
		lea 	SPRITE_SLOTS,a0		
		move.l	(a0,d0*4),a0
		add.w	(a0),a0			; a0 points to global sprite vares
		
;----		
		move.w	(a1),d1			; Current frame
		move.w	(a3),d2			; Current speed
		
		moveq	#0,d6
		move.w	(a2,d1*2),d3		; Store the current frame

; need to compare $fffe here for play sprite once.
; if true then we need to disable and pop the sprite from the list.
; Are we at the end of the loop?
		bpl.s	.cont
; Yes we are, reset loop counter back to zero.
		clr.w	(a1)			; reset frame from start		
		addq.w	#1,d3			; is value $fffe->$ffff or $ffff->$0000?
		beq.s	.end			; If not zero then do not set end of animation flag.
		moveq	#-1,d6			; Was $fffe (-2) so set end flag.
		
.end:		moveq	#0,d1
		move.w	(a2,d1*2),d3		; 		

; Has the speed reached the set speed?
.cont:		move.w	d3,(a0)			; Set Frame
		cmp.w	2(a1),d2		; speed reached?  next frame
		bne.s	.loopdone
		move.w	#-1,2(a1)
		addq.w	#1,(a1)			; Next frame		
.loopdone:	addq.w	#1,2(a1)		; Increase speed.
.exit		
		move.l	(a7)+,d1
		move.l	(a7)+,d0

		rts


;
; CAST_SPRITE
;
; Adds a sprite in the sprite list
;
; In:
;       d0 = Sprite type (0, bombjack, 1=MUMMY
;       d1 = start xpos
;       d2 = start ypos
;       d3 = sprite control word to set
;       a0 = offset address of handler to assign
;
; Out:
;       d4 = Allocated Sprite number
PUSH_SPRITE:
        cmp.w   #MAX_ACTIVE_SPRITES-1,NUM_SPRITES_INPLAY                        ; Sprites may be pushed
        beq     .exit
        addq.w  #1,NUM_SPRITES_INPLAY
        lea     SPRITE_FREE_LIST,a1

        moveq   #0,d4
;;.spr1:  cmp.w   #-1,(a1)+               ; Find next spare sprite
;;        beq     .spare                  ; In free list.
;;        addq.w  #1,d4                   ; Slot count!
        moveq   #-1,d5
.spr1:  REPT 2
            cmp.w   d5,(a1)+                ; Find next spare sprite
            beq.s   .spare                  ; In free list.
            addq.w  #1,d4                   ; Slot count!
        ENDR
        bra.s   .spr1

.spare:
;;        move.w	d0,-2(a1)
        move.w	d0,-(a1)
        lea	SPRITE_DEF_BASE,a1
        lea     SPRITE_DEFS,a2
        add.w   (a2,d0*2),a1            ; CHECK THIS FOR OVERFLOW.
; a1 now points to source

        lea     SPRITE_SLOTS,a2         ; Pointer to available sprite list
        move.l  (a2,d4*4),a2
; a2 now points to available sprite space.
; copy the sprite to a2

        move.l   #$80808080,d6
.copy_sprite
;;        move.l  (a1)+,d5
;;        cmp.l   #$80808080,d5
;;        beq.s   .copy_done
;;        move.l  d5,(a2)+
        REPT 4
            move.l  (a1)+,d5
            cmp.l   d6,d5
            beq.s   .copy_done
            move.l  d5,(a2)+
        ENDR
        bra.s   .copy_sprite

.copy_done:
; a2 now has copy of the sprite data.
        lea     SPRITE_SLOTS,a1         ; Pointer to available sprite list
        move.l  (a1,d4*4),a1

; a1 now back at the head of the sprite data.

        move.l  a0,2(a1)                ; Save the sprite handler address
;;        move.l	a1,a2
;;        add.w   (a1),a2                 ; a2 now pointing to sprite vars
;;        move.w  d0,(a2)                 ; Initialize Sprite number (unused)
;;        move.w  d1,2(a2)                ; Store x pos
;;        move.w  d2,4(a2)                ; Store y pos
;;        move.w  d3,6(a2)                ; Store Type
        add.w    (a1),a1
        movem.w  d0-d3,(a1)                 ; Initialize Sprite number (unused)
.exit:  rts

Thanks for this a/b... very nice. I haven't done any optimisations on the code yet so that is why it is the way it is.

Let me know if you want more challenges though... I have plenty.
mcgeezer is offline  
Old 02 April 2019, 19:13   #912
seuden
uber cool demi god
 
seuden's Avatar
 
Join Date: Jun 2006
Location: Kent/England
Posts: 2,073
Awesome work mcgeezer, love reading this thread.
seuden is offline  
Old 04 April 2019, 16:23   #913
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
I thought I'd do just a quick update on where I am with progress on the project.



I estimate the game should be done in about the next 6 weeks, if it's not then it won't be done until October as i have lots of well deserved holidays planned with the family and friends.

Geezer
mcgeezer is offline  
Old 04 April 2019, 16:45   #914
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Quote:
Originally Posted by mcgeezer View Post
I estimate the game should be done in about the next 6 weeks


Looking at your very impressive project plan, I don't see "Flip after bouncing off enemies"?

Last edited by DamienD; 04 April 2019 at 16:55.
DamienD is offline  
Old 04 April 2019, 17:12   #915
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by DamienD View Post


Looking at your very impressive project plan, I don't see "Flip after bouncing off enemies"?
Those are just details! It's coming - don't worry.
mcgeezer is offline  
Old 04 April 2019, 17:56   #916
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
DamienD is offline  
Old 04 April 2019, 21:41   #917
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Here's another update on progress of Round 5.

[ Show youtube player ]

The Cavebat is a hardware sprite and the little bombs that are dropping are bobs. I know there's a few graphical glitches here that need fixing, they're mainly off by 1 errors or crap that I've stuck in the map that I just need to remove as I had other ideas previously on how to control events in the game..... things evolve as you code I guess.

All of the enemies except for the little crabs are done for rounds 1-4, the hardest enemy to code on Round 5 still remains to be the Blue Monkey as it's probably that most complicated enemy of the lot.

Thanks to all those that are following the thread, it helps a lot with motivation now that the game compo is done.

The other update I've done is made the code hunk 100% relocatable, the data hunk still has 220 relocation offsets, I was mainly bothered about optimising for speed but may go the whole hog and make the entire thing 100% relocatable ... depends how my OCD is I guess.

Perhaps some of the other coders can list the pros and cons of doing it.

Geezer
mcgeezer is offline  
Old 06 April 2019, 22:54   #918
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Monkeys, Ape's and Crabs added...

[ Show youtube player ]

More to come tomorrow!
mcgeezer is offline  
Old 06 April 2019, 23:19   #919
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Nice
DamienD is offline  
Old 07 April 2019, 10:21   #920
Reido
Registered User
 
Join Date: Feb 2013
Location: Dublin/Ireland
Posts: 403
Looks great, top work!
Reido is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Entry: Rygar AGA Edition mcgeezer Coders. Entries 75 28 February 2019 20:41
On the Ball - World Cup Edition AGA djcasey request.Old Rare Games 4 25 January 2013 12:39
On The Ball League Edition AGA , Player Manager 2 StarEye Games images which need to be WHDified 11 22 January 2010 18:21
The Vague #1 AGA-RTG edition is released ! kas1e Amiga scene 12 30 October 2007 00:27
On The Ball: World Cup Edition AGA CodyJarrett request.Old Rare Games 11 27 May 2003 06:14

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:39.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.14676 seconds with 14 queries