RPG project

developing/porting a new game or gaming framework? post in here!
dp11
Posts: 1757
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: RPG project

Post by dp11 »

A little more saving here ( but check my maths)

Code: Select all

.loadsw
LDA &F4
STA save%
LDA wbyte%
SEI
STA &F4
STA &FE30
CLI

LDY#0
.lswloop
LDA (readaddr%),Y
STA (writeaddr%),Y
INY
CPY byte%
BNE lswloop

INC readaddr%+1 
INC writeaddr%+1
LDA bytes%+1
BEQ finished  
DEC bytes%+1
STZ byte%
bra  lswloop

.finished
LDA save%
SEI
STA &F4
STA &FE30
CLI
RTS
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

Fantastic! Using X in the inner plot loop and the optimisations to clearcity gives an extra 3% speedup, so it's running about 15% faster than the original.

It feels much more responsive now. Thanks for all your help dp11!

Files attached for reference.
Attachments
ALL CODE.txt
(7.41 KiB) Downloaded 88 times
legend.dsd
(100.25 KiB) Downloaded 85 times
dp11
Posts: 1757
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: RPG project

Post by dp11 »

A bit more on getbyte

Code: Select all


.getbyte
LDA (readaddr%)
BPL pair
AND #127
LDX #1
BRA inchigh

.pair
TAX

INC readaddr%
BNE nohighpair
INC readaddr%+1
.nohighpair

LDA (readaddr%)

.inchigh
INC readaddr%
BNE nohigh
INC readaddr%+1
.nohigh

BIT flag%		; change flag from 0 or 1 to 0 or 128
BPL return
sta wbyte%
AND #85
ROL A
STA temp2%
LDa wbyte%
AND #170
ROR A
ORA temp2%
.return
STA wbyte%
RTS
You can now also take wbyte out of the plot loop

Code: Select all


LDY #0
LDA wbyte%; take out of plot loops save three cycles
.iloopY

STA (writeaddr%),Y
DEX
BNE icontinue
JSR getbyte ; this returns wbyte in A so no need to load it 

.icontinue
INY
CPY height%
BNE iloopY
You might even find that the STA wbyte% at the end of getbyte should actually be taken out of getbyte
dp11
Posts: 1757
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: RPG project

Post by dp11 »

A very little bit more from .clearcity

Code: Select all


.clearcity

LDY#0
STY &70  
LDA #&14
STA &71
.middleclearloop
LDX#8
LDA #60
.clearloopY1
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
DEX
BNE clearloopY1

LDX#8
LDA #3
.clearloopY2
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
STA (&70),Y
INY
DEX
BNE clearloopY2
TYA                     ; Check if Y is zero, if not go around the loop again.
BNE middleclearloop
INC &71
LDA &71
CMP #&14+20 ; check for end of loop
BNE middleclearloop  ; we know Y 0 zero so no need to set it to zero again.
RTS

User avatar
Arcadian
Site Admin
Posts: 4223
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: RPG project

Post by Arcadian »

Thanks Shane for demonstrating on Saturday (and everybody who's provided input either during the demo or in the thread - it's great to see it so busy, and to see that the code has already been further optimised for speed!). I'm really going to enjoy following its progress, good luck with the project and hopefully we can schedule you another slot in a few month's time so everyone can see how it's developing?

Anyway, just posting to let you know that the video is now live! :)
Please subscribe to the ABug YouTube channel!
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

This is getting a bit obsessive for me now. :)

I applied the change to getbyte to allow LDA wbyte to be moved out of the inner loop.

I also changed the code that reverses the pixels to use a lookup table instead of reversing on the fly.

I reintegrated getbyte into the plot and plotinv routine. This eliminates the need to use flag% (which also means I can get rid of the check for flag within getbyte) and cuts out the JSR/RTS.

Speedup compared to the original is now nearly 21% on average.
Attachments
legend.dsd
(100.25 KiB) Downloaded 87 times
ALL CODE.txt
(8.31 KiB) Downloaded 80 times
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

Arcadian wrote: Mon Jun 08, 2020 11:18 am Thanks Shane for demonstrating on Saturday (and everybody who's provided input either during the demo or in the thread - it's great to see it so busy, and to see that the code has already been further optimised for speed!). I'm really going to enjoy following its progress, good luck with the project and hopefully we can schedule you another slot in a few month's time so everyone can see how it's developing?

Anyway, just posting to let you know that the video is now live! :)
Thanks Arcadian! I lost the chat when my laptop ran out of power so I didn't see many of the comments, hopefully they are visible in the video. Or if someone has a log, that would be really useful.
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

Average optimisation - 10%/day. At this rate, it'll be instantaneous in a couple of weeks time. :lol:
User avatar
Arcadian
Site Admin
Posts: 4223
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: RPG project

Post by Arcadian »

They're not on the video but see below for the chat log :)

Code: Select all

20:19:57	 From  0xC0DE : It's Always more fun to write your own routines!
20:27:05	 From  0xC0DE : Looking great so far!
20:27:29	 From  Dave : Yes looks great, and a refreshing genre for the beeb 
20:30:07	 From  chrisn (Chris) : Will have to buy a Master....
20:31:13	 From  Paul Klintworth : Looks amazing!
20:33:45	 From  sarahwalker - Sarah : Poor Ringo :(
20:37:52	 From  0xC0DE : For a moment I thought it was my laptop battery ;)
20:38:10	 From  Dave : haha me too - I plugged in the lead lol
20:38:21	 From  EdwardianDuck - Jeremy : Still, I can’t remember an adventure / role playing campaign which had a drummer as a character class…
20:38:55	 From  Sydney - Simon : ringo wasn't even the best drummer in the beatles!
20:38:58	 From  Matt Godbolt : [ belated reply on my talk -> https://mattgodbolt.github.io/bbc-micro-emulation/abug2020 slides ]
20:39:13	 From  Ed Dorosh   to   Recording PC(Privately) : All is up now......
20:46:21	 From  Matt Godbolt : Does Abug have a twitter account? :)
20:47:15	 From  Recording PC : sorry matt no abug twitter 
20:47:48	 From  Matt Godbolt : alright, I'm such a social media who^H^H^Her, attension seeker
20:47:51	 From  Matt Godbolt : attention*
20:47:52	 From  Dave : We need to employ a social media manager ;)
20:49:07	 From  Recording PC : if anyone is good with twitter and wants to step forward and maintain accounts for abug/stardot/retro software etc feel free! I create twitter accounts, use them a bit, then promptly forget they exist for a few months...
20:50:04	 From  Matt Godbolt : I think Rich TW has some raycasting code around (not sure if that's him just noddling about or otherwise)
20:51:04	 From  Matt Godbolt : this is the "trick" wolf 3d and doom used to run at any speed
20:51:31	 From  Dave : did you see that black book on Wolfenstein and doom?  I have the doom one only, it's fantastic
20:51:56	 From  Recording PC   to   Phillip Pearson (myelin)(Privately) : hi phil. if the questions continue flowing on this current talk would you be ok to perhaps do 9.15 - 10.15 UK time? if you're under time pressures no worries we can wrap this one up
20:52:32	 From  kieranhj : Yeah, I've got them both. Great books.
20:52:53	 From  Dave : keep trying to get the wolf one, it appears on amazon briefly for about 50 quid then vanishes again
20:53:14	 From  kieranhj : I think I've got it loaned out at the moment but you're welcome to borrow it one day.
20:53:36	 From  Dave : borrow it one abug, return the next!
20:53:47	 From  Dave : cheers for the offer but I think i'd feel too guilty having it for that long
20:54:16	 From  DaveH : What, a week?
20:54:30	 From  Dave : haha I meant the physical abugs
20:56:24	 From  Phillip Pearson (myelin)   to   Recording PC(Privately) : yep!  i can absolutely do 9.15-10.15
20:57:13	 From  Recording PC   to   Phillip Pearson (myelin)(Privately) : ok super thanks phil, I'll post in main chat to let people know
20:57:51	 From  Phillip Pearson (myelin)   to   Recording PC(Privately) : great!
20:58:41	 From  Recording PC : Hi all, as the questions are still flowing on Shane's RPG game, we've pushed myelin's talk back 15 mins so it will now run 9.15pm - 10.15pm. We'll aim to have the current talk wrapped up by 9.10pm to allow for a 5 min break before the final talk
21:00:16	 From  Recording PC : … where Ed will announce the winner of the HSC.
21:00:47	 From  Matt Godbolt : I have them both. great books. I have a YT video I made about "how wolf works" which I did before I got the book. so many commenters said to get it :)
21:04:35	 From  Charlie Robson : ‘Optimise in haste repent at leisure’
21:04:47	 From  0xC0DE : :)
21:04:51	 From  Dave : premature optimisation is the .. you know the rest
21:05:02	 From  0xC0DE : "First make it work, then make it fast"
21:05:03	 From  Charlie Robson : … treatable?
21:07:26	 From  0xC0DE : Thanks Shane, I will be following your progress with great interest
21:07:34	 From  Charlie Robson : Game looks lovely. I’m looking forward to it. No pressure ;)
21:07:36	 From  Matt Godbolt : Awesome stuff Shane :)
21:07:51	 From  Dave : Yep great stuff - is this the only BBC game with level-of-detail sprites?
Please subscribe to the ABug YouTube channel!
dp11
Posts: 1757
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: RPG project

Post by dp11 »

I've been enjoying it too.

Code: Select all

.gbi2nohigh
STY temp%
TAY
LDA (&8E),Y
STA wbyte%
LDY temp%

If the table always sits on a page boundary. Then you can just do STA &8E and you don't need to preserve Y. saves 5 cycles
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

dp11 wrote: Mon Jun 08, 2020 1:59 pm I've been enjoying it too.

Code: Select all

.gbi2nohigh
STY temp%
TAY
LDA (&8E),Y
STA wbyte%
LDY temp%

If the table always sits on a page boundary. Then you can just do STA &8E and you don't need to preserve Y. saves 5 cycles
Ha! Neat trick. It doesn't, but there's no reason why it can't, if I shift some things around.
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

I've learned a lot from this exercise. Thanks dp11!
dp11
Posts: 1757
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: RPG project

Post by dp11 »

I think with a bit of code jiggling you can endup with just one call to getbyte in the main plot loop instead of one outside and one inside. you can then remove wbyte%

Which functions are most used ? I 've really looked at the other functions much.
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

dp11 wrote: Mon Jun 08, 2020 9:37 pm I think with a bit of code jiggling you can endup with just one call to getbyte in the main plot loop instead of one outside and one inside. you can then remove wbyte%

Which functions are most used ? I 've really looked at the other functions much.
It's mainly plot and plotinv where the speed is an issue. clearcity and blit are called each time the view is drawn, but the first two are called multiple times per draw. The other functions aren't really too important as they're only used sporadically.

The draw is now plenty fast enough. Even though it's only 21-22% faster, it feels a lot better. You can walk down a long street without feeling like you're waiting for the screen.

When I implement the version with masking, it might be a bit slower. I was originally thinking that I'd have to have uncompressed sprites, but I think I've figured out a way to do it by sacrificing one colour per sprite and a 32 byte lookup table while keeping compression.
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

Game is progressing. Starting to feel like a game now.

Image
User avatar
flibble
Posts: 886
Joined: Tue Sep 22, 2009 11:29 am
Contact:

Re: RPG project

Post by flibble »

Naomasa298, you mentioned on the talk on Saturday that you still had a combat system to write and were looking at JRPG style. This is very similar to my own project, so I thought I'd share some links I'd found relating to the forumulas behind Final Fantasy 1

https://gamefaqs.gamespot.com/nes/52259 ... faqs/57009
https://finalfantasy.fandom.com/wiki/Attack_(command)
https://github.com/Entroper/FF1Disassembly
https://www.openhub.net/p/jff1bs
https://github.com/nhydock/FF1-Battle-System
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

flibble wrote: Tue Jun 09, 2020 1:29 am Naomasa298, you mentioned on the talk on Saturday that you still had a combat system to write and were looking at JRPG style. This is very similar to my own project, so I thought I'd share some links I'd found relating to the forumulas behind Final Fantasy 1

https://gamefaqs.gamespot.com/nes/52259 ... faqs/57009
https://finalfantasy.fandom.com/wiki/Attack_(command)
https://github.com/Entroper/FF1Disassembly
https://www.openhub.net/p/jff1bs
https://github.com/nhydock/FF1-Battle-System
Thanks flibble, this could come in useful. I'll have to adapt some aspects, since it's first person rather than third person, although Phantasy Star had something vaguely similar. I want to have some kind of desperation attacks (aka Limit Breaks) in there though. I was thinking something similar to FF Tactics.
User avatar
Iapetus
Posts: 81
Joined: Wed Feb 12, 2014 1:08 pm
Contact:

Re: RPG project

Post by Iapetus »

This is looking so cool. congrats :wink:
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

For my own amusement.

First encounter!
Image

(don't worry, monster graphics will be better than this :) )
User avatar
FourthStone
Posts: 1527
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: RPG project

Post by FourthStone »

Where's the like button =D>

Looking very interesting and loving the coding snippets on optimisation :D
User avatar
Arcadian
Site Admin
Posts: 4223
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: RPG project

Post by Arcadian »

Naomasa298 wrote: Tue Jun 09, 2020 11:44 pm Image
He looks familiar! ;)

rep.png
rep.png (3.25 KiB) Viewed 5894 times

Sad to see that our little green friend who was once a hero has evidently descended into a life of crime in his later years! :(
Please subscribe to the ABug YouTube channel!
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

Arcadian wrote: Wed Jun 10, 2020 12:51 am He looks familiar! ;)

Sad to see that our little green friend who was once a hero has evidently descended into a life of crime in his later years! :(
That is indeed him! His lust for diamonds has led him down a dark path...

Actually, drawing this picture gave me an idea - there will be a hidden Acorn tribute dungeon, where you will meet certain characters from various Acorn games over the years (probably minus our little green friend due to copyright reasons).

"Caveman yo-yos you for 230 points of damage!"

Not sure who to make for the end-of-level boss though...
User avatar
Arcadian
Site Admin
Posts: 4223
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: RPG project

Post by Arcadian »

Aw, that would be such a neat touch. Great idea! =D>

Always loved the fact that Trogg popped up in Bug Eyes 2 ...

BugEyes2_Trogg.gif
BugEyes2_Trogg.gif (6.92 KiB) Viewed 5881 times

Anyway, let's not rule out Repton's appearance in the dungeon just yet eh? (Remember Retro Software also published the Lost Realms Repton game, so it's not beyond the 'realms' of possibility that we could get the OK to include him).

Btw, speaking of publishing, if you're now going for 640K ADFS we'll want some 96tpi blanks - I've 13 boxes of these, so I'll keep plenty aside!!

Floppies_525in_Xidex-StorageMaster-96tpi_06-Straight_200409.jpg
Floppies_525in_3M-96tpi_01-BoxesOnly-Straight_200408.jpg

And in terms of 720k 3.5" discs (might as well do a Master Compact release too, eh?) you don't need to worry about these as I've got plenty! :lol:

Floppies_35in_All_01_200406.jpg
Please subscribe to the ABug YouTube channel!
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

Mostly been drawing faces for character creation at the moment. 12 more to go:
Attachments
Untitled.png
drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: RPG project

Post by drfloyd »

I discover your project ! It's great

You say is about all in basic ?
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

drfloyd wrote: Sun Jun 14, 2020 8:16 pm I discover your project ! It's great

You say is about all in basic ?
No. Most of the program logic is in BASIC, but anywhere that needs speed (for example, the sprite plotting routines) is in machine code.
Naomasa298
Posts: 394
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: RPG project

Post by Naomasa298 »

The cast is complete!
Untitled.png
Guest starring Harry Potter, Gandalf, Inigo Montoya and Ivan Drago (and also two characters from a NES game, which shall remain anonymous :) ).
drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: RPG project

Post by drfloyd »

great design !

It could become the best role game for BBC !
jregel
Posts: 283
Joined: Fri Dec 20, 2013 6:39 pm
Location: Gloucestershire
Contact:

Re: RPG project

Post by jregel »

Naomasa298 wrote: Mon Jun 15, 2020 6:08 pm The cast is complete!

Untitled.png

Guest starring Harry Potter, Gandalf, Inigo Montoya and Ivan Drago (and also two characters from a NES game, which shall remain anonymous :) ).
This looks really good. I'm following this thread and project with interest.
BBC Master Turbo, Retroclinic External Datacentre, VideoNuLA, PiTubeDirect with Pi Zero, Gotek USB Floppy Emulator
User avatar
Iapetus
Posts: 81
Joined: Wed Feb 12, 2014 1:08 pm
Contact:

Re: RPG project

Post by Iapetus »

Naomasa298 wrote: Mon Jun 15, 2020 6:08 pm The cast is complete!
Great gfx! =D> =D>
Post Reply

Return to “new projects in development: games”