Would writing a virtual machine be practical?

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
wysardry
Posts: 26
Joined: Sun Oct 08, 2023 6:45 pm

Would writing a virtual machine be practical?

Post 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.
spotlessmind1975
Site Admin
Posts: 171
Joined: Fri Oct 06, 2023 8:25 pm

Re: Would writing a virtual machine be practical?

Post 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.
User avatar
wysardry
Posts: 26
Joined: Sun Oct 08, 2023 6:45 pm

Re: Would writing a virtual machine be practical?

Post 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.
Post Reply