Sorry for my writing mistakes, English is not my native language.
I think it is better to do without creating a different syntax for various types of files.
To clarify, the syntax of the files themselves will not be any different*. All that will change between, say, a player script file and an enemy script file is one line at the top of the file that says whether it's a player/enemy/etc script. To illustrate, a player script file may start out like this:
Musuu
Script[mdScript]
Type[Player]
... while an enemy script file may start out like this:
Musuu
Script[mdScript]
Type[Enemy]
This
Type tag would allow the program to distinguish the different script types, and allow it to preset the user with a list of just the appropriate script types the user is looking for at the moment (for instance, the player would most likely select an enemy or game script to face first, then pick a player script to face it with).
Another header option I think we may want to include is
Name, which will give the script a name for in the script file selection menu (as opposed to showing just the file name, which is all it can do at the moment).
As part of this, I also have the idea that we should, rather than expecting a fixed number of headers, instead just allowing as many header lines, and requiring a blank line to indicate the end of the header lines (it looks good syntactically, anyways). This allows headers to appear in any order (except the first line needs to be
Musuu), and it also allows headers to be optional. Leave out the
Name header, and it'll default to showing the filename in the menu. Also, it could be set up so that, if you leave out the
Script header, it'll assume you're using
mdScript.
* Note that, using a different
Script header will select a different scripting language. The only defined languages at the moment are
mdBase, which should never be used for anything serious, and
mdScript, which is the "standard" scripting language for Musuu no Danmaku.
One idea is that, in the future, we'll be able to have plugins that define other script languages for Musuu no Danmaku to read in; perhaps someone will even step up to the challenge of writing a Danmakufu interpreter (I feel sorry for whoever pushes that one on themselves :V).
Over the last couple of days, I created a prototype, based on the V8 javascript engine. This is an example of danmaku-engine, in which almost all operations are stored in the interpreted files. This is what I would like to see in your program.
In addition, you may be interested in using the v8, sdl_ttf and openil libraries.
http://www.mediafire.com/?2mzzjljjrkn -- an executable file with some scripts.
http://www.mediafire.com/?z05wyzwdmhn -- source code and libraries for VC++ 2008
I'm not at my main computer right now, so I can't really check these out (plus, mediafire tends to hate me, so I'll probably have a bit of trouble downloading the files anyways >__>).
Looking up the named libraries ...
v8 - a Javascript library. This project uses its own scripting engine, with its own script file formats, so (at least currently) I don't think there's any place for Javascript. Blargel's danmaku engine project (which has its own thread somewhere around here, that hasn't been bumped in forever apparently) is using Javascript for scripting, but I think they're using a different Javascript engine.
sdl_ttf - SDL font library. I think this only works when using SDL's graphics handling methods; Musuu no Danmaku uses OpenGL, and right now it interfaces FreeType to get font data.
openil - image library. This might come in handy if we can interface with it. A quick google search shows that it is
supported by the Tao Framework, which makes it look promising. If I can figure it out, there's a good chance it'll be more efficient than the current image loader code, which goes through
System.Drawing.Bitmap.
I was just thinking about how we would handle scripting the equivalent of Danmakufu's Plural scripts, and here's the idea I came up with - a simple, scripted object which defines the lifebars and scripts to load. Here's a sample of what I had in mind:
Musuu
Script[mdScript]
Type[Plural]
Name[EX Chen]
Plural "exChen"
{
initialize
{
// set up the lifebars. This array of arrays is explained below
SetLifeBars([[80, 20], [80, 20, 20], [20]]);
// set up the scripts. Also explained below
SetScripts([["ex_Chen_nonspell_1.txt",
"ex_Chen_spell_1.txt"],
["ex_Chen_nonspell_2.txt",
"ex_Chen_spell_2.txt",
"ex_Chen_spell_3.txt"],
["ex_Chen_spell_4.txt"]]);
}
}
The first command,
SetLifeBars, defines the number of lifebars, the number of scripts in each lifebar, and the relative size of lifebar for each script. The second command,
SetScripts, defines the scripts for each component of each lifebar. So, for example, the above script defines the following:
- 1st life bar (80 + 20 = 100 total "length")
- ex_Chen_nonspell_1.txt - 80 "length" (80%)
- ex_Chen_spell_1.txt - 20 "length" (20%)
- 2nd life bar (80 + 20 + 20 = 120 total "length")
- ex_Chen_nonspell_2.txt - 80 "length" (66.7%)
- ex_Chen_spell_2.txt - 20 "length" (16.7%)
- ex_Chen_spell_3.txt - 20 "length" (16.7%)
- 3rd life bar (20 total "length")
- ex_Chen_spell_4.txt - 20 "length" (100%)
For each lifebar, the bar will be divided based on each script's "share" of the total length.
The advantage to this script format is that it allows the scripter to easily change things based on certain variables. For instance, you could use your global
difficulty variable to determine whether or not to switch out ex_Chen_spell_4.txt for ex_Chen_spell_4_plus_ohmygodwhatisthis.txt if the player is playing on Lunatic, or even cut out ex_Chen_spell_3.txt entirely if they're playing on Easy.
At the same time, I do think a simple format may be useful as well. We could also define another script "language" which more closely mimics Danmakufu's style of defining Plural scripts, such as with this sample:
Musuu
Script[mdPlural]
Type[Plural]
Name[EX Chen]
// First life bar
// The number at the beginning is each script's contribution to the lifebar length
80 ex_Chen_nonspell_1.txt
20 ex_Chen_spell_1.txt
// Next life bar
next
80 ex_Chen_nonspell_2.txt
20 ex_Chen_spell_2.txt
20 ex_Chen_spell_3.txt
// Next life bar
next
20 ex_Chen_spell_4.txt
(Note that the
Script header indicates
mdPlural rather than the usual
mdScript)
This syntax has the advantage of being simpler, while sacrificing some of the potential that the previous idea has. Of course, both can be implemented side-by-side, but I'm wondering what you people think about them?
We should consider how these ideas would play in with the future idea that we'll be able to customize the lifebars ...
Also, we could have it allow the scripter to specify a color for each lifebar segment.
(PS - in case you guys forgot, I'm back on my usual too-busy-during-the-week schedule
)