June AGI Interpreter Update

Talk about your programs in progress. Discuss how to implement features, etc.
Forum rules
This section is for testing Commander X16 programs and programs related to the CX16 for other platforms (compilers, data conversion tools, etc.)

Feel free to post works in progress, test builds, prototypes, and tech demos.

Finished works go in the Downloads category. Don't forget to add a hashtag (#) and the version number your program was meant to run on. (ie: #R41).
Manannan
Posts: 70
Joined: Fri Oct 14, 2022 7:23 am

June AGI Interpreter Update

Post by Manannan »

I thought it was time to give an update to the progress of the AGI interpreter I am building.

I have hit some milestones, over the past few months I wanted to share.

- In King's Quest I, the player is now able to walk around the map and pick up objects.
- I have implemented a working text parser, and the game responds correctly to the commands

I have uploaded a video of this here. In summary the player is able to open the doors of the castle, walk through the halls and bow to the king. He then goes to the field to eat a 'tasty' carrot!
https://youtu.be/mmCgzXV5TwY

I am grateful to Voidstar for letting me show this off at VCF Dallas.

I met with CosmicR, over Skype a few months ago to discuss the integration of his excellent graphics drawing routine into my codebase. His scanline algorithm fills much faster than my diamond one, which I just ported from Meka.

See here: https://github.com/cosmicr/astral_body and viewtopic.php?p=33151&hilit=forgot#p33151

I hope to see this integrated as the next major piece of work.

Once this is integrated, then sprite to background priority can be worked on.

My repo is here: https://github.com/wizardmanannan/CX16A ... /README.md
Last edited by Manannan on Mon Jun 17, 2024 9:39 am, edited 1 time in total.
User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: June AGI Interpreter Update

Post by desertfish »

Wow that flood fill code is very fast. What screen mode is this running in?
Manannan
Posts: 70
Joined: Fri Oct 14, 2022 7:23 am

Re: June AGI Interpreter Update

Post by Manannan »

desertfish wrote: Sun Jun 16, 2024 9:24 pm Wow that flood fill code is very fast. What screen mode is this running in?
Layer 0: 320x240 bitmap 2 bytes per pixel mode
Layer 1: 4 pixel per byte tile mode
Sprites: Enabled

That's not the whole story though.

The agi resolution is 160x168.
However the pixels are doubled horizontally which equals 320x168. That's why there are black bars at the top.

Thanks for the praise regarding the speed of the algorithm. I optimised it by unrolling all of the loops.
However, it is about to be replaced.

I haven't drawn the priority screen yet so if I kept this drawing algorithm the speed would be roughly halved.
I also mistakenly used the diamond algorithm inherited from Meka rather than a scanline algorithm which works very efficiently the VERA's auto increment.
Also my diamond flood algorithm uses 9 banks for a queue!

That is why I will be using CosmicR's algorithm as I mentioned in the post. It can draw both even faster and only takes a few hundred bytes of space for the queue.
User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: June AGI Interpreter Update

Post by desertfish »

I wrote a scanline based flood fill routine (mainly for the Paint program)

Here you can see it
https://github.com/irmen/prog8/blob/mas ... x2.p8#L628

I never took the time to optimize it for vera optimized writes
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: June AGI Interpreter Update

Post by voidstar »

OPEN DOOR
BOW (to the king!)
PUSH ROCK
CLIMB TREE
TAKE EGG

Good times! At VCF, no one caught on that you had to actually type commands to interact with the environment (I mean, on their own).

It was tough "re-teaching" folks how those old Sierra games were a kind of hybrid "text adventure" (or "typing tutor?") and graphical adventure-game.
Manannan
Posts: 70
Joined: Fri Oct 14, 2022 7:23 am

Re: June AGI Interpreter Update

Post by Manannan »

desertfish wrote: Mon Jun 17, 2024 4:37 pm I wrote a scanline based flood fill routine (mainly for the Paint program)

Here you can see it
https://github.com/irmen/prog8/blob/mas ... x2.p8#L628

I never took the time to optimize it for vera optimized writes
Thanks. I may reference this.
Manannan
Posts: 70
Joined: Fri Oct 14, 2022 7:23 am

Re: June AGI Interpreter Update

Post by Manannan »

voidstar wrote: Tue Jun 18, 2024 5:04 am OPEN DOOR
BOW (to the king!)
PUSH ROCK
CLIMB TREE
TAKE EGG

Good times! At VCF, no one caught on that you had to actually type commands to interact with the environment (I mean, on their own).

It was tough "re-teaching" folks how those old Sierra games were a kind of hybrid "text adventure" (or "typing tutor?") and graphical adventure-game.
Funny you should say 'typing tutor', as King's Quest III was my typing tutor. I learnt in touch type in Manannan's lab :).
User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: June AGI Interpreter Update

Post by desertfish »

Manannan wrote: Tue Jun 18, 2024 12:20 pm
desertfish wrote: Mon Jun 17, 2024 4:37 pm I wrote a scanline based flood fill routine (mainly for the Paint program)

Here you can see it
https://github.com/irmen/prog8/blob/mas ... x2.p8#L628

I never took the time to optimize it for vera optimized writes
Thanks. I may reference this.
TallLeroy over at the discord has been tweaking the fill routine mentioned here and has a version running that fills a hefty part of the 320x240 lo res screen in about half a second, very promising I think
Manannan
Posts: 70
Joined: Fri Oct 14, 2022 7:23 am

Re: June AGI Interpreter Update

Post by Manannan »

desertfish wrote: Wed Jun 26, 2024 5:09 pm
Manannan wrote: Tue Jun 18, 2024 12:20 pm
desertfish wrote: Mon Jun 17, 2024 4:37 pm I wrote a scanline based flood fill routine (mainly for the Paint program)

Here you can see it
https://github.com/irmen/prog8/blob/mas ... x2.p8#L628

I never took the time to optimize it for vera optimized writes
Thanks. I may reference this.
TallLeroy over at the discord has been tweaking the fill routine mentioned here and has a version running that fills a hefty part of the 320x240 lo res screen in about half a second, very promising I think
Thanks DessertFish.
For others reading the post, I found it by going to the discord server and searching for the word fill.

I will have to analyse it and compare it to the other algorithm I mentioned to see which one requires the least memory and is fastest.

Kind of like examining final candidates in a recruitment round.

I wasn't expecting there to be an algorithm which could beat the 2 seconds of the other one.

Once I know which is the successful candidate I will post.
User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: June AGI Interpreter Update

Post by desertfish »

If you would like to see the optimized fill routine in action, you can do so by toying around with the paint program:

viewtopic.php?p=34490
Post Reply