Translating Blitzmax code into Unity code. Crazy idea ?

Started by Pingus, April 03, 2021, 02:54:14

Previous topic - Next topic

Pingus

I have a very poor knowledge about how Unity works so please forgive me if I say some coding insanity.
Translating 'correctly' a whole bmax game is outside my coding skills. Or it would take me several years.
At a first sight, C# and bmax does not looks *that* different at a basic level. My bmax code is quite straigthforward, I do not use 'fancy' stuff like inheritences (or very very rarely).
It seems to me that the main difference between a Unity code and a bmax code rely on how the bitmaps are handled. But let's imagine that ones make a Unity code that 'simulate' the Drawimage bmax function (and all bitmap quality associated, alpha, color, blending mode...). By that, I mean that the bitmaps would be loaded into unity, fake Timage objects would be created by associating a string name to that bitmaps.
Then a unity loop would handle visibility and Z layering of that objects after the whole main C# logic loop would be done.

Ex : Drawimage (sprite,x,y) would set the X,Y,Z value of that object 'sprite' in a list, Drawimage simply incrementing Z value each time it is called.
The final drawing loop of unity would take that list 'as is', just enabling the bitmap that were called and disabling all the others.

My purpose would be to translate manually my bmax code into a big C# main loop with as few structural differences as possible, so that I can keep the logic and the structure of the bmax code.

I started to do such translation with gamemaker a while ago and it gave some results because Gamemaker is way easier to understand, but for misc reasons, Unity is the only tool that makes sense commercially speaking and I gave up that first approach.

Do you think about any obvious and horrible pitfalls that would make such 'translation' just impossible, for performance reasons or any other structural reason ?
Performance is not a big issue as my games are 2D games so I can deal with some loss in performance. The aim beeing of course to target Android, IOS etc...

Xaron

I know how you feel. Unity is quite a beast in the beginning and a different approach when coming from pure coding. I seriously hated that visual stuff as it was just soo different and confusing in the beginning.

I'd suggest to do the move, watch some tutorial videos to get used with the internal structure and use and feel of Unity.

But GfK is right. It will be a 100% rewrite. IMO it's worth it as you learn some industry standard stuff and Unity is still the easiest (compared to Unreal or Unigine for instance).

On the other hand if you want to stick with 2D games (which is perfectly fine!) there might be no real reason to switch. BMax NG could work very well for you!

Pingus

Thanks for the answers.
NG is great and I already ported the code to Mac, but it is not a viable solution for Android and IOS.
Learning *a bit* of Unity is needed of course, but a full rewrite is not in my scope at the moment for time and financial reasons.
That said, I don't exactly see why my idea would not work (meaning a 50% rewrite, 50% translate).

Xaron

If you want to stay with the pure coding approach and have Android and iOS as targets, then you could also use Cerberus-X or AGK2.

Pingus

Yes, AGK is an option althought not "industrialy-validated" like Unity. Also it lacks many of the plugins required for collecting datas/advertising.

Steve Elliott

Quote
Square pegs and round holes spring to mind.

Yep, Apples and Oranges...You clearly prefer a code-based approach - so stick with it!
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb