Forums / Fun! / Creative

11,777 total conversations in 470 threads

+ New Thread


I tried to make a cheapo Undertale game engine.

Last posted Feb 03, 2016 at 09:30AM EST. Added Feb 02, 2016 at 07:31AM EST
14 posts from 4 users

Yes, it is I, the worst Shitposter on KYM…. if anyone even remembers me.

Well, I decided to return, since I'm working on a project that sorta needs criticism. As you can see from the title, I've tried to make an Undertale engine. It's no-where near as good as Unitale, but I tried.

And like with all games, it was made with Stencyl, which means everything was build up from scratch, which wasn't fun to make.

Timing and such for the fonts, animations, and player speed are all based off an assumption, so it may not feel "right".

Anyhow, here's the controls.

-WASD/Arrow Keys are to move.

-Z or ENTER to select or interact.

-X or RIGHT SHIFT to deny or deselect.

-C or RIGHT CONTROL are to pause, most of the menu stuff hasn't been done.

AREA SPECIFIC CONTROLS

-PAGE UP is to open the wimpy debug menu.

-Pressing 1 in the area "TEST SCENE" (the area you spawn when you create a file) will bring you to the Battle Test.

-Mouse is used to select letters when making name, thought it was faster than using the keyboard.

I am not responsible for any spoops or weird bugs that happen to you.

Last edited Feb 02, 2016 at 07:38AM EST

It appears that I forgot to set the chimney's hitbox to a tile, it's just set to nothing right now.

Last edited Feb 02, 2016 at 08:06AM EST

Made some minor bugfixes:

-You can no longer collide inside the chimney of the houses.

-Fixed bug where talking to any NPC while drawing footprints while walking would generate an infinite amount of them, causing memory leaks and lag.

-Build date has actually been updated since many revises, sorta forgot about it.

-Pressing ESCAPE will now return you to the title screen, no matter where and when.

-Fixed really stupid bug were standing between 2 NPCs would merge their text strings. Dunno how I never found this.

The speech clips are taken from the actual game, ripped from the files (Which is impossible now due to how the actual game handles files with the new update).

Sounds are picked from a group of 3, randomly as a character is drawn, this isn't as much as the actual game (which has 4-6 samples for text). Every single detail, such as textboxes drawing, movement, UI systems were all coded manually.

The 1st release was in Dec 16, 2015, and was a test area with 3 Tems and some tiles. It's really, really barebones, and I may include it in a combo pack of each revision, one day.

I've also gotten mixed reactions from different sites, the VG Resource saw it as a way to take money away from a dev who makes small games. While other places I posted it didn't really care, as they sorta saw the early versions as crap, I guess.

As long as you aren't trying to sell it as is I don't really see what the problem is, you should be fine. Building stuff out again is a great exercise anyways. (people are so bitchy about silly little projects like these…)

Like for some reason you don't exactly strike me as the type of person who would put this up on iTunes and sell it under "UNDERTALE 2: TORIEL DENTAL SURGERY" so you should be aight.

I'm actually only really doing this to learn how to code an RPG, anyhow. This is just a base for a different project that be working on after this.

If I really wanted to make a Undertale sequel, I'd just go and mod the demo, since it was built with RPG Maker, which is easy to decompile and mod unlike the final game, which was built on Game Maker Studio.

And those dental surgery/fetish games, all I can say is that is the bottom of the barrel.

Sorry for a double post, but I forgot I had these rather quirky bugs that'll take a bit to finish.

Even though you never get to talk to Papyrus, he has a bugged out font from using one I downloaded off the net, happily, I swapped from a true-type font to a proper bitmap font ripped from the game in the next update.

Enemy health bars do exist in the game, but I toggled their spawning off by default, because I dunno how to code a bar based off a math formula.

Filler wrote:

I'm actually only really doing this to learn how to code an RPG, anyhow. This is just a base for a different project that be working on after this.

If I really wanted to make a Undertale sequel, I'd just go and mod the demo, since it was built with RPG Maker, which is easy to decompile and mod unlike the final game, which was built on Game Maker Studio.

And those dental surgery/fetish games, all I can say is that is the bottom of the barrel.

Undertale plays a lot more like a visual novel than an RPG. Most of the sequences that aren't random encounters are pretty heavily scripted. But here are my protips on RPG games:

First, develop how the rules of the RPG works. Let's make a character object. We can divide this into enemy/ally characters later. Define your stats and how they interact with each other. So for example, let's say each character has the following stats:

HP. Amount of points of damage you can take before dying.
MP. Amount of points of magic you can use before empty.
Attack. Amount of damage added to an attack you initiate.
Defense. Amount of damage removed to an attack you receive.
Speed. Determines when you can attack according to the function speedOrder()

We need to define how each of them works. Above I added a definition for each.

Now, with some stats, like HP and MP, there's actually two variables responsible for these stats – current and max HP. In addition it's generally a good idea to store other stats so that you can easily reference them for stat modifier calculations. If we add that, it's also a good idea to include a counter that tracks how much that stat modifier has changed in the course of a battle without having to calculate things in reverse. That way you can apply stat boost caps and stuff like that.

I don't know anything about the language you're writing in, but if this were a Java-like language, I'd probably have each stat be an instance of a stat object, so that calculations can be calculated quickly. You can override functions like "calculate current" or "level up" easily.

We now have some basic stats laid out. Now we need to define how characters can interact with each other. We're going to do this in a global controller object of some sort.

Usually, in RPG battles, there is a WORKFLOW that defines how the battle plays out. Think of this as a diagram that illustrates what happens when you click through different menus or play the game. Let's break down Undertale as an example:

In Undertale, you have a set of options when battling. The following global effect is applied to all menus:

If there are more than 1 monster on the battlefield, have an additional menu that inputs target selection.

The following menus have the following functionality.

Fight – A small UI appears that involves a cursor moving to the right. Try to center the cursor for maximum damage. Various items change how this functions. Enemy takes damage if attack hits. Then waits for the next step.

Interact – Depending on your target, have a selection of options that change various characteristics of the enemy. Then waits for the next step.

Item – Pulls up a list of the inventory and allows the user to select an item to use. Then waits for next step.

Mercy – If conditions have been met, can let go some monsters for GOLD. Then waits for next step.

Flee – If conditions have been met, can leave the battle.

Then, the game initiates with the following logic:

If there are no enemies on the field, you win the battle, and leave the battle. Else, the enemy attacks with a pattern. This can be either pre-scripted or selected randomly out of a set of patterns.

This loop will continue until one of the following happens:
- The enemies are all gone (all spared or killed).
- Frisk is killed
- Frisk flees
- Alternate condition (script, item)

We're going to focus on the first three, since the latter is usually added after the main engine is in place. Let's call these conditions Victory, Defeat and Flee. Let's define what action occurs when these conditions are met:

Victory – Distributes GOLD and EXP received in battle. Displays any stat changes if increase in LV.

Defeat – Displays game over screen, and allows player to load from last checkpoint.

Flee – Displays flee animation and leaves the battle with no rewards.

Now that we have the basic workflow defined, we can define each step in a function, and then call each step when they occur.

The last step of this process is defining the details of the movesets. This will be a more general discussion of RPGs instead of Undertale since Undertale is a poor example of this. Most moves are defined by a few properties – power, accuracy, element, MP cost, flavor text, icon, to name a few. With the exception of the last two, we can define the effects of these attacks to change the stats we defined before. For this, it would probably be best to use a move object that calculates all these things when a value is triggered.

Finally, put all the pieces in place. Have the global controller object monitoring the following things:
Enemy[] enemyList (an array of enemies)
Ally[] allyList (an array of allies)

Then as the battle progresses, you can use the index of the array (or whatever data structure you're using) to store the value of the target, making it easy to apply damage.

Things like status effects are built out similarly, and you can add triggers for them in moves and items.

So, for example, if you want the ally to attack an enemy with ally i, enemy k and move j, you could do something like this

allyList[i].attack(allyList[i].move[j], enemyList[k])

Which is a function that takes in a Move object and a Character object, and calculates the values accordingly.

Hope this helps. I'm not sure how coherent this all is but if you have any questions feel free to drop a line.

Last edited Feb 02, 2016 at 09:17PM EST

@a blind spy: reloaded

Never thought of seeing Undertale as an visual novel than an RPG, but I guess that's sorta true.

Stencyl is a event-base language, as it's less focused on tables, and more on triggers and equations, it's really easy to learn/master, since there's a-lot of visual-based scripting to assist you.

The only time tables and lists are really used is to store text and items, the rest is pretty much hacked together with events.

Also, as for MP, Undertale did have a feature during it's alpha/beta stage, but it was removed, it was called "EN" and I really have no clue of what it was for.

The very 1st screenshot ever shown of Undertale still shows the spell feature intact, too.

The spell sprite still exists in the final game, under the name "spr_spellbt_0.png"

Sorry if I rambled, going to work on the ACT command soon.

Coding an HP bar is easy:

First, have a sprite for the HP box. Then draw a rectangle relative to the sprite's position, over the sprite, that has a length that's a relative fraction of current vs max HP.

I usually use 100 px since I'm lazy, dunno what UT uses. Most programming languages should offer a way to draw primatives like rectangles pretty easily like this.

In GML I do something like this:

draw_rectangle(sprite.x+2, sprite.y+2, sprite.x+102, sprite.y+6,falsea)

This draws a rectangle relative to the sprite, with corners (2,2) and (102,6). This represents full HP, each horizontal pixel represents 1% HP. Add the percent *100 to the initial x value to visually represent an HP bar.

Update it on a timer, so remove a set amount each game loop. Once it reaches the current HP, release control to continue the battle's progression so the animation isn't interrupted.

EDIT: Everything is event based? How do you track things like the character's position or the battle status (such as spare requirements). You should be using at least some variables, if you have no variables to track, you can't reference things. It's also a lot easier to track things based on variables. For example, you could program an entire workflow that indicates where each action will go for Natsablook's battle or you could just have it track how many times you've used each action, and you can further set some variables manually to hold you back (for example if you fuck up the dapperblook thing you can just set the value of cheer to something like -8 so that it takes a ton of them to reset him to the same state as the beginning of the battle. Variables are god tier, use them.

Last edited Feb 03, 2016 at 09:16AM EST

I should of been a bit more specific, everything that is needed for a variable or number is tracked by variables, not just event triggers, event triggers are used for something like selecting an act on the menu, or attacking an enemy.

For example, switching to an area would be done like this:

If (Area is swapping) [Global variable used to trigger events related to the variable, such as not being able to make the player to move while switching areas]

If not (Scene is transitioning) [This prevents a crash if the game somehow tries to load two different areas]

Create (player actor) in next area at X (New player X), Y (New Player Y) [Creates an object with a variable name, and positions set by variables]

Load (Next area) [loads up the new scene]

End

It's more of events being triggered if variables were met.

Last edited Feb 03, 2016 at 09:31AM EST
Skeletor-sm

This thread is closed to new posts.

Old threads normally auto-close after 30 days of inactivity.

Why don't you start a new thread instead?

Word Up! You must login or signup first!