Click here to view on YouTube to go fullscreen and HD
Two updates in one day! Here we have the Items update, featuring scripted items and the new equipping windows. Also of note is the new colored text system, which simply *1works like this.*0 The *1 would set the text color to orange, then the *0 would set it back to white.
The next update will probably be another combat one, in which I actually do what I set out to do when I took this detour, which is have weapon graphics display in combat. Ranged attacks should also be pretty easy to implement now as well.
Saturday, October 30, 2010
SFPC Editor Demo Video
Part 1: Click here to view on YouTube to go fullscreen and HD
Part 2: Click here to view on YouTube to go fullscreen and HD
These are long overdue! Here you can see how I use the SFPC editor to create maps and script events. I'd like to believe that this system is simple enough that a novice could dive right in and be making maps pretty quickly given a little time, documentation, and encouragement. Part of the building up of that "documentation" is videos like this.
Part 2: Click here to view on YouTube to go fullscreen and HD
These are long overdue! Here you can see how I use the SFPC editor to create maps and script events. I'd like to believe that this system is simple enough that a novice could dive right in and be making maps pretty quickly given a little time, documentation, and encouragement. Part of the building up of that "documentation" is videos like this.
Sunday, August 22, 2010
SFPC - August Combat Test Video #5
This week the big new feature is combat animations! They're still pretty basic, no weapon graphics yet, I need to improve the item code a lot first before that happens, but aside from all the punching going on, things look pretty good!
Monday, August 16, 2010
SFPC - August Combat Test Video #4
Another productive weekend! Lots of bug fixing, under the hood changes, and asset ripping, but a handful of new stuff as well, hence the video. Scrolling text may look simple to the untrained eye, a little thing we all take for granted, but it took a good bit of work to get it looking right and behaving alongside everything else. Battle movement has also received a tune up, characters can move through (but not stop in) squares occupied by allies, and enemy squares are excluded from movement range calculations.
Sunday, August 8, 2010
SFPC - August Combat Test Video #3
Another month, another video! Usually I code for an hour or two here and there, typically in the morning before work, but today I got totally in the zone and put in something like 10+ hours! Got so much done! Combat is in a much better state now, cleaned up the existing battle code a ton, the new system is a lot more robust and easier for me to expand upon. New features since last time include:
- Battlefield Land Effect and Stats windows
- Basic Cutscenes (no character animations) with fade transitions
- Auto-advancing text windows in cutscenes
- Critical hits and double attacks
- Music switching into and out of cutscenes
I also made tons of changes behind the scenes I won't drone on about, but one last thing worth mentioning that I did start on was damage types (physical, fire, cold, etc). They're not taken into account for resistances or anything just yet, but the skeleton is there!
Obviously the next big milestone is going to be combat animations. Ideally I can have basic animation up and running for the next video, hopefully before September, but we'll see how things go. I also have lots of research ahead of me on getting my numbers right for calculating hits, misses, damage, special attack rates, and so on. Heck, I might be open to taking on a volunteer to help do a lot of that kind of digging for me. If anyone's interested, shoot me an email or leave a comment!
Friday, July 16, 2010
SFPC - July Combat Test Preview Video #2
So, more updates, more often. Check!
Finally something that actually resembles very basic but functional combat! My numbers are still way off, I'm sure, but I now have:
- The basic Attack/Magic/Item/Stay menu is functional. Magic and Item do nothing, a lot of work needs done before they come online, but Stay and Attack are up and running as you can see above.
- Units can attack each other, do damage, and are removed from the battlefield when they run out of hit points.
- The battle ends when there are no enemies left on the field, which you can see when the debug info goes away at the end of the video.
Other than all the stuff left to do, what I really need right now is more accurate formulas. None of the FAQs I have sifted through so far have the kind of info I need, at least not at first glance. For now, I'm essentially rolling 1d20 behind the curtain to see if an attack hits. A 20 is a crit (5%), a 4-19 is a hit (80%) and a 1-3 is a miss (15%). Damage right now is just attacking character's Atk minus defending characters Def, +/- 1. I still need to work counterattacks and double attacks into the mix as well, implement gold and how much gold an enemy is worth, how to award EXP, leveling up... so much left to do, but at least it's coming along.
If anyone has the exact formulas any of the SF games use, or can point me to a good resource that would save me a lot of time and effort doing research replaying parts of the original games over and over and over, please, let me know!
Friday, July 9, 2010
SFPC - July Combat Test Preview Video
I wouldn't call this the official July video, but I felt like seeing if I could do a quick video this morning and maybe try having smaller videos more often. I had to quickly reinstall VirtualDub and FRAPS first this morning since I forgot to reinstall them when I put together my new PC, and the video compression settings were a little off so the video quality is not where I usually like it.
Anyway, this primarily shows off the range checking code. I've tested it on ranges up through 5 and it works fine, but I just have it set to do a plain melee range check for the video. The game loops through the established initiative order, which is currently just all characters in the battle sorted based on agility. (Is this correct? I don't know! Feel free to chime in below in the comments!) The code looks for any potential targets within range and just lists them in the debug info. Note that the Dark Dwarves are not AI controlled at this point, that's still a ways off, I'm pulling all the strings here with the keyboard. They are, however, on the enemy team. You'll notice for instance when Sarah does a range check near the end of the video, it does not list Bowie or Chester as valid targets. Only units on the opposing team will show up on the target list.
I've been dragging my feet on doing the next post on the scripting system, I should work on that soon. As a hint for the question from last time: what happens to the chest when you leave the map and return later? Also on that note, from the comments, BNC was right about the chest-opening music, and I didn't even think of that part! I'll have to work that in eventually, too.
Friday, June 18, 2010
SFPC Scripting - Treasure Chest
So as I mentioned in my last post on the new features in the June update, SFPC now has its own scripting language used to build content for the game. Here's a basic script for a treasure chest from the demo:
!SFPC_Script "Chest 1 - Long Sword"
# Only runs after the chest has been opened.
FlagNeeded "Castle1_Chest1"
DialogueWindow "BOWIE looked in the chest.^It was empty."
End
NoFlag "Castle1_Chest1" # Only runs if the chest is still closed
SetOverlayTile 27 44 49
PlaySound "open-chest.ogg"
AddItem "Long Sword" "opened the chest."
SetFlag "Castle1_Chest1"
End
Let's break it down line by line:
!SFPC_Script "Chest 1 - Long Sword" - The opening !SFPC_Script just identifies this as a valid SFPC script file. The "Chest 1 - Long Sword" in quotes is the name of the script that gets shown in the editor when placing events. For instance, the many empty barrels that are scattered about the map all run the same script. If I place a few barrel tiles on the map then write a script for them, I only need to do it once, then I can place as many empties as needed, and I can flip back through the list of events easily to get back to that script and just place more copies later as the map expands.
# Only runs after the chest has been opened. - The # signifies that this and everything past it on this line is a comment, similar to // in C++ or /* */ in C. The scripting engine ignores everything else on a line after it hits a #. As can be seen later in this same script, this doesn't have to be the only thing on the line, comments can be at the end of a line after other script commands have already been run.
FlagNeeded "Castle1_Chest1" - Checks to see if a flag named "Castle1_Chest1" has been set or not. First, a quick aside about "flags". The game engine keeps a collection of flags, which are just strings of letters/numbers/etc. Any string of characters between quotes can be a flag. They're kind of like boolean true/false variables. Back to FlagNeeded! This command asks the engine to see if a flag named within the quotes exists. If it does, move forward and run the script commands on the following lines. If the flag has not been set, ignore all commands from here until the next End statement, which in this case is two lines down. The indentation on the commands that follow is optional but helpful, it keeps the script readable and helps show at a glance where one conditional statement like a FlagNeeded begins and ends.
DialogueWindow "BOWIE looked in the chest.^It was empty." - A DialogueWindow is a single window that shows up on the bottom of the screen for displaying text that draws in one character at a time. The text in the window is processed automatically to wrap from one line to the next. The manual '^' tells the string processor to show the paused text triangle at that point and wait for user input before clearing the window and showing more text.
NoFlag "Castle1_Chest1" - Similar to FlagNeeded, NoFlag checks to see if the flag in quotes is set and only runs the code between itself and the next End statement if the flag is NOT set.
SetOverlayTile 27 44 49 - Places the 27th overlay tile in the current tileset at coordinates 44x, 49y on the map. The top left corner of the map is 0, 0. Similar commands exist for SetBackgroundTile and SetForegroundTile. The draw order, from bottom to top, is Background, Overlay, characters, Foreground.
PlaySound "open-chest.ogg" - Pretty self explanitory, the AudioMgr code plays the requested sound. In this case it's an ogg vorbis audio file, but since I'm using Audiere for my sound lib at the moment, it can also play .wav or .mp3 files as well. The sound plays one time and is not looped.
AddItem "Long Sword" "opened the chest." - Runs the AddItem command, adding the item specified in the first parameter with the text in the opening DialogueWindow from the second parameter. If we were looking in a vase the text would be something like "looked in the vase." but it could just as easily say "checked inside the fireplace." or "searched behind the painting." or any number of options depending on the situation. The AddItem code then goes on to attempt to add the selected item to each character's inventory until it finds someone who has room to hold it, or gives up if everyone is full. I still don't have a working solution yet for the fringe case of opening a chest if the party has no room whatsoever (though I do have some ideas), currently in that case the item is lost for good and the chest remains open, but eventually the item will have to be put back in the chest and the chest will need to be closed back up again.
SetFlag "Castle1_Chest1" - I've already touched on the checking of flags, this command simply sets the specified flag to exist and be set to true.
Now, let's go back and put it all together and spell the whole thing out in english! If the flag Castle1_Chest1 has been set, we know the player has already opened the chest, so if they interact with it, just show that it is empty. If the flag was not set however, the item is still in the chest, so let them have it. Replace the closed chest tile with the open chest tile (27th in the overlay tileset), play the open chest sound, run the AddItem command to actually give the party the item and make sure someone with a free hand gets it, then finally set the Castle1_Chest1 flag so that this chest stays empty. It's a chest, not a sword dispenser, after all.
There's one thing missing here though, which I leave as an exercise for the reader. Point it out in the comments, and I'll cover what's missing in the next post on scripting for SFPC!
!SFPC_Script "Chest 1 - Long Sword"
# Only runs after the chest has been opened.
FlagNeeded "Castle1_Chest1"
DialogueWindow "BOWIE looked in the chest.^It was empty."
End
NoFlag "Castle1_Chest1" # Only runs if the chest is still closed
SetOverlayTile 27 44 49
PlaySound "open-chest.ogg"
AddItem "Long Sword" "opened the chest."
SetFlag "Castle1_Chest1"
End
Let's break it down line by line:
!SFPC_Script "Chest 1 - Long Sword" - The opening !SFPC_Script just identifies this as a valid SFPC script file. The "Chest 1 - Long Sword" in quotes is the name of the script that gets shown in the editor when placing events. For instance, the many empty barrels that are scattered about the map all run the same script. If I place a few barrel tiles on the map then write a script for them, I only need to do it once, then I can place as many empties as needed, and I can flip back through the list of events easily to get back to that script and just place more copies later as the map expands.
# Only runs after the chest has been opened. - The # signifies that this and everything past it on this line is a comment, similar to // in C++ or /* */ in C. The scripting engine ignores everything else on a line after it hits a #. As can be seen later in this same script, this doesn't have to be the only thing on the line, comments can be at the end of a line after other script commands have already been run.
FlagNeeded "Castle1_Chest1" - Checks to see if a flag named "Castle1_Chest1" has been set or not. First, a quick aside about "flags". The game engine keeps a collection of flags, which are just strings of letters/numbers/etc. Any string of characters between quotes can be a flag. They're kind of like boolean true/false variables. Back to FlagNeeded! This command asks the engine to see if a flag named within the quotes exists. If it does, move forward and run the script commands on the following lines. If the flag has not been set, ignore all commands from here until the next End statement, which in this case is two lines down. The indentation on the commands that follow is optional but helpful, it keeps the script readable and helps show at a glance where one conditional statement like a FlagNeeded begins and ends.
DialogueWindow "BOWIE looked in the chest.^It was empty." - A DialogueWindow is a single window that shows up on the bottom of the screen for displaying text that draws in one character at a time. The text in the window is processed automatically to wrap from one line to the next. The manual '^' tells the string processor to show the paused text triangle at that point and wait for user input before clearing the window and showing more text.
NoFlag "Castle1_Chest1" - Similar to FlagNeeded, NoFlag checks to see if the flag in quotes is set and only runs the code between itself and the next End statement if the flag is NOT set.
SetOverlayTile 27 44 49 - Places the 27th overlay tile in the current tileset at coordinates 44x, 49y on the map. The top left corner of the map is 0, 0. Similar commands exist for SetBackgroundTile and SetForegroundTile. The draw order, from bottom to top, is Background, Overlay, characters, Foreground.
PlaySound "open-chest.ogg" - Pretty self explanitory, the AudioMgr code plays the requested sound. In this case it's an ogg vorbis audio file, but since I'm using Audiere for my sound lib at the moment, it can also play .wav or .mp3 files as well. The sound plays one time and is not looped.
AddItem "Long Sword" "opened the chest." - Runs the AddItem command, adding the item specified in the first parameter with the text in the opening DialogueWindow from the second parameter. If we were looking in a vase the text would be something like "looked in the vase." but it could just as easily say "checked inside the fireplace." or "searched behind the painting." or any number of options depending on the situation. The AddItem code then goes on to attempt to add the selected item to each character's inventory until it finds someone who has room to hold it, or gives up if everyone is full. I still don't have a working solution yet for the fringe case of opening a chest if the party has no room whatsoever (though I do have some ideas), currently in that case the item is lost for good and the chest remains open, but eventually the item will have to be put back in the chest and the chest will need to be closed back up again.
SetFlag "Castle1_Chest1" - I've already touched on the checking of flags, this command simply sets the specified flag to exist and be set to true.
Now, let's go back and put it all together and spell the whole thing out in english! If the flag Castle1_Chest1 has been set, we know the player has already opened the chest, so if they interact with it, just show that it is empty. If the flag was not set however, the item is still in the chest, so let them have it. Replace the closed chest tile with the open chest tile (27th in the overlay tileset), play the open chest sound, run the AddItem command to actually give the party the item and make sure someone with a free hand gets it, then finally set the Castle1_Chest1 flag so that this chest stays empty. It's a chest, not a sword dispenser, after all.
There's one thing missing here though, which I leave as an exercise for the reader. Point it out in the comments, and I'll cover what's missing in the next post on scripting for SFPC!
Tuesday, June 15, 2010
SFPC - June Update
So here it is, the next big update. So much has changed since April, here's a list of some of the big stuff:
- Audio: music and sounds now work. Currently using the Audiere sound library, but that could change down the road.
- Events: In the previous demo, I explained that I couldn't handle events that contained multiple commands yet. That limitation has been dealt with by implementing...
- Scripting Engine: Way back in the day, while I was just a comp sci undergrad, I worked with Nathan Yam creating levels and scripts for our RPG clones, Dream Quest 2000, Dream Saga, and DWPC. The scripting system I have put together for SFPC is based on my experience working with the DreamVision scripting language Nathan created. Other than a very similar scripting syntax, however, it is entirely my own code.
Many game aspects are assembled via scripts: NPCs, party members, events, game startup, map startup. Eventually even more systems will be handled via scripting, like items and spells, but for now those systems are hard coded. I'll be writing some separate posts about the scripting system and showing off some examples.
- Flag System: a backbone of the scripting system is the Flag system. A script can set and check for the presence or absence of flags and then run or not run commands accordingly. This opens up a ton of potential.
Keep an eye out for some scripting examples to be posted soon!
Tuesday, April 13, 2010
SFPC - April Update
Another new video showing progress on events. Currently events are simple, single commands. I have a plan to upgrade to complex multi command events, and hope to have that done and a video uploaded soon.
Subscribe to:
Comments (Atom)