Sunday, May 31, 2020

FireMonkey 3D Enterprise Application




You might remember me writing that the FireMonkey framework isn't a full-blown gaming engine and that it's better suited to enterprise applications. (rimshot)

This is a follow up to my May the Fourth and Revenge of the Fifth posts. These 3D models are also from mods of Sins of the Solar Empire by a group named Stellar Parallax Studios who created Star Trek Armada 3 (STA3) and Ages of the Federation (AOTF).

These mods breathe a whole new life into a fairly old real time strategy game. I bought Sins for the sole purpose of playing Star Trek Armada 3. I've never even played the base game. I think STA3 is the best Star Trek game (let alone mod) that I've seen. AOTF is still in development, and has a different flavour, but it's also stunning.

I don't have permission from the content creators to share the demo application, but that's just as well. The main form's .dfm contains seven 3D models and fifteen material sources (textures) and weighs in at just over 99 MB, about four times GitHub's maximum file size. Interestingly, when these are embedded in the .dfm, they load quickly, but they load very slowly when reading the .obj files from disk. I think there's some room for improvement here, Embarcadero.

The demo project is very much like the ones from the previous posts, with a couple of differences.

First, I use a TDummy control as a container to group all of the TModel3D controls together. That way I only have to change the RotationAngle for TDummy instead of changing it for each model individually.

Second, this demo actually includes some code where the others didn't. Not much, but a little. I still use a TFloatAnimation to animate the rotation, but the Loop property is set to False so it only runs once. I added some code in the OnFinish event to make the next model visible, update the label and then restart the animation each time it completes a 360 degree rotation.

I spent some time tinkering with Sins modding and writing some tooling to help make the process easier, which is why I'm a little preoccupied with the game and its internals. It's very configurable using plain text files. Even the 3D .mesh files can be converted to text, making them fairly easy to load and manipulate. If I do anything interesting with it, I'll try to write another blog post.

1 comment:

Vincent Gsell said...

Hi Bruce,

Very nice and interesting ! Model seems to be cool.

Indeed, the dfm keep mesh format "near to be ready" in model. that said, a big dfm is not very easy to handle, imho...
It is sure, the fmx native obj loader is sooo slow. (payd its involvement into fmx in material design.

I tryed to optimize a bit here :
https://github.com/VincentGsell/FMeX
there are a obj loader and other stuffs.

My test with FMX, in a matter of 3d, drive me to reimplement some stuff. FMeX is my playground for that.
regards,
Vincent