Skip to main content

User login

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password
Register
  • Home
  • Browse
    • 2D Art
    • 3D Art
    • Concept Art
    • Textures
    • Music
    • Sound Effects
    • Documents
    • Featured Tutorials
  • Submit Art
  • Collect
    • My Collections
    • Art Collections
  • Forums
  • FAQ
  • Leaderboards
    • All Time
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
    • Weekly
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
  • ❤ Donate
FLARE [ARCHIVED]

Config File Support and Scripting Integration

lefticus
Monday, March 21, 2011 - 10:29

Hi, I'm one of the primary developers for ChaiScript, a free/oss scripting engine for C++. I noticed that one of your todo items is for config file support. I would like to offer my assistance in integrating ChaiScript into your game engine.

Config files are a somewhat "obvious" use of ChaiScript because of its simplicity, but it could be used in any other part of the game for things you want to provide runtime scripting of. The only down side is that it can be rather expensive (CPU time, RAM) at compile time. At runtime, it's pretty lightweight and would likely not be noticed at all. 

Another potential downside is that it would add boost (headers only, no libs) as a requirement to your project.

Let me know if you are interested

-Jason

  • Log in or register to post comments
Clint Bellanger
joined 15 years 10 months ago
Monday, March 21, 2011 - 10:54
Clint Bellanger's picture

lefticus,

Right now the config file support I need is utterly simple, so I'll probably stick with my current system for a bit longer.

When I get into translation support, though, I might be looking at scripting languages that support unicode config files.

  • Log in or register to post comments
lefticus
joined 14 years 3 months ago
Monday, March 21, 2011 - 11:08

Ah. Well we don't support Unicode directly yet. If you still want help at some point with runtime scripting of the engine, let me know.

-Jason

  • Log in or register to post comments
Anonymous (not verified)
joined 0 sec ago
127.0.0.1
Thursday, April 7, 2011 - 13:03

 

It would be nice to have scripting language, but i believe it would be better if it's a well known and widely spreaded (to lower entry-barrier for new developers and don't force them to learn additional unknown stuff)

Something like Ruby / JavaScript / Lua / Python. And similar simply and well-known formats for config YAML / JSON / ....

Or even go deeper and provide some kind of pluggable interfaces to connect any scripting language.

---

Alexey Petrushin

 

  • Log in or register to post comments
wokste
joined 14 years 3 months ago
Friday, April 8, 2011 - 03:08

To be honest I think that a nice implemented scripting language also has many advantages.

However, it is difficult to implement. (I have no experience with implementing scripting languages).

A scripting language could be usefull if it implemented for many parts. I can think of:

  • Special effects for monsters, items and the like.
  • Status effects.
  • Triggers in the map.
  • Mods (But not at the beginning).

Statements should be able to:

  • Increase / decrease stats like HP, MP and Gold
  • Show messages on the screen.
  • Add and remove inventory.
  • etc.

In my opinion we should probably include a scripting language, but only after we have discussed a lot about how to do it.

Steven

  • Log in or register to post comments
CyberTroll
joined 14 years 8 months ago
Friday, April 8, 2011 - 11:28

Hi !

 

May be I am completly wrong, but I don't understand why scripting language seems to be so important, Flare is an engine so people could do everything they want : add/remove effect, power, dialog, map etc... or create a complete new mod/game.

Moreover  the way Flare is done make improvements/changes easy to do. So why add a scripting language to flare ? may be somebody could explain me ?

  • Log in or register to post comments
wokste
joined 14 years 3 months ago
Friday, April 8, 2011 - 13:47

CyberTroll said

Flare is an engine so people could do everything they want

That is a very large statement.

At this moment, item properties, triggers and powers are implemented seperately. If we could do the large task of adding a scripting language, we could merge implementations.

  1. Basically, if a power can do 10 fire damage, then if that is implemented with a scripting language, it can probably also be implented in equipment, status effects and triggers.
  2. With a scripting language it is also easier to add multiple effects on specific things. Eg, in the current implentation, it is possible to make a potion to give HP or one that gives MP but not both. This would be different if it was done in a scripting language.
  3. A scripting language supports if, for and while structures. This allows for unique properties that the designer could never have thought of.

If you want I can try to make some sample scripts, just to add some understanding.

  • Log in or register to post comments
CyberTroll
joined 14 years 8 months ago
Friday, April 8, 2011 - 14:11

Ok, make sense ! thanks for the reply

  • Log in or register to post comments
Anonymous (not verified)
joined 0 sec ago
127.0.0.1
Sunday, April 10, 2011 - 17:15

> To be honest I think that a nice implemented scripting language also has many advantages.

> However, it is difficult to implement. (I have no experience with implementing scripting languages).

I don't get it, why to reinvent bycicle? This question has been solved years ago, there are tons of scripting languages for any taste.

Alexey Petrushin

  • Log in or register to post comments
Clint Bellanger
joined 15 years 10 months ago
Sunday, April 10, 2011 - 18:42
Clint Bellanger's picture

A scripting language essentially turns game code into data -- to change major functionality of the game, the modder doesn't have to recompile.  This allows modders to do things that the game creator has not planned.

I definitely would use an existing scripting language (e.g. Lua).  But it's not zero effort to build an engine around a scripting language -- it takes effort tying in the core engine code (usually fast C++ render routines) to high-level script functions.

I would think that an engine built for scripting should be built that way from the ground up.  Thus, Flare is not a good candidate at this point -- it would require rewriting basically everything, and reimplementing most of it in script.

The method I've chosen for Flare (1.0) is having crude .ini style files to toggle built-in options.  It is slightly easier to manage than most scripting languages, for modders with zero code experience.  But of course it's not as flexible for advanced modders.

From the beginning of this project I've seen Flare as having a very narrow goal: the ability to do single player action rpgs.  Even that scope is wildly massive, but sticking to that scope has gotten me a lot of momentum.  Anything much outside the scope is (1) outside my expertise and (2) outside my available time.  Anything that adds an order of magnitude of complexity to Flare 1.0 will probably be shelved, or I'll encourage others to work on a separate branch/fork.

  • Log in or register to post comments
jaderamiso
joined 14 years 9 months ago
Monday, April 11, 2011 - 05:51

Integrating a scripting language to Flare(seeing its current progress) will require reimplementing the engine. It will really be a tedious task. To be honest, I am in favor of integrating scripting to flare but then again, it's not an easy task to do. So, if someone crazy enough wants to take this tedious task, then go do it.

  • Log in or register to post comments
lefticus
joined 14 years 3 months ago
Monday, April 11, 2011 - 10:22

Integrating a scripting language to Flare(seeing its current progress) will require reimplementing the engine. It will really be a tedious task. To be honest, I am in favor of integrating scripting to flare but then again, it's not an easy task to do. So, if someone crazy enough wants to take this tedious task, then go do it.

This is why I designed and created ChaiScript. It's suited perfectly for fitting into your C++ wherever you choose to want it. I'm going to show as complete of an example as I can in this posting, and show how simple it is to use (without knowing the internals of Flare). I'm trying to make an example of the "script a potion that affects both HP and MP" mentioned above. There's clearly some details missing, like perhaps the game designer would have to register the new types of potions he's writing. Or perhaps the game engine has a certain number of different potions slots that the game designer can fill.

//userscript.chai

fun applySpecialPotion(playerdata)

{

  playerdata.HP += 10;

  playerdata.MP += 15;

}

 

//playerdata.hpp

struct PlayerData

{ int HP; int MP; };

 

//main.cpp

#include "playerdata.hpp"

#include <chaiscript/ChaiScript.hpp>

int main()

{

  PlayerData playerdata;

  using namespace chaiscript; ChaiScript chai;

  // Set up the things we care about

  chai.add(fun(&PlayerData::MP), "MP");

  chai.add(fun(&PlayerData::HP), "HP");

  chai.add(var(&playerdata), "playerdata");

 

  // Load the game designer's script file

  chai.eval_file("userscript.chai");

  // ... a bunch of stuff happens and then the player drinks our new potion

  int HP = playerdata.HP;

  int MP = playerdata.MP;

  chai.eval("applySpecialPotion(playerdata)");

  assert(playerdata.HP = HP + 10); // test that it had the affect we wanted

  assert(playerdata.MP = MP + 15);

}

 

I may be missing a detail or two, but the above should be a complete working (compilable) example of how to use ChaiScript to script player actions in a game. We tried to make it as simple as possible to use.

 

The WYSIWIG editor and the <code> tags are not playing nicely with each other, so this isn't formatted as well as it could be, but I think it's readable.

-Jason

  • Log in or register to post comments
Anonymous (not verified)
joined 0 sec ago
127.0.0.1
Monday, May 2, 2011 - 21:28

I think I can help in implementing a python into this,

I have some expirence of using swig to imbed python into c/c++ code.

 

Fruch 

(israel.fruchter@gmail.com)

  • Log in or register to post comments
scrag_10
joined 16 years 1 month ago
Tuesday, May 3, 2011 - 08:01

ChaiScript is pretty generic looking(a little google told me something about ECMA language stanard), I don't think it will be a problem for the mildly experience programmer to pick up, nor enough of a hinderance to make them go elsewhere. So I don't really think there is anything to complain about there. If it was some kind of exotic syntaxed script, it would probably be ignored, but this ain't that.

Also having one of it's developers on board probably isn't a bad thing.

that's just my 2 cents as a passer-by, I don't plan on using either though. Just my thoughts as an outsider.

  • Log in or register to post comments