A Cookie Clicker-inspired web game made in Ruby on Rails, for the Railway YSWS.
Upgrade your pickaxe and purchase enchantments so that you can get more rubies, more quickly.
Save your progress for later with a username and password.
Ali mad co.
Check their projects out: MadBlog, ChatMad, SOMPS, Robby Raccoon, Multiplayer Board, ReactMad, My Homepage, Live, #Bored, StupidWatch
Once you ship this you can't edit the description of the project, but you'll be able to add more devlogs and re-ship it as you add new features!
I got it all deployed and then realised that making CORS requests every time you get a ruby is REALLY slow and messes with the game's timings. So I reworked the saving system! Now, there's a button for saving, and the game autosaves every 60 seconds. This way, there're no slow fetch requests every few seconds. And... I'M DONE!!!!!
I've been debugging deployment and API calls for 3 HOURS and I hope this next commit works. My commit history looks absolutely horrid now :skull:
The shop menu is basically finished now, with decoration and stuff! All I have to do now is deploy the app and stuff and connect it to an actual server :sob:
I've done a lot. I've fixed data issues, implemented the buying of enchantments, and creating a price curve.
There was a really funny issue where, instead of adding 1 to the ruby count, it was CONCATENATING 1. This led not only to insane ruby-gathering speeds, but total catastrophe when rubies are subtracted, as it concatenated -1 to it, making it not even a number.
I also added this enchantment table and am going to make it look cooler. I have to hurry, though, because I have to finish by 11 P.M.!
YEAH WE GOT PASSWORDS AND VERIFICATION WORKING LET'S GO!!!!
I'm using the sha256 algorithm for safety, too, so nobody (hopefully) can just look at my endpoints and hack people's accounts.
Boom! Bought pickaxes don't show the price anymore!!! And everything updates correctly using a new update system! Now, I use dispatchEvent whenever the pickaxe or ruby count changes so that the change is immediately seen.
While fiddling around with different values, I found out that my number-to-array function was NOT working correctly. Luckily, it was clear that the only issue was that it was reversed from what it should be. This means that the fix was only one function call away. :3
Pickaxes now have prices displayed! They'll only show if you don't have them, of course. ...I still need to implement the logic for that.
I've just made a function to calculate the speed of your pickaxe. It has values hard-coded that definitely may change, but I'm hoping I won't have to change them that much. Next, I'll make prices for things like enchantments and pickaxes.
Now, the pickaxe updates and stuff when you click a pickaxe option! I had to look up some stuff about window.dispatchEvent to do this because my logic takes place across two separate controllers.
I made a controller for the shop to make it clear which pickaxes you have unlocked. Only the unlocked ones do anything when clicked, that being setting their given pickaxe to the active one.
This is the first major addition that I've done without looking up anything!!!
I've just made functions for buying pickaxes and enchantments! I decided to keep track of your pickaxes with just a number ranging from 0 to 255, and converting it to an array of booleans when needed. This is so the database doesn't need 8 different boolean entries, because that'd be pretty annoying.
I finally found a better way to show the break images! I'm glad I looked it up now before I implemented the pickaxe images. Now, I only need one image element because I store the image paths at the beginning and then use them in code to change the source.
I started writing the code for the shop and gathered some image for the pickaxe upgrades! They're just the pickaxe sprites from Minecraft, but I made an extra surprise one...
Visual Change + Shop Menu! I put the Ruby counter text underneath the ruby and made it much larger.
I also started on the shop menu, which will have cool things like speed increases and pickaxe modifiers.
I think I FINALLY understand async and Promises. I just used them to make sure that data is gotten before UI is updated, and it worked just right. Now, data is always fully retrieved before updates, which fixes the minor issues that happened before.
I just installed Tailwind CSS for Rails and implemented it!!! I'm glad it's compatible because I LOOOOOOOOOOOOOVE Tailwind :D
In order to make it easier to implement a shop for upgrades, I did some research (asked ChatGPT) about sharing between components and then made a helper file for my controllers! Here it is, with a totalRubies variable that can now be accessed anywhere with the getRubies function.
I transferred my JS code over to a controller to make things easier!!! Now, I have a function. Next, I'll make a controller for the shop, where you can buy upgrades!
Your ruby count now saves to the DB when you gain rubies!!! It also loads your ruby count when the document loads. Currently, I'm hard-coding the user ID to be 1, but in the future I'll implement logging in and saving your progress.
Now, mining is REQUIRED to take 0.7 seconds, so that you can't just mash. Also, there's a ruby count in the top right that increments with each break.
I've set everything up and decided what I want to make, a ruby clicker game with a leaderboard! It'll be... very simple, but it'll work. I've already learned a ton about Ruby on Rails.
I have an image of a ruby and a pickaxe, and soon they'll be doing stuff!