Introduction
This question is specific to GPU programming. It's not primarily about the game idea.
However, to better understand the question i will detail what it is i want to achieve in my game.
Development will happen with an NVidia GeForce GTX 980, no AMD/ATI specific hardware is available, in case it matters.
I haven't written a single line of code yet but i would do so in C# using one of the DirectX libraries in existence for .NET, such as SharpDX.
I don't possess all the required knowledge on the subjects i am about to ask about, please forgive my ignorance and/or incorrect nomenclature.
Also, please bare in mind that while I am not educated on the subject, i am absolutely willing to learn. I am merely considering/researching my idea at this time.
The basic idea (the game)
The "game" won't be graphically intensive, instead it will be computationally intensive running a "simulated world" running hundreds or even thousands of small programs on the GPU.
Each program is independent from each other except for basic intercommunication, which is detailed below.
The only "heavy" graphics i can think of right now is displaying each virtual machine and possibly some blinky lights as they communicate and/or runs instructions. Drawing lines between machines that are "physically" connected to each other. Sort of like a map of the world.
As well as drawing the command line of course. But nothing fancy, most computation time would be dedicated to the simulation.
My basic idea is to have a network of computers in a sandbox like "game" controlled from a command line. The command line that the player uses is a separate "computer", the one where the player is sitting at in the "game" world.
This is the game interface, it has the power to create computers in the simulated (on GPU) network, as well as "physically" interacting with the simulated network, such as powering on/off computers (Terminating GPU threads and starting new ones), uploading programs to run on a specific computer, "plugging in" network cables and altering the computers hardware.
The players computer would run on the CPU.
The network should all be capable of communication between each computer, as well as the players computer.
I want each computer to run a CPU architecture, such as x86. Obviously x86 may be too ambitious, i would be fine with the most basic architecture.
IF an architecture, any in existence, would "too much" then a scripting language would be fine as well but optimally, a compiler would be used. Such as a C compiler for the architecture emulated.
Each computer would have ONE compiled program running each. That program would have to take care of everything that computer does, including IO, network communications, bla bla.
As i've pointed out already, speed isn't important. Each machine could run at 20 Hz (IPS, Instructions Per Second) each, higher speeds would of course be better.
Each machine would have it's own memory, storage medium and CPU and would be upgradable, so each machine could be different in speed, memory capacity and storage capacity.
The storage should be saved between game sessions, optimally the storage would be saved on the real world (physical) storage of the computer's hard drive, in case the game stops unexpectedly then each machines "physical" storage would survive... Even if a corruption would occur because a write operation never finished. /details...
Questions
- Is this viable/possible?
- Is there a specific approach that is more viable than all others? Why?
- Which approach is easier? Taking into account my lack of knowledge on the subject of writing CPU emulators.
- GPU/CPU intercommunications, especially where each machines storage is concerned... Is it a good/bad idea?
- Networking... Can several CUDA/OpenCL threads communicate with each other as a network?
- Taking CPU emulation into account, is communication still possible? If my compiled program running on a machine writes to a specific memory address in the emulation, can that then be transmitted to another GPU thread for reading in emulated memory?
- Buffering... Suppose several machines "send" packets to one machine, is it possible to have a stack? I "know" how to approach the problem in C#/.NET but i've never actually written a GPU program besides the most simple of things, such as Game of Life type deals and it was quite a while ago.
- Is there something within this idea that isn't possible?
- On a scale from 1 to 10, how difficult would it be to do this GPU side vs keeping it CPU side? (That is, comparatively speaking if i had the knowledge to do it on the CPU)
- Should i continue researching/implementing my idea or do you think i am wasting my time?
Thank you for your time.