RPG Battle System

Hello fellow Pulp enthusiasts!

My son has started learning to code at school, so I thought it would be fun to introduce him to Pulp. He’s been having a blast creating several sprites and his little world. He’s even doing small scripts! While helping him on different coding aspects, I have been having fun testing things out and I’m really into it as well!

I’m also playing through the Dragon Quest 1+2 remake right now, and with that game fresh in my mind, I wanted to see if I could implement a JRPG like turn-based battle system in Pulp. I’m certainly not the first to do this. But it was a fun learning exercise to build my own.

I’m sharing the project here so that others can learn from it or use it in their own game.

Pulp file:

JRPG Battle System.json.zip (7.5 KB)

PDX:

JRPG-Battle-System.pdx.zip (51.7 KB)

Some notes:

The battle system is menu based, leveraging the Pulp menu and say functions.

Some tiles are “wild” and have a chance of triggering a battle. Each wild tile has some logic to determine the type of enemy that can be encountered.

When a battle occurs, the player is moved to the battle room, and different sprites are displayed for the enemy and player. The actual player tile is hidden in battle. The player sprite is static in the room, but the enemy sprites are displayed dynamically over several tiles based on its enemySizeX and enemySizeY variables.

I used some item tiles has logic containers. These include:

  • battleSystem: all the logic to handle battles

  • enemyDefinitions: functions to initialize the variables for each enemy type. There are 3 currently: Slime, Big Slime and Goblin

The player script has a series of functions to adjust health, XP and coins. I wanted to centralize the logic there so that it will be easier to change it (i.e. checking for level up after the player gains XP)

What’s missing:

I have a good portion of what I want implemented. But here are some of the things I would like to add eventually.

  • Allow sprite animation in combat: this is tricky since the menu and say functions will pause tile animation. So an idle animation will not work with the menu open. However, an attack animation should be possible by using the wait function before showing the say message.

  • Create a logic container for the spells, so that the code can be reused. Right now, the code for the Heal spell is duplicated in the player and battleSystem scripts.

  • Add sound effects to battle actions and spells.

  • Have more than one enemy in a battle, and more than one character (party system).

  • I have some basic stats implemented, but some additional ones, a level up system and an inventory system would help in creating a better RPG experience.

I hope this can be helpful to someone. Let me know if you use it. I’m curious to see what others build with it.

4 Likes

I’m so excited to see more turn based RPGs made in Pulp! (I made Initial Daydream and was half the team making Otherworldly Effigy for Ware-Wolf). Love the sprite work here too!

We’re going to expand OE into a full release hopefully next year, so I’ll be doing a lot of this work parallel to you. Can’t wait to see where they both end up!

2 Likes

Great to hear you are working on a new project! I really enjoyed what I played of Initial Daydream. It was really clever to use “items” that the player needs to collect as a battle menu. Love the music as well. Really reminds me of playing the original Final Fantasy.

I still struggle with Pulp’s music and sound editor. I really have no idea how to make good sound effects, and even less music!

I haven’t work much on this project since posting. I was busy trying some other ideas. I need to get back to this as well.

3 Likes

Other half of the Otherworldly team here! Excited to see where you go with this! The Playdate definitely needs more turn based games :fire:

2 Likes

Yeah the sound stuff is probably the most intimidating part of Pulp, especially if it’s not something you have experience with. Someday I should make a video or something that gets through the basics of it to demystify it for people, because it’s actually quite fun once you get the hang of it, with similar interesting constraints that you have on the art and code.

I think somewhere on the forum here there’s a thread about tips for the Sound and Song channels that had a lot of really good stuff, I’ll see if I can find it.

Or maybe just make some Pulp music packs haha

1 Like

Here it is, specifically linked to ronlent’s comment, but there’s other good things in here too: Share your tricks for the Pulp music editor - #8 by ronlent

2 Likes

Thanks for the link! I’ll definitely check it out.

I made some progress this week. Started battle animations, added a spells system and basic sound effects.

I’ll post a new version when I’m done cleaning the code.

1 Like