Farm fable banner

Farm fable

23 devlogs
38h 54m 25s

A match 3 game homebrew game for the DS

This project uses AI

Github autocomplete for code completion

Demo Repository

Loading README...

nmsoukmandjiev007

Shipped this project!

Hours: 38.91
Cookies: 🍪 860
Multiplier: 22.1 cookies/hr

I made a match 3 game for the nintendo DS - A dual screen handheld console released in 2004 with 4 megabytes of ram and a 67mhz cpu for primary processing, along with a 33mhz cpu for i/o. This was all written in C without a game engine, and i had a blast making this!

I learned so much about how the ds handles memory, with its multiple VRAM banks and different screen modes, as well as how to work with sprites and touch input. This also helped me learn more about C and how to write better code in general.

The hardest part was 100% animating gravity as I chose the foolish descision of using 2 different screen modes for each screen, causing some logistical issues with how sprites had to move from one screen to another.

I am really proud about my check for any possible moves, as i was able to make a really good way to check for them very quickly whilst handling all edge cases.

Overall this was a very fun project and I will certainly continue making things for the DS!

nmsoukmandjiev007

The finishing touches were finally made!
Firstly, there is a score displayed, as well as a win condition, which is to reach 1000 points.
Then I added a win screen and some cheering for when you reach that threshhold, as well as an option to continue playing after you’ve won.
I also finally implemented the move checker, so now it automatically shuffles for you when you have no moves available.
I will also add an emulator in the repo so that it can be easily tested without a ds!
Also had a heart attack because github just didnt recognise this repo on my side but its all good now :)

Also video included with full gameplay start to finish :)))))

0
nmsoukmandjiev007

Added a title screen with title music. Also made a bit of a scoring system that has yet to be displayed, but it is there. Fixed up the pops too, so now theyre centered.

My updated todo list is now
Add a win condition
Show the score
Apply the move checker
Ship!

0
nmsoukmandjiev007

I was genuinely in a trance programming the possible move checker because boy did i make it nice and efficient. It’s O(row x col),which in my case is an 8x8 portion of my grid, which means it pretty much zips through all possible moves. This was super fun to just make not because the ds is underpowered but because it was a useful learning experience to make instead of just brute forcing each possible moves.

I havent actually implemented it to work in the game loop since im 50% sure i messed something up somewhere, but it exists in there and it compiles so im pretty much almost done.

Todo:
Literally everything i said last time

Ds 👍

Attachment
2

Comments

desh.kian
desh.kian about 1 month ago

This is sick

nmsoukmandjiev007
nmsoukmandjiev007 about 1 month ago

Thank you!

nmsoukmandjiev007

Its kind of crazy how polished this is becoming!
I added a little bubble popping animation when you match something. This was actually super annoying to do because of the first issue with the screen being frozen for the amount of frames the animation plays, which was completely my fault because it wasn’t actually changing frames due to my math being wrong.

Then the animation was playing twice every time something matched, and that was again my fault as i call the matching function which does both matching and animation twice: 1 time to check if a swipe is matching, and another to actually find matches during the main game loop. This was a fairly easy fix as all i had to do was make a super stripped down check to see if there are any matches when a user swipes a block.

This means the gameplay loop is pretty much finished. There are only a few things left:

Make the pops centered and have better detail
Some sort of score system
Title screen
Maybe a gimmick with the top screen that i was thinking about before, but i dont know if its entirely necessary.

Some which i could do but i dont think are a must are:
More efficient file saving
A check to see if there are any more possible moves (if not too expensive on performance)

0
nmsoukmandjiev007

A fairly productive hour coding!
The issues with some sprites being moved in front of other sprites during gravity was fixed
There is a partial implementation of the popping, but it is not fully done due to an issue where it plays freeezes during the frames it is meant to animate (hence the pauses after matching)
I have no clue why the emulator (melonds) kept freezing last time so i swtiched to DsEmuMe and it seems to emulate that fine, except for sound which is HORRIBLY delayed. I dont think there is a fix for that at all though because the sound library i use points out that emulators dont work well with it.

Todo
Fix the popping animation
Title screen!

0
nmsoukmandjiev007

Guess who spent an hour debugging why my program kept freezing on an emulator, but ran ever so sweetly on real hardware (i didnt fix it)!!!!
Anyways, today was mainly a day of refactoring matching logic for upcoming matching animations. It doesnt really show it, and there are probably a few bugs, but it was a very clean method which im happy about.

Since the progress isnt really visible when playing normally, heres a funny bug which misaligns the top select screen

Todo:
Fix the strange issues during gravity
Unfreeze the emulator
Pops!

1

Comments

nmsoukmandjiev007
nmsoukmandjiev007 about 1 month ago

oh yay 30hr milestone!

nmsoukmandjiev007

File saving is done! This was fairly straightforward, i just had to re-remember how to use it.
So yeah, now you can play the same grid.

Only issue is that i am saving literally every single frame so ill have to quickly fix that up or else im just kinda wasting battery…

0
nmsoukmandjiev007

Gravity is now animated!!! Unfortunately there are still some annoying bugs that i have yet to fix, but its there!

0
nmsoukmandjiev007

I cant even lie this was me just trying to animate gravity when i didnt even program gravity logic correctly in the first place…….

Yeah so still no animated gravity BUT my mistakes helped me learn what i did wrong sooo eye candy soon?

Also got me a new ds lite with an actually working hinge so theres that

0
nmsoukmandjiev007

Started working on the top screen block swapping mechanic. Its not going too well but the core logic is there, so i will work on it tomorrow. Everything else also works.

Fixes:
The wierd black borders on the crops being messed up

Heres a crude recording of progress once again

0
nmsoukmandjiev007

Not much done this time round.
Added an anti softlock mechanism, though it is manual. I fear that automatically checking for new moves would be very expensive.
Made a okay-ish title art. It was mainly parsing some game assets that i got and thats about all, though it is hinting at the next mechanic that i will introduce (follow if you wanna get updates btw)
Changed the code to work as a state machine to prepare for said new mechanic. Overall, it was a fairly short day of me continuing this.

Todos before I add the new feature:
Animated gravity
Cleaner looking sprites
Title screens
Game saving

See you tomorrow

Attachment
0
nmsoukmandjiev007

Ive made some cool stuff today!

Firstly, i got background music to play, which was very annoying because they use a different file format that splits the music up into presampled instruments, meaning a simple mp3 conversion wouldnt do. However, the programming part was fairly straightforward, so that was fine.

Secondly, I got swiping animations! Yayy! After about 6 devlogs of me promising them theyre finally here. Theyre not perfect as it creates 2 extra dummy sprites to move instead of the real ones so that sprite ids arent mixed up.

Also fixed up some bugs such as:
all six crops not showing (wheat is here now)
something that just drifted away from my thoughts

Heres another recording of the gameplay! Enjoy

0
nmsoukmandjiev007

Yayy! Eyecandy!
Settled on the theme of my game, which is farming. Bought an asset pack on itch io, made a grid, and now it looks like a game!

There are still todos though which are:
Animations
The wierd black borders being messed up

Heres a little recording, please ignore my roomate

0
nmsoukmandjiev007

I FIGURED IT OUT!!!!
With the help of some people who are way more knowledgeable than me, and with a bit of guesswork
I reduced the graphics slots usage from 128 to JUST 2!!!!

This means slightly faster load times, which sounds kinda pointless, but this helps with future stuff, so its good

Attachment
0
nmsoukmandjiev007

Did a bit of thinking and decided that there is no use optimising it for now, as i still have the leeway to add more stuff before i truly hit the limit.

I also managed to implement the restriction of moving your blocks anywhere, and that you can only move it if it matches

Enjoy the 25 secs of shaky gameplay!
Next plan iis to add animations if all goes to plan

0
nmsoukmandjiev007

Hitting a huge roadblock in terms of optimisation and animation….
Im brainstorming as much as I can, but i can’t figure out much, so this devlog doesnt have anything too crazy.

Im figuring it out though, bit by bit, also added a little crude explanation for those interested

Attachment
1

Comments

nmsoukmandjiev007
nmsoukmandjiev007 3 months ago

I may be a bit stupid. GFX is image data, and uses the palette to figure out which frame it wants to be (i think)

nmsoukmandjiev007

Boy did this take a long time….
First i tried making my gravity system with 2 different arrays falling on top of each other, until i realised how painful that was, so i opted for 16x8 array that handles both the top and bottom screen

Then i realised I didnt know how arrays worked and that it is not like grid coordinates and kept jumbling them up, causing lots of issues with out of bounds access and vertical gravity, which was hilarious to see.
I also realised how half done my swiping was, so i fixed that so its a lot easier to not miss a swipe.

However, now gravity works, tile matching works, and the swiping works.

Then i polished everything and were back at square 1 and a half!
Still need to optimise the gfx tho :(

0
nmsoukmandjiev007

Huge news right now!
I got audio playing to work, its perfect, and all i gotta do is find/make some cool sound effects.
The top screen is rendering sprites properly, which will be the whole gimmick of this project

one issue…..
i may or may not have used all gfx’s (basically animation sprites), so some optimisation may have to be done if i were to show explosions and stuff.

0
nmsoukmandjiev007

MATCHING IS FINALLY DONE!!!
This took so many tries, as i really couldnt grasp how to do it, so i caved in and found an example match 3 game in c, and used its logic.

Its a bit of a shame that i couldnt figure this out myself, but if i did continue i wouldve likely lost my motivation in this, so im glad i followed a tutorial

I figured out how to play audio on the ds, so ill likely now focus on block falling and sound effects

0
nmsoukmandjiev007

Added sprites, all of which i got from itch io. Theres no correlation between some of these, but in my defense i didnt want just jewels because that would be a bit boring! Currently working on line clearing which is giving me a bit of trouble, but it’s getting there

Attachment
0
nmsoukmandjiev007

Got block swiping to work. Havent added any bounds checking or anything, but the system itself works, next thing will probably be drawing sprites or line clearing.

0
nmsoukmandjiev007

Made a grid, and got grid coordinates working! Time make the blocks move when you swipe

0
nmsoukmandjiev007

Managed to get it to run, used the code from simplenfl to make the swipe gestures, and got backgrounds and sprites working.

it will only get harder from here though, but im looking forward to the challenge!

0