Matlab de Hakken! Fan-made vintage Tamagotchis

TamaTalk

Help Support TamaTalk:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

LucidLyes

Well-known member
Joined
Sep 8, 2020
Messages
200
Reaction score
692
Location
Africa
Hi everybody!

So I've finally decided that this should be its own separate thread instead of it being intertwined with my log.

The story is this: I used to have a P2 as a kid and I lost it, and I was really fascinated by Tamagotchis when that happened. It's now 20 years later and now I've become good enough at programming to actually program my own Tamagotchi app so I decided to try and do so.

Plot twist: Upon finding Tamatalk and the Tamagotchi fandom.com pages, I started becoming interested in all the other vintage releases and the Connection series too, which I've never owned. (I still don't like the color Tamagotchis too much since I find the characters a little too cutsy and I feel like they all look alike. I think they're definitely aimed towards more of a female audience with less of emphasis on trying to provide "universal" characters. But that's not the point of this post.)

This made me want to try to start my very own implementation, first of the P2, then of all of the other vintage releases, at least up to the V4. Now I know myself enough to know that the probability of me actually delivering on that promise is about the same as that of frogs raining on Jupiter, but I'm still going to give it a try!

Here's how I've decided to go about it:
*First, I'm going to finish my Matlab implementation of the P2 that's based on the Matlab command line (so pretty much useless for anyone except me (and other Matlab users of course)). I'm starting with Matlab only because it is by far the language I'm the most comfortable with.
*Then, I'm going to program a Graphical User Interface for it and try to make it as a standalone program. By that point other users might be able to use it if they agree to install Matlab's MCR (which is freely downloadble).
*After that I'll just go Mothra, Angel, Genjintch, and so on up to the V4. There might be some releases I might ignore, such as the TamaOtch, which I really don't find interesting.

The only reason I think I might be able to do this is that I think once the P2 will be complete, then implementing the others shouldn't be too much of a hassle. It should only involve drawing new sprites and changing just a few basic things (I might be completely wrong about this - and I think I am).

In the meantime, I'm also going to try to implement it on Android using a nice little app I found called APK builder. Basically it allows the user to program android apps directly from an android phone, without any need for Android Studio. I use it all the time when I'm commuting or just outside. It's pretty neat. Only weird thing is that it's not on PlayStore anymore and you can't even find it on other sites.

And finally, I also thought of actually purchasing an Arduino card and a small screen and actually building myself an actual Tamagotchi. I'll be showing you all the process if I do so of course.

From this point on, all the following posts are going to just be updates on the project, so stay tuned. I'll be doing this on my free time so expect hiatuses (?), disappearances, posts where there has only been very small improvements etc.

Feel free to ask any questions about my implementation, in fact I'll be glad to share the code with anyone interested.

 
And here's today's update:





As you can see, I've added the icons, but only the food and game icon work so far. Also, shirobabytchi actually walks left and right on the screen, rising up and ducking down as the original does. I'm not sure if there's a pattern to its movements, I just made it go randomly from left to right, which admittedly gives weird results when it reaches the screen's limits.

I've also added many sounds and made the existing ones more faithful to the original. I think I did a pretty good job on the happy sound effect, it's so satisfying to hear it (for me at least).

I'm progressively getting rid of the text-based aspect. Now I'm mostly using just 3 keys. Since it's a command line program you have to input a button and hit enter each time, but this will stop being a problem as soon as I implement this as a Graphical Interface. I mostly did this to be completely done with the Food menu. As you can see, it's 100% complete and operational. Well, I didn't show it saying "no" when you feed it 5 times, but you know from previous entries that it does. Also, this brings this project one step closer to being a GUI, so that's cool.

You might have noticed a glitch when I try to enter the food menu. I don't know why it does that and don't think it's necessary to correct this behavior at this point. In the end, I'm pretty sure it's either something very easy to correct, or it has to do with how I'm handling time, which is bound to change.

Even though I said I planned to first completely finish the project and then make it into a GUI, it doesn't have to wait until that point honestly. In fact, I really want to start he GUI right now while the code is still relatively manageable because this will make it feel more like an actual program (and tamagotchi). Besides, I'm getting tired of having to hit enter every time I push a button.

Doing this is really showing me how complex Tamagotchis are, even the very first P1 version! I mean, here I am with Matlab, in 2020, trying to rebuild a toy that used LR batteries and a 4-bit processor! I always thought building a Tamagotchi was a pretty straightforward task, and to some extent I still think it is, but for 1996 and very limited hardware, it's incredibly complex and really deserving of all the praise and success it got!

(By the way, I like how even my incomplete, basic tamagotchi rip-off is still better than the Bunny-ROM!)

Good day or night!

 
I've been enjoying seeing your progress updates on Matlab de Hakken! in your log, and I'll be enjoying seeing even more of them here! :)

And finally, I also thought of actually purchasing an Arduino card and a small screen and actually building myself an actual Tamagotchi. I'll be showing you all the process if I do so of course.
I'm a big fan of seeing what people do with things like the Arduino, Raspberry Pi, etcetera, so I already know that I'm going to absolutely love seeing this if you make it into a physical virtual pet. :D

(By the way, I like how even my incomplete, basic tamagotchi rip-off is still better than the Bunny-ROM!)
Hahahahaha! :lol:

 
I've been working on Matlab de Hakken all day today, and have made great progress, while staying in place at the same time. Basically I decided that the GUI was the way to go from now, and I'm glad I did. See, upon starting the transformation of my old program into a GUI, I noticed that even though the logic was the same, I had to completely change the program's structure in many cases. So no, I did not have to re-implement stuff I had already implemented, but I still had to think deeply about where each piece of code was supposed to go. As a consequence, I sometimes feel like the approach I've taken was more of the "get it to work" type which bothers me a little bit, even though (almost) everything still works as it did in the command line interface days. It's not too much of a big deal however because I'm used to having to give my code a second look and trying to improve what needs to be improved and fix what needs to be fixed. For now I'm just focused on having the GUI do exactly what the old version (Command Line) was able to do.

Still, I'm really glad I made that decision because now the app is way more user-friendly than it used to be. As you can see from the video, I'm just clicking the A, B and C buttons just like one would press on the Tamagotchi buttons. I've also made it so that the A, Z and E keys can be used to control the game (I use an AZERTY keyboard so that was the more logical choice to me - I'm only now realizing that you guys might be wondering why this specific choice was made).






 
I've spent the day coding again and am almost done coding the basic functionalities of the toy. The tamagotchi, eats, sleeps, plays, poops, and gets sick. Of course he can become full (of food), wake up, and be cleaned and cured. My aim has shifted a bit from trying to be as faithful as possible to the P2 from the get go, to first implementing all of the basic functionalities and THEN paying more attention to the details.

I'll admit the code is a bit messy, and I know I'm going to have to fix that at some point, but for now I just want to be done implementing the first 65 minutes of gameplay (you know, from the hatching process to the evolution into Marutchi (or I should say TonMarutchi). Once that's working all right then I'll be looking at evolutions.

I don't have a video for tonight since it's getting late, but you can expect one soon.

EDIT: I forgot to mention, the status menu is also 100% implemented

 
Last edited by a moderator:
Today's update will be in 2 videos because reasons.

Apart from the Discipline calls, everything seems to be working as expected. It's lacking in animations and I'm not going to fix that for a while. Also, I don't see the point of having a lights on or off menu, so I don't feel like bothering myself coding it. Pressing B on the lights icon should just toggle the lights on or off just like in the GB game (amirite @Penguin-keeper ?)

With this, the first 65 minutes of gameplay are fully implemented. As you can see from the second video, I've even started implementing some Tonmarutchi into the game. I've had a great time these afternoon walking in the park with my family and doing some thinking about how to code it. I've found out that besides having to revisit my code a bit to make it more universal (a lot of it applies only to Shirobabytchi), it should be a pretty straightforward task, since all the characters behave basically the same just with a few differing parameters. My only problem is that I often lack information/sprites/sounds to implement functionalities faithfully. As a kid, I knew nothing about care misses so I can't just sit down and code without having to look up stuff. Even at that, sometimes I can't even find the necessary information on the webz; for instance, I've been looking for a simple growth chart that shows the number of care misses necessary to go from one character to another, but couldn't find it. I did find some info on tamagotchi.fandom.com but I'm not sure I understand it all. I also need some info on how fast each character's hearts decrease, and at what times do the Tamagotchi call for discipline.

After implementing all the characters I'll start working on a save feature (to make all of this worth the effort!). I've realised that it should also be pretty straightforward, just count the elapsed time in seconds between the current time and the last save point, and simulate the passage of time with a loop up to the present. If you've played Animal Crossing, you should know exactly what I'm talking about.




 
Last edited by a moderator:
Also, I don't see the point of having a lights on or off menu, so I don't feel like bothering myself coding it. Pressing B on the lights icon should just toggle the lights on or off just like in the GB game (amirite @Penguin-keeper ?)
Yep! That's a way better implementation than having a menu for it. :D

 
Last edited by a moderator:
Very quick update:

*I've started programming an Android version of Matlab De Hakken! (i.e. Android de Hakken)

*Tonmarutchi is fully implemented, graphically speaking. It eats, plays, poops, falls asleep, shows happiness, shows unhappiness, and every other necessary animation. Good news is, I've arranged the code so that now adding new characters will only be a matter of finding the sprites, drawing them  and naming them correctly.

*I'm in the process of implementing the "adult" events. As you might know, in the Babytchi/Shirobabytchi stage, everything happens at very specific times. However for other stages the algorithm is a bit more complex, e.g. the tamagotchi will get sick at specific times AND if you leave it dirty for a while, AND before evolving, AND if its hearts have remained empty for a while. Each character has its own characteristics and instead of programming each one individually I have to think of a way to program the behavior in a universal manner from the get go so that if it works for Tonmarutchi then it will work for every other character. Honestly this is the most fun part for me to code since it gives me an excuse to do experiments with the Android Tamagotchi Classic app, read people's logs, read stuff from tamagotchi.fandom.com etc. It will however also be the longest. So far all I've managed to implement is the sleeping and waking up at specific times (I've actually changed the clock on my laptop to test the functionality). I'm thinking maybe I should start to work on the save feature so I can then release the program for you guys to help me iron out all the bugs and flaws.

Here's what's left to implement:

*care misses
*discipline calls
*sickness
    *babytchi's normal sickness (x)
    *empty hearts induced sickness
    *poop induced sickness
    *old age induced sickness
*death

Good day or night!

 
Last edited by a moderator:
Good news! I've made tremendous progress on Matlab de Hakken and I think I've implemented every necessary functionality. All that remains now is to just draw all the sprites and name them correctly. This could be a 1-day job with a podcast running in the background. (So far the game only features Shirobabitchi, Tonmarutchi and Hashitamatchi.)

Some aspects of the logic have been improvised a bit, e.g., I don't know when exactly the tamagotchi calls for discipline, and what exactly determines which character will appear after an evolution. So for instance for evolutions, I'm planning to only look at the number of care misses, until I can figure out something more faithful to the original. I'm counting on you guys and gals to help me find the info or retro-engineer the toy.

The game also saves and loads the current state but so far it doesn't simulate what happened while the application was not running. This should be pretty straightforward to implement except if there's a trap I'm not seeing from where I am. Normally it should just be a matter of counting seconds from the last time the app was closed to the present time when the app was opened again, and simulate the passage of time in "turbo mode" inside a loop. That should do the trick but I hope there's not something more complex hiding behind the idea. Nevermind, it was (even) easier than it seemed!

I'll compile a version for you guys as soon as I can and then I can uplod it somewhere and give you a download link so you can try it out!

 
Last edited by a moderator:
Ok so the "catching up" thing seems to be working for now. There's at least 1 thing I need to fix about it which hasn't been a problem so far but it should be easy to correct and I don't think there's anything else to change other than that. That's done too.

I have stuff to do tonight but as I said I'll try to give you a download link as soon as possible. I hope it'll work on your computers as I've never really did a massive deployment of my Matlab programs. I'm really excited to hear your feedback on my work!

 
Last edited by a moderator:
Alright so I've just tested the app on my wife's computer and it worked okay. Here is the download link for this very first, incomplete version:

https://drive.google.com/file/d/1ODgNQGZGF5a52X3w6Z75LU05GLQjOgUk/view?usp=sharing

It's only a beta so far as there are still characters missing and you will undoubtedly find bugs in the program.

How to install:

1. Download the RAR file by clicking on the link above

2. Extract the files to a new folder using WinRAR.

3. Double click MCRInstaller.exe to install the Matlab Compiler Runtime necessary for the app to run. It's a bit of a long process (took about 10-15 minutes on my wife's i3) so please be patient.

4. Once the MCR is installed, double click on TamagotchiGUI.exe to run the app. It will take a little while to start because the MCR needs about a minute to fire up. Good news is you will only have to wait this long the first time you run the game after a PC reboot. Bad news is you'll have to wait this short while every time you turn off your computer. It's not really too long so just run the game (TamagotchiGUI.exe) and start doing something else. Your antivirus might or might not scan the program and then find it's legit and leave it be. Avast did so on our PCs. Don't worry, I'm not trying to hack you or anything, really.

5. If the app displays an error and won't run try rebooting your PC and running TamagotchiGUI.exe again. I had to do this on my own computer (which has Matlab installed!) and then it worked fine. I didn't have to do it on my wife's laptop (which runs Windows 8.1 btw - so we know the app works on Windows 7 and Windows 8).

6. Obviously, you only have to run the MCRInstaller once. Afterwards you just run TamagotchiGUI.exe of course.

How to play

Please keep in mind this is only a beta test version. It's not complete in any way.

To play you can just click on the A B and C buttons on the interface or you can hit you keyboard's A, Z, and E buttons for A, B and C respectively. You can also use the Left, Down and Right arrows. The app displays a new image every 0.5 seconds, but it still receives your input in real time. As long as you hear a beeping sound when you push a button, the app should have acknowledged it. I do not recommend pushing the buttons too fast though, you might crash the app. Also, if you start clicking on the UI buttons, and you want to go back to using the keyboard, make sure you click somewhere on the UI other than the 3 buttons. It's the UI that receives the keyboard inputs, not the buttons. I do prefer using the keyboard as it seems to be a little more responsive.

The app behaves like an original P2 Tamagotchi. When you close it and open it again, it simulates the passage of time from the last time you closed it to the current time, which I've found out takes a little while (8 secs for every hour on my poor old 2010 Core2Duo - so it should be less if you have a more powerful computer). I'm planning to improve the program to speed up this process eventually.

If all goes well, you should be able to raise a Hashitamatchi for 25 days (at best). If you want to reset your Tamagotchi you have to delete the file named 'tmgc_save.mat'.

Disclaimer

I used the Tamagotchi Simulator 3's sound effect for evolutions (Change.wav). All other sound effects are my own work. I hope the author of Tamagotchi Simulator 3 doesn't mind. In any case, I plan on programming that sound effect as well eventually.

 
Last edited by a moderator:
I just downloaded it!!! I use a laptop that runs on Windows 10 so hopefully I can offer a cool perspective for everyone >w< I use the program 7zip to unzip my compressed folders, which include .rar files! It's also free and doesn't pester you with update messages (from what I used to experience using WinRAR XD). 

On Windows 10, it only took a minute or two to install the MCR runtime component - I say it depends on the computer model you have what time it takes for it to install correctly. Once that was finished, I saw in the read-me file in the folder included that you had to add the PATH specified for your system, but the prompt didn't work for my CMD (command prompt). I was going to change it manually, but suddenly the program opened up without any worries! For those running on 10, maybe wait a little while after clicking to open the program, as it worked for me just fine. :D

It was time to playtest!! Here are some things I tested out!

  1. All methods of control and alternative control work just fine! If you're clicking on the provided A, B, and C models, just make sure to click off them before using the keyboard (aka none of them are outlined in blue from being selected).
  2. The sounds are all there and in working order!
  3. The game is working great and just like the original P1 - I will always prefer the P2 game as it is a little more fair compared to the total guessing game of the former, but it is definitely more easy to program so I totally understand the choice!
  4. Closing and opening the program confirms your data is saved - all my stats were kept the few seconds it was closed for.

I actually only played this for five minutes as I am pretty busy at the moment, but I was really excited to play this! It works very well on a modern system and runs great! You should definitely be proud! ^_^  I can't wait to see what new features will come soon!!!

 
Hey! Thanks very much for the quick feedback. I was so eager to hear from any of you guys and girls as soon as possible, and I'm very happy that I did not have to wait for too long for a first feedback.

I use the program 7zip to unzip my compressed folders, which include .rar files
Actually I did not know it but I could have provided an exe package file that the user would just have to double click and it would do all the work of extracting the files and installing the MCR. I think that's a better option for next versions. (For people who haven't installed the MCR anyways, since you only have to install it once).

On Windows 10, it only took a minute or two to install the MCR runtime component
Wow! that's lightning fast to me! I'm still using my 2010 Dell Vostro with a Core2Duo that just won't break, so I don't know what current PCs are capable of. Do you have a particularly powerful PC or just something common? It would be cool if most people could just run the app as fast as you did!

I saw in the read-me file in the folder included that you had to add the PATH specified for your system, but the prompt didn't work for my CMD (command prompt)
I forgot to tell you to just ignore that README file. I've now edited my last post to warn users that they don't have to do anything besides following my instructions. I should have omitted that readme file from the archive altogether, my bad! (Matlab users are not used to deploy their programs often I guess  :D  ). That Readme file was not written by me but FOR me, to understand what end users would have to do.

For those running on 10, maybe wait a little while after clicking to open the program, as it worked for me just fine.
I'm not sure I get that. Did the program take a long time to start the first time? Less than 10 secs? or more like less than a minute?

If you're clicking on the provided A, B, and C models, just make sure to click off them before using the keyboard (aka none of them are outlined in blue from being selected).
Yep! I keep telling myself I have to fix that but for some reason I keep on delaying it further and further. (Might be because I usually code the thing that excites me the most at any given moment).

The game is working great and just like the original P1 - I will always prefer the P2 game as it is a little more fair compared to the total guessing game of the former, but it is definitely more easy to program so I totally understand the choice!
Same here! The P2 game at least requires a little strategy. I don't know why I started programming the P1 game really, it wasn't really a deeply thought out choice. I was so excited I started coding without thinking and later realised that wasn't the P2 game and that I would eventually have to reprogram the entire game. Oh well!

I can't wait to see what new features will come soon!!!
For now I'm eager to be able to say that every character has been implemented as well as their evolutions (I want to play this too!). But there are so many more options to implement it's making my head spin:

-Implementing the P2 game as we just said

-Adding the P1 characters and giving the player the option to choose a version at the beginning

-Giving the player the option to simulate what happened when the app was closed. Some people might not like that "catching up" mechanic.

-Option to turn off the sound

-Letting the player define his/her own characters

-Speeding up  the "catching up" process

-Improving animations and refresh rate.

- and many more...

I don't know if I'm ever going to do all of the above because I'm planning to shift my focus to transferring this project to Android (I'm planning on becoming an Android developer) and all of this Matlab stuff is going to slow down the process. I AM already looking at the Mothra Tamagotchi with an itch to start working on it in Matlab as well but... Decisions decisions!

 
I've finished drawing all the character sprites. Now I need to look up data about each character (sleep/waking hour, heart loss rates, poop period, etc.) This shouldn't take too much time and then I'll release a new version of the program to you guys.

(For some reason I keep forgetting to draw the egg for the egg stage)

 
Back
Top