Running a VM i.e. QEMU inside UE with a display in game

Has anyone tried something similar? I am thinking 0x10^c where there is a computer inside the game, however I don’t want to re-invent the wheel. I was thinking using QEMU to emulate a very old PC, and have the screen be displayed in game that the player would be able to see and interact with. I have no idea where to start, I just know “proper” unreal engine development using all the built ins and so on. Never done anything like this so any ideas would help!

Thanks

I worked on a project once that transmitted video over the network into Unity, decoded it, and wrote it to a texture. It was used to simulate an in-car navigation system that was powered by a different computer.

Unfortunately, I can’t say much else about it, but if that helps you think of a way to get there…

1 Like

There are two unreal-level things to solve, and one QEMU-level thing to solve.

First, you need to make QEMU happy about running hosted inside any other application, or find another way to run QEMU. Perhaps, you’ll want to just use the existing binary, and start it as a subprocess, rather than embedding it as a library, but you can try for the direct-linked approach too if you want. Try it from a simple C++ application you build yourself, first, to not include the Unreal specific bits while solving this problem.

Second, you need to set up the UE build to treat your QEMU hosting as an external library. There is an example “external library” setup you can use when adding a C++ module to the Unreal project. Maybe that’ll be a good start.

Third, you need to do the I/O between the remote screen texture/surface, and the remote keyboard/mouse(?) and the local Unreal process. This requires a little bit of procedural texture and input event hooking on the Unreal side, and whatever is necessary to make QEMU happy on the other side. Hopefully, you already worked that out in step 1, so it’s easy to tie into.

Sounds like a fun project with almost zero actual gameplay value :slight_smile: But awesome as an Easter egg! Good luck, and please post back with how it goes.

2 Likes

Thank you for all the replies! It looks like I will have to just think like an old school programmer and hook into a child process like you say. I am trying to make a simulator for a time long past, that I wasn’t alive or of age enough to experience, but it is fascinating to me nonetheless. I’ll let you know if I make any significant progress or even just a proof of concept. Cheers!