Beginner question: can one code a game within a game in UE4 with C++?

So this isn’t using blueprints but the actual c++ stuff. Is it possible to say write a simple chess (just to throw out example but can be anything really, or say a calculator etc) game within Unreal Engine if the Chess game logic is already coded in C++ and UE4 is only used as the 3D graphical engine in which to represent the 3D chess board inside of this UE4 environment? Namely could one take a pure C++ coded logic or game that already exists and then import it into UE4 using and have it work by creating the interface /virtual buttons/interfaces to that game system instead of say the traditional 2D GUI of most classic or board games it interacts with the virtual 3D interface/buttons/etc inside of a UE4 sandbox environment and UE4 merely becomes the 3D interface GUI? As for my particular intent, I created a simple “nuclear authentication process” in the open source Defcon PC game by Introversion as a Proof of concept. In the vanilla Defcon anyone can launch nukes at Defcon 1. But I added a mechanism that locks that and only allows launch if the correct codes are entered. Basically it requires using a sort of keygen authentication mechanism of sorts prior to allowing the launch of nuclear weapons inside the game. Since Defcon is in C++ and UE4 supports C++ as well, I figured could it be possible to create the same process inside a UE4 sandbox? My goal is to apply this to a mobile launcher in the future, so that I have a 18-wheeler sized truck in UE4 that is basically a drive-able Mobile Nuke Launcher and the player can stop the mobile launcher at any place, start a sequence to raise the missile up to 90 degrees, hit a button and have the missile launch into the air etc…
https://vimeo.com/417356292/1ffc64bcd2
But prior to launch I wanted to add a sort of “nuclear authentication” mechanism to it. I wrote the code and got it working in C++ and incorporated it into the Defcon PC game (cool indie game from the past that is nuclear themed and has open source c++) and was wondering if anyone well versed in UE4 specifically as it pertains to C++ part of UE4 can point me in the right direction of creating something like this. The actual authentication logic/algorithm has already been coded, it just needs to be able to “interface” within UE4 and I’m thinking like create a simple 3D panel that displays the challenge code so the player can see it, and also has a click-able 3d keyboard with buttons that the user can use the mouse in order to simulate finger typings as the means to input the authentication code back into the system before it will proceed to allow the launch of the missile inside UE4.
I hoping if I can manage to find a way to create the 3d panel , 3d buttons/3d keyboard “GUI INTERFACE” within the UE4 engine/sandbox and piggyback on the authentication algorithm which I already have coded and gotten working for other games like Defcon, then this sort of virtual “all in one” authentication method (including c++ logic and the UE4 asset/models for the interface) can be reused in future sandbox demos that I would want to apply this towards, not only in the case of a mobile launcher but maybe for a submarine SLBM inside a virtual sub for example or any other sequence or action that one would like to put a virtual “lock” on…

Yes. Its is pretty common for games to do this.

  • create Logic / Simulation back end module
  • create Unreal game front end
  • create messaging system between Unreal front end and Logic back end

In this manner you can think of the game as “UI” front end that shows the state of the logic back end.

Here is process I’ve made so far:

https://vimeo.com/423377107
Unreal Engine 4.25 Authentication code test


Nuclear authentication process C++

https://vimeo.com/420903590
DongFeng-41 Unreal Engine 4.25 test map