Author Topic: Feature Request: Lua Overrides  (Read 1601 times)

Satoh

  • Newbie
  • *
  • Posts: 47
    • View Profile
Feature Request: Lua Overrides
« on: January 27, 2015, 10:13:09 pm »
While I like the engine as it is, and I'm glad it works as well as it does, there are often little tweaks I'd like to make to some of the Hero's behavior.

Some of these, like changing animations, can be done sort of easily.... but changing the range of a sword strike seems to require a full source mod.

What I'd like to see is the ability to modify some things in the default behavior, from Lua.

There are also times when having a full 16x16 is a bit too large for collision, especially if you're making a game with a smaller character. (I think Link was actually 12 or 14 originally, to allow for a slight amount of wall overlap. If nothing else its a common thing in GBA and SNES games anyway.)

Allowing Lua to modify the Hero behaviors would add a lot of flexibility. Especially since all the other entities in the engine are Lua based.

What I had in mind is "Use default behavior, but allow Lua to override functions by name."
What would be less flexible, but probably a lot easier, would be redirecting the hard coded parameters like sword length (14) to a settings variable, which can be changed.

(Some of the things I had in mind to want more flexibility with are sword behavior and length, bow behavior such as nocking an arrow but not firing until the command is released, shield behavior like manually blocking, allowing for a throwing animation, which there doesn't seem to be, and so forth)


Secondly, a debug console to print messages to would be helpful for error testing.
Patience is difficult and rarely thanked, but always appreciated, and sorely missed when absent.

Renkineko

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: Feature Request: Lua Overrides
« Reply #1 on: January 28, 2015, 07:35:01 am »
About the console I can help :

If you are on linux, you can use simple "print" on your code and launch the game from a console to see them. If you are on Windows, two choices :

You compile the game yourself, and so you can use a "debug compiled version" setting the compilation as a "console application" : the terminal windows will always pop up when you launch the game, and you will see the print in your code.

If you don't compile (understandable, it's hell to get all setted ^^), you can write your own lua print function which open a file of debug, write in it and close the file. Use then an utility like "SnakeTail" which allow to monitore a file like the command "tail -f <file>" on linux. You will see your print in real time.


About the possibility to modify some setting I'm agree with you, but what I know is it's very complicated and theses modifications are in the mind of christopho, and they will probably happen one day :p Just one thing : the collisions are pixels precise in my memories, so the fact you play a character much smaller than the one from Snes should not change this.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1173
    • View Profile
Re: Feature Request: Lua Overrides
« Reply #2 on: January 28, 2015, 09:05:51 am »
It is not that complicated to allow to customize things, and actually, every new release allows to customize more things. For example, the ability to change the hero's animations (hero:set_tunic_sprite(), hero:set_animation(), etc) is recent. A lot of progress has been made in this area. In the first releases, the pause menu and the HUD were hardcoded in C++. So I completely agree with you and I will continue to allow more customization in next releases.

About the console, Renkineko is right. I develop on Linux so I have the console without any problem. It is planned to add a command-line option to choose if you want a console or not, without having to recompile the game when playing on windows.
« Last Edit: January 28, 2015, 06:46:36 pm by Christopho »

Satoh

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: Feature Request: Lua Overrides
« Reply #3 on: January 28, 2015, 06:32:10 pm »
Cool. Nice to see we're all on the same page then.

I have actually installed cmake and mingw once before, and given that experience (it took 4 days to make it work correctly because missing libraries from X distribution, no download sources for Y library, etc) it was rightly and truly a nightmare. That's the main reason I'm hesitant to try doing any of this on my own. I could probably muddle through the C++, but setting up the build environment... that's terrifying.
Patience is difficult and rarely thanked, but always appreciated, and sorely missed when absent.