Page 1 of 1

Would writing a virtual machine be practical?

Posted: Sun Feb 18, 2024 10:23 pm
by wysardry
Would it be practical to create a virtual machine using ugBASIC? Would it be fast enough?

I'm thinking of something like Infocom's Z-Machine or Level 9's A-machine, which were designed to allow the same byte code to run text adventures on multiple 8-bit computers.

Re: Would writing a virtual machine be practical?

Posted: Sat Apr 27, 2024 6:00 pm
by spotlessmind1975
Hi wysardry!
wysardry wrote: Sun Feb 18, 2024 10:23 pm Would it be practical to create a virtual machine using ugBASIC?
In reality it is opposite to the philosophy of ugBASIC: with ugBASIC you can use the language itself to write the game, and porting is the adaptation of what you have written with respect to the (small) differences. Thus it would always have maximum speed in all environments.
wysardry wrote: Sun Feb 18, 2024 10:23 pm I'm thinking of something like Infocom's Z-Machine or Level 9's A-machine, which were designed to allow the same byte code to run text adventures on multiple 8-bit computers.
A virtual machine is the lazy solution to the problem of running the same software on multiple machines, and leads to a result that does not always live up to expectations. If I remember correctly, the Z-Machine is designed for a certain type of adventure (like "typed prompt" or something like that). Then the SCUMM approach is better which, however, suffers from the same problem of having an interpreter.

Re: Would writing a virtual machine be practical?

Posted: Tue Apr 30, 2024 4:32 am
by wysardry
Yes, the Z-machine is a virtual machine with a narrow focus that was designed for use with a domain specific language (ZIL) for creating parser-based text adventures, such as Zork.

SCUMM and ScummVM were designed to create point and click adventure games, such as Maniac Mansion.

I'm not a huge fan of virtual machines, but many of the existing text adventure creation tools use them. Most text adventure interpreters and virtual machines are written in assembly code, which makes porting them to new machines more difficult.