Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Dec 2012
Offline Last Active Aug 18 2016 09:45 PM

#5258774 How to cope with code in different languages?

Posted by on 24 October 2015 - 12:53 AM

Hi guys,


I wanted to get some idea on how to deal with a problem I created for myself over the last few months.


I started building small games a few years ago, trying to make perfect functional copies of Pong, Space Invaders, Pacman, etc. With each new project I built on top of the same little engine, adding more stuff, and retooling it with each new game. The engine is in C++ and using DirectX.


Now, my current project, on which I've been working for nearly a year, is an RPG and I started testing stuff and building an editor for it, but this time to test a few things out quickly, I used Delphi (Pascal language) which I've been using since 1995, and I'm pretty good at it. It builds user interfaces in the blink of an eye.


But as weeks went by, I added so much stuff that I built a very feature-rich editor (map, dialogue, combat, etc), all in Pascal, complete with unit tests for game logic. I did not intend to do any serious coding in Pascal, but it was so easy that I let myself believe it was all going to work out fine. It ain't.


So now I'm stuck with wanting to expand the engine in C++, but all my game code is in Pascal, and works properly. I have a massive number of Pascal files, covering everything from AI to maps to anything else you can think of. Except the actual "run-time", the engine itself.


I have a few options I thought of, most of them are problematic, so this is where I would appreciate some insights.


I can bite the bullet and convert everything to C++, but since the game isn't complete yet, that would mean so much work...


I can use DLLs to have the engine access the game logic, but object oriented and DLLs don't play well together I think, so that's another nightmare.


I can rewrite the engine part in Pascal, and have all the code play well together. While I love Delphi and Pascal, the IDE is fickle and the rarity of Pascal code in the industry would lock me out of a lot of what's out there in term of open source, etc.


I am pretty depressed about the hole I put myself in, and if anyone of you guys have dealt with multiple languages like this, be it Pascal, or whatever else, I would appreciate some advice.