Showing posts with label Coding. Show all posts
Showing posts with label Coding. Show all posts

Sunday, April 6, 2025

Nay Saga Devlog 14: Menus & Card Encyclopedia

I spent a lot of time working on the digital version of Nay Saga and finished up 2 of the game modes! So the menus are functional and those game modes are playable. It’s fully set up if I did end up revisiting this project to add a story mode or additional game modes, I could. I’m not sure if that’ll happen, but I wanted it to be an option at least!

I started to implement menus and overall navigation for the digital game. This way, the player can access the different modes available as I complete them. It was pretty straightforward with a lot of show choices and plugin implementations. This included making a custom title screen and menus. I also finally found some background music for the game!


Something I did here that’s a little different is I disable autosave from the start of the game, then the Story option starts a new game. From there, you can choose to either create a new story save file or load an existing save file. This means the load menu’s not actually using the built-in mode, but rather script commands instead. And when you start a game, it would turn autosave back on. I didn't actually get to the story mode for this first version, but I wanted it to be implemented in case I ever decide to come back and do it.

 

And similarly, I have the Free Play mode actually starting a new game and then sending the player to a specified map. This way, it goes straight into loading the map that shows the game modes choices.


Then I found the CGMZ Encyclopedia plugin that I used to create an in-game card database. It shows the card image at the top and then has the details about what’s on the card at the bottom. This was a huge feat, because I couldn’t find built-in ways for a lot of these parts, so I ended up having to dive into the plugin code and made my own edits to modify what I wanted it to look like more specifically.


I started by familiarizing myself with the plugin code. The first thing I did was update the name at the top on the right to show the character’s first and last name. I store their first name in the Name value and their last name in the Nickname value, so this was just a matter of changing what’s displayed to show both of them.


The first big feat I made after that was showing the card visual. By default, actors could only have their faceset, charset, or battle charset shown, while enemies would take their database image, and you could set “sketches” for custom aspects. So I learned a lot about how to show images in RPG Maker through code. I added my own “Sketch” drop-down in the plugin for the Actor by adding to the switch case, then I found some code for generally using the  blt()  code to show an image and essentially load it into a sprite on the screen. Thankfully this was a bit familiar from when I was learning PyGame earlier this year and that had a similar  blit()  function for showing images.

With that code, the image was still staying on the screen even after selecting one of the unknown entries. So I added a new part to the unknown entries code that shows a dimmed out image of the deck/card back if they haven’t unlocked the card yet. This used basically the same code except instead of using the Actor’s image, I used a specific reference to one.

Then I wanted to add icons next to the Types, but I have those stored in Classes, which don’t have icons in the RPG Maker Database. So I ended up learning a bit more about the VisuStellaMZ Message Core plugin’s Text Code Replacements feature. With the text code \Type[ID], I could check the specific character ID’s class and print that. I’m importing these notetags from Google Sheets, so I can automate that number for each character. So it checks which type it is, and shows the icon depending on what that type is before the name of it.

I then edited the Encyclopedia script a bit more to show the Type icon before the name of the Type using that replacement code I just made. This way, I could use the built-in showing of the “class” property with the Type.

I wanted to then show all of the Traits in a row, but I currently have them listed as skills and equipment, so I needed a way to combine them. I made a new text replacement code that finds all of them and then lists them out. This way I could use this in the Database to list them all under the “Notes” setting.

 

Then I made a few more tweaks to remove features I didn’t necessarily want to use. The first one was to remove the “overall completion” percentage at the bottom, because I only have 1 category that I’m using, so it was just repeating it twice. Then I removed the ability to click on characters, since I’m not having more data that it needs to scroll, so I thought it was a bit unnecessary. This just meant commenting out some of the code.

And then I added a new “View Cards” button on the Free Play mode screen so the player can automatically unlock all of the cards and see them when they’re not in the story mode. This will be a good way to just view all of the cards in the order you get them and reference them in the game.

I further customized the Free Play mode by allowing the player to choose a mode, then they choose which character to play as. I added new pictures that show on the left side when the player hovers over a game mode so they can view what it looks like in play and a short description.

I also added hover images for selecting the character. Each time the player makes a choice, they can loop back to the previous one if they press the cancel button or click the back arrow on the right.

When you choose a character, it will set the player character name. Then it’ll randomly choose the other 2 characters that you face against. I had to add a lot of conditional statements and looping to ensure the 2 characters it choses aren’t the same as the player character or each other.

Then I edited my Google Sheet for importing to the RPG Maker Database so I could include the Notes section. I also edited the formulas to more automatically import with 2 VLOOKUPs in a row so I just have to copy that first column in. This way, I could more easily rearrange the order I want them to appear in within the Database.

So then I went through every Eventure and ordered the characters in order of when they’re introduced in the story. This way, I could have them display in that order in the card database, and if I ended up making the story mode.

And from there, I officially imported every character into the Database in the project! So they all populate in the card database. I also added a new “First Appearance” part that uses the profile field.

And that’s it! The digital game is as finished as it’ll be for now. At the time of writing this, I only have a few more weeks until it's being shared with my brother, so all that's left is final polish and making sure everything's public and how I want it for this final iteration of the first version.

Sunday, March 23, 2025

Nay Saga Devlog 12: Revisiting the Digital Game

I came back to the idea of the digital version of my game because I wanted to flesh out my itchio page and really make this playable online after I put all of this work into it.

So I started by revisiting the story. I wanted it to fit in with the new story I had for the board game so I changed some of it up a bit. I started by brainstorming ideas in a Google Doc and then started to split up Eventures into 5 so I could have a set amount per character/mode. I was splitting them up by how many new characters there would be. So there are about ~150-200 characters introduced into the deck for each one, which should give you a lot to start with for each of the following modes. I still have to figure out the overall story and how to fit it all in, but I do want to likely focus on getting the game playable before I even really get into the story of it all.


For saving out the images, I found out how to save them out of nanDECK as the character's name instead of a number so they're easier to sort through. I can also use that same code to save them as different sizes, which will be useful for the digital version of the game.


I took a little bit of a side track to create a Google Sheet program so that players can access a database to view the main stats about characters and it could pull everything from my existing spreadsheets. So you can click the drop-down menu and choose a character, then their information will populate. I haven’t added the images for the characters yet, but I have a couple. You can view it yourself here!


Then I started to plan out the layout of the screen for the digital version of the game. I took the size I had saved out from nanDECK to ensure they would fit on the screen. Some of them I had to resize a bit, so will have to do some resizing in RPG Maker when I’m actually laying things out. I also planned out the order you’ll click certain buttons or cards so I could think through how I’m going to program it.

I started to plan out everything I’ll need for the digital game from now until the end, and looking ahead, I’m not so sure I’ll have enough time to do it all. So it’ll have to be either pretty rough or I’ll have to scope down the original idea.

So then I hopped back into the digital game! It had been a long time since I looked at any of this, so I had to remember what I was doing with all of the code. Once I reoriented myself, I started to figure out how the hands would work for the other modes. I started with the Channel 6 Get Together (Mode 2), but most of what I was doing there would apply to the others. I started with 1 hand, then used the same knowledge to make 3 hands total (since it’s intended to be 3 players maximum). So I basically made an array for each of the hands, the deck, and the discard pile. It was a lot of loops and arrays.

I started in p5 as usual and then transferred these over to RPG Maker. After the initial arrays, I made the code for what happens when you draw a card from the face down deck. I realized the order would differ a little from my original thought and you’d have to draw a card before you could actually play a card. So I planned to have the card off to the side so it’s technically not added to your hand until you discard something. So I made this code in a way where you first have to check if there are any cards in the deck, and if not, it shuffles the discard pile into the deck. If there is, then it puts it off to the side.

Then I made the code for when you discard your card, after you’ve drawn one. This one required a lot of work with arrays. I had to slice the player’s hand so it would pull the card you’re discarding out into its own temporary array, then it adds the card you picked from the deck into the location you just discarded from using splicing. And finally, it pushes the discarded card to the top of the discard pile. So this was a lot of work with arrays, but I did it!

Then I started to organize the cards on the screen to match my initial sketch. I mostly just got the hand down at the bottom and then set up the onscreen text for the turn order on the left. I made icons for all of the characters and traits so they could be referenced in text as well. I made a system where when you hover over a card, it moves them slightly upwards and when you’re currently moused over, it turns them slightly lighter as well. They also are sent back down when you select a different card.

To show the correct icon next to the character’s name, I made some big if statements that basically just check if the current player’s name matches a string and then if it does, it sets the icon number that’s associated with the character. And then it shows this on the screen in the Extra Windows plugin.

From there, I created the code for what happens when the player clicks the selected card. Basically it stores all of the traits from the hand array into variables that indicate what the current selections are. This way, it can compare against the active card and do a specific action based on that. This feature will be needed for a lot of the game types, so I wanted to store this somewhere. It’s pretty standard and what I had done previously for hands and figuring out which image to show.

Then I made a lot of progress on the visual progression and game loop! I added clickable buttons where you confirm after each selection, and it prevents you from clicking anything else on the screen that you shouldn’t be able to on the active turn. When you select a card, it adds it to your hand on the side so you can choose which card to discard while comparing everything.

Though not entirely visible in the video above, I created a mechanic that if you go through all of the cards in the deck, it shuffles the discard pile into the deck so you can keep playing. It checks the length of the deck array, and if it’s empty, then it shuffles.

I also added the action text that appears when you hover over a card (and select it). It detects if there’s a type match-up and then prints the text based on that. It also detects if there’s no trait matches, and then otherwise states there are no actions.

Then I added the win conditions on if a player has one of all matching traits for the specific traits. And from there, I started to track turns. So the current player’s hand is stored in a new array and it can pull from that each turn.

I set up the CPUs to play against the player too (as you can see above). I used a lot of the same code as I had from Mode 1 for finding the most frequent variables. And from there, I would have them discard whichever card doesn’t have that value. They also choose between the active card or the deck depending on if the active card has the one they’re currently collecting.

Then I spent a lot of time working on the Type advantages. When you play a card that relates to the type of the active card, an action sometimes happens. I created an opponent’s hand that pops up when you have an action to take a card from their hand. I also created a system where it’ll determine which trait the CPU is collecting, and from there, it’ll search your hand for anything with that trait and take that card so it’s not just random which ones are swapped. And then I also made an action that reverses the playing order.

So I only have a couple more Type matchups to code and then Mode 2 will be done! This one ended up being fairly complex, but I’m happy with how it’s coming out. My goal for next time is to finish this mode and then maybe even start on the next mode! Or potentially some of the general menus. I only have about 2-3 more blog posts at most until the due date, so I’m hoping to wrap things up soon!

Sunday, February 23, 2025

World Bub: Post-GGJ Updates

My brother and I revisited our Global Game Jam project, World Bub! We spent a couple of weekends after the GGJ was over to fix up some bugs, add some new art, and finish a few features we had originally planned.

 

💾 Download and play the game here:


 

Day 1

So I started out by fixing the key binds. The VisuStella Options plugin had the ability to rebind keys, and it ended up conflicting with our custom key binds, so I removed that feature and focused on the key binds we intended to get that working.

Then I updated the player and enemy turn visuals. They were previously overlapping some of the deck UI in a way that I didn't like much, so I updated it to cover less of that area.

I updated a few minor visuals like removing UI when it shouldn't be there or adding it when it should. Then I added a card visual for when you unlock new cards so you can more easily see which card you received and what it does.


Then I added more of the card abilities that we removed from the game initially. This included abilities like adding an extra move, attack boosts, defense boosts, etc. It ended up having me rethink how attacks were done so it could check for the boosts before a player or enemy attacks, to apply those to the damage.

When I was making the additional move, I also found a bug where you could infinitely move, so I ended up fixing that in addition to adding this new ability.

I updated the battles so that some enemies hurt more damage than others and they start in different locations depending on which rank they are. I didn't fully test these to ensure they're balanced, but I did at least start implementing this.

We originally wanted to implement characters on the maps so that you could talk to the characters you've defeated in one central area. I put in some placeholders and dialogue for when they talk to you. During this time, my brother was creating the final art for our overworld map and updating the lighting.

I added a bit more dialogue as well. I wanted to have different dialogue after you beat characters so they wouldn't repeat the same intro the second time you fight them.

Then I started to draw all of our character sprites. I made really simple animations for them and just created one direction for them to face so they could appear on the overworld and in one of the buildings as you collect them.


Day 2

On the second weekend, we finished everything up! I started with adding dialogue options where you can choose whether you want to battle a character or not, so you can back out if you change your mind. My brother made our show choices image and I made the functionality.

I also added the functionality for showing images when a location is locked and you can't progress yet to make that a bit more obvious. My brother did the visuals on this one as well.

Then I fixed some of our scrolling background issues and lights. The next area I updated was the randomization when you receive a card from beating Gair. There are 4 options so I previously just had it choose 1 randomly. I updated it to choose a new card each time until you have all 4 so it would be more worthwhile to challenge him to a rematch.

Then I implemented the types into the battle! We previously had types shown on the cards but they didn't actually do anything. So I changed it so all of the player's cards can damage the enemy for extra damage if they hit their weakness. I also updated the enemy's attacks to have a random chance that they'll do more damage to the player if they have an advantage to water (Piko's type). I added some flavor text to let you know if these are happening too.

I also created a visual in battle that shows the enemy's type so it's easier to remember what types you want to use against them. I was forgetting a few times in battle and wishing I remembered, so I thought this would be helpful for the player to use those type advantages more. My brother also updated the card layouts to include more symbols and visuals to indicate what cards are doing.

 Then I drew a few more character sprites! I drew Ducklin, Octobub, Octoglace, and Chilzby.

I updated the options screen to show the controls on it so it'd be easier to know which ones to use. I also fixed up some of the keyboard controls.

 

From there, I did some final testing and bug fixing. We were having a few bugs that would randomly happen, but they were really inconsistent and hard to recreate. So I tried to proof it up as much as I could, but it was a challenge to fully test when it was only happening once every ~10 playtests. And usually it would be when my brother was testing and not me, so it was hard for me to debug personally.

But overall, I'm really happy with the improvements we made to this game! This has turned out to be one of my favorite GGJ projects and maybe the most fun gameplay-focused one! I really enjoyed working on this project and I can't wait to see what's next!