River Nyxx

A development blog for FFVI3D, the fan-made Final Fantasy VI remake in 3D.

平成20年10月17日金曜日

< /Summer >

Okay, so now with Summer out of the way, I'm starting to have more time to program again-- the summer festivities always tend to take away from that.  I still have to survive thru Halloween, as the costume/party preparations are still taking up a bunch of my time, but that's just like summer- it happens every year.


I worked my way thru a bunch of memory leaks (one of which had me pulling the entire engine apart to find it!) and other boring stuff that won't really interest anybody, but while doing so, I've had more time to reflect on the class structures I've got in the current iteration of the battle state.  I'd have to say that as things stand right now, I'm really not happy with how it all works together- it's just too messy, and horrible to read/maintain.

So I've decided I'm going to rewrite the classes for handling actions in battle, and am seriously considering rewriting large portions of my script class to add more versatility to it.  I've learned from reverse engineering another game in a side project of mine, of some other methods to load scripts into RAM that will provide easier access to various things such as variables, etc..

Battle actions will be rewritten in such a manner so as to be more generic, and modular.  This'll not only provide me with reusable code, but also an easier means thru which I can add more actions to any "battle" in whatever game it is that I'm programming.  This class is going to be quite powerful in that it can accept actions that do virtually anything in the game, but all thru a generic interface that makes the custom actions rather easy to write and plug-in, quite possibly by means of my script class as well, but we'll burn that bridge when we come to it.

All that said about the future, what have I actually done lately?  Sadly, not much- but I -have- already started taking steps towards the rewriting of the battle actions handler, in that I've written some base classes and gotten it basically "working", although not really tied into the engine properly yet.  That'll all come with time.

ラベル: , , , , , ,

平成20年3月1日土曜日

Script Manager down, who's next?

So, the 2nd iteration of my Script Manager is up and running now. Everything is working beautifully, it's fully recursive, which means I can have expressions with parentheses, and math in function parameters, etc.. It also looks a LOT like C++... the only really noticable difference is that I don't use curly braces ( "{" and "}" ) anywhere, and opted to instead go for a "if/endif" and "while/endwhile" route instead. Other than that, it looks quite a lot like C++, function definitions, etc.. Well, I guess more appropriately, it would be closer to C, since my scripting language doesn't support objects, but whatever.

So this is the final test script I was running to make sure everything was working fine (and it is!), just so you can have a taste of what the language is capable of. Take note, that this doesn't actually make any calls to functions in the game itself, but they are fully supported (I was testing those in a different script file...)

number testFunction5(number x, number y);
number i;
i = 2 * (2 * ((1 + 1)) + 2) / 3;
print("*****FINAL RESULT*****");
print(i);
number r;
r = 5 * x * y;
r = r + 50;
r = r - 23;
r = r / 10;
string tst = "part1:";
tst = tst + "part2";
print(tst);
return(r);

void testFunction2(number num);
print(num);
num = 45;
print(num);
return;

string testFunction(string str1, number numbah);
print("Output- displays nothing since it is only useful mid-operation");
output;
number num = numbah;
print(str1);
print(32);
print(num);
print("constant text called explicitly");
expose;
return("text returned from function to main");

void testFunction3();
print("Test function 3");
return;

number testFunction4();
return(1337);

entry;
number n1;
boolean boo = false;
string s;
print("Before loop scopes:");
expose;
print("Inside loop scopes:");
while (n1 == -1 && !boo);
print(s);
s = s + "a";
if (s == "_aaa");
boo = true;
endif;
expose;
endwhile;
print("After loop scopes:");
expose;
while (n1 < 20);
print(n1);
n1 = n1 + 1;
endwhile;
while (n1 <= 40);
print(n1);
n1 = n1 + 1;
if (n1 >= 34);
break;
endif;
endwhile;
string str1 = "yay!";
string str2;
number num1;
print("Before ifelse scopes:");
expose;
if (str1 == "yay!" && str2 != "" || num1 == 0);
print("Inside ifelse scopes:");
expose;
print("Before if scopes:");
expose;
if (str2 == "_");
print("Inside if scopes:");
expose;
print("true");
endif;
print("After if scopes:");
expose;
else;
print("false");
endif;
print("After ifelse scopes:");
expose;
number num2 = 100;
str2 = "text";
num1 = 50;
string str = testFunction("text passed to function and thus is stored in variable", 42);
testFunction2(3);
testFunction3();
number ret = testFunction4();
print(ret);
print(str);
number n = testFunction5(num1, 23);
print(n);
boolean b = true;
number nr = 1.5;
print(nr);
expose;
end;
Of course, all of the variable names, constant values, etc.. are all random and make no sense whatsoever, as they were only being put in to test specific constructs in the scripting language itself. As far as the scripting language itself goes, there's only 3 things I'm currently considering still putting into it: do/while loops (which we can do without, as we have a basic while loop...), and for loops (which we can also do without, but it would be less scripting for a simple type of loop, if it was implemented), and lastly, a means to have the script wait for something in-game to occur, and trigger the script back into action again to finish off. The main thing I'll need this for is to implement in-game cutscenes, so I can have a script (for example...) tell a character to walk north 10 meters, at which point the script will wait until the character arrives at that point, at which time the script could continue to tell that character to say something, or some such.

Now I'm quite firmly involved in finishing off all the little notes I left for myself in my code months ago. With all those little things done, I'll be working on the battle state.

ラベル: , , , , , ,

平成20年2月12日火曜日

Script Manager is live!

I've now got a working (albeit just barely) script manager implemented into FFVI3D. It's composed of a virtual machine that interprets opcodes that are all linked in sequence in a script object, for the most part. It also acts as (currently) a dumb interface to simply execute a script by name (as saved in the script file).

The scripts are saved in a pseudo-XML format, in that some script parameters are stored in XML, but the main part of the file, the script, is stored as plaintext inside an tag. The scripting language I've created for FFVI3D is currently pretty limited, as I still have yet to implement a lot of the major things in it. But the opcodes are there and accepted fully by the virtual machine, it's just that the parser doesn't yet convert script into opcodes for everything yet.

A simple exaple of a script that I have currently, which I was using for testing is this:



function test(string:text);
print:text;
print:"const text";
return:"arg";

entry;
test("var text");
print:"return text";
end;


So as you can see, it currently supports defining in-script functions, and some simple print-to-console commands. It also supports other commands such as one to show a gui layout by name, one to hide the current gui layout, etc.. but they aren't in that test script.

I'll be spending the next couple of days implementing the remainder of the major parser script-to-opcode conversions, and an automated means thru which an object in my code can contribute any number of it's own functions to the list of available functions, as well as automated means for the parser to know/use them.

With that outta the way, I'll be going back to my to-do list, knocking off the remainder of the small stuff that I had to touch up in my reworking of the code. This scripting thing was by far the largest thing on that list, so the rest of it should go pretty quickly.

On the horizon: I'm going to start seriously looking at managers required to start a battle game state. In the coming weeks/months, I think we can look forward to a battle state slowly starting to show it's ugly head in the works, which will be the first _REAL_ visual experience of FFVI3D- I'm all excited about that^^

ラベル: , , , , , , ,

平成20年2月4日月曜日

A setback, and starting with new things...

So I spent most of last week working out some way to effectively change the resolution of FFVI without having to quit and restart. You see the issue is that with the Irrlicht Engine, you cannot dynamically change the resolution and everything will be fine. You have to actually properly shut down the IrrlichtDevice and create a new one with a different resolution setting.

I spent about 3 or 4 days working some code in to make sure everything that needed to know the device was going to change, knew.. but it started getting to the point where I was writing a hack to make a hack work so it would hack another hack into making the whole thing work. Not even close to clean. I can deal with some hacks, as they tend to be temporary, but this was just getting rediculous, and I knew some of them just couldn't possibly be temporary.

So I scrapped everything I had done in that direction and looked at it from a different perspective after taking a small break. In a matter of 2 nights, I wrote up a new means thru which to not only effectively, but CLEANLY do what I wanted to, and I proceeded to work out all the memory leaks, and all now looks well^^ I'm quite happy with how my code turned out.

After that, I went thru my to-do list, cleaning up a buncha stuff that got dirty while I was doing all this, and got back down to the major points on the list again. The 2 things that really stuck out was to go back thru my code and fix everything that I had left notes to myself to fix, and to implement a means thru which the various menu items could actually DO something. (Technically, the latter is a member of the former, but ah well...) This menu item action thing is actually the last piece I need to implement to have 100% of my previous code working again, but it's actually going to take a bit before I get them working again, as I'm going to do it properly this time.

And the new thing! I am now writing a virtual machine to execute external scripts. These scripts will be specific to FFVI3D, but will be easy enough to figure out. They'll likely be in a similar style to BASIC, but I might go so far as to make them feel more like C/++.. Not that any of this will matter to the player, but it'll be a LOT easier for when I get around to putting some events/ingame cutscenes/etc.. in. I'll also be using scripts to define what each menu item will do when selected. But I really haven't gotten far into this yet, so I'll update later on it.

ラベル: , , , , , , , ,