[personal profile] orionsoftworks
I recently discovered the advantages of Lua while doing research and doing some reading regarding ToME development. I've known about Lua in name only, but hadn't taken a long look at it until I noticed how much ToME relies on it.

It's an interesting approach and I'm excited about the capabilities to embed scripting abilities into Middlecrest. I've always envisioned the core of Middlecrest to be a library (or engine, of sorts) and this seems to be able to push the direction of the project more into that realm. I can also imagine that as Middlecrest grows, the sheer amount of source to compile will become an unwieldy time sink.

I've identified modules to begin scripting. Transitioning the code into a model where Lua becomes the logic of Middlecrest and C/C++ becomes the engine/driver of the lua modules will take some time. And I'm not sure I will be masterful enough with Lua to be able to convert everything over and compartmentalize things the way I want. I'm not sure enough bindings and support are available for Lua and the language itself is a little wonky.

Bindings for Lua and SQLite seem to be only partially implemented for version 3 (the best I've found so far is a project at 0.7) and seems to require a dll (trying to stay away from Windows-only setups for easier porting... I've been successful so far!). Lua is really high-level and so I'm not sure I will have such a fine control over the program as I have with C and C++, which limits me and I've been unsuccessful at being able to call C++ functions from Lua (which you should be able to... but, I'm still learning Lua). Tutorials are sparse, although documentation seems fair but spartan. And Lua has some wonky aspects to it that are interfering with the learning curve, like having to call the rng function twice on Windows machines, else no random number generation. Things like the rng issue aren't properly documented and probably only known to Lua gurus (or hours of googling and a lucky hit).

All these things may mean the ideal set-up of C/C++ (driver/engine), Lua (game logic), SQLite (data) may be more hybridized (C/C++ and Lua as the engine/driver and logic, and SQLite for data).

May have to see if there are other embeddable and interpreted languages out there for C++?

Date: 2011-02-24 12:29 am (UTC)
winterkoninkje: shadowcrane (clean) (Default)
From: [personal profile] winterkoninkje
You may want to shy away from doing too much of the implementation in Lua. Lua's really designed for being a scripting language to add plug-n-play functionality to games/programs, and I'm not sure how well it'd work for coding the core logic of a game. Of course, not all "game logic" is "core logic" so it may be fine for the rest of things but, as you say, it's not going to give you the control you need for hardcore programming (as far as I'm aware).

Date: 2011-02-24 12:31 am (UTC)
winterkoninkje: shadowcrane (clean) (Default)
From: [personal profile] winterkoninkje
As for calling into C++, you may need to do the standard trick to export your C++ functions as C functions. Dunno. Linking against C++ is a nightmare and so most languages will only give C inter-op.

May 2012

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Oct. 17th, 2017 01:26 pm
Powered by Dreamwidth Studios