Entrance Chat Gallery Guilds Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
September 04, 2025 - @646.99 (what is this?)
Activity rating: Four Stars Posts & Arts: 56/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: :happy: Open the all windows! Your mind needs storms and air! :happy: Super News: Upload a banner! (or else!)

+  MelonLand Forum
|-+  World Wild Web
| |-+  ☆ ∙ Web Projects
| | |-+  TamaNOTchi >:3


« previous next »
Pages: 1 ... 3 4 [5] Print
Author Topic: TamaNOTchi >:3  (Read 10580 times)
TheFrugalGamer
Hero Member ⚓︎
*****


⛺︎ My Room
Itch.io: My Games
RSS: RSS

View Profile WWWArt

See A Bug Summer 2025 ParticipantGreat Posts PacmanFirst 1000 Members!Pocket Icelogist!Joined 2022!
« Reply #60 on: February 05, 2025 @725.71 »

I believe there are actually only three :omg:

Also to explain why I have not gone nuts and added a bunch of new species and items already; the issue is that they are actually manually hard coded in PHP - which I'm sure was a good way to start the project, but from a maintainability stance... its a nightmare. Every species, and every item has to be individually coded.. for each gender of pet, and each age :drat:

For example ~ this is the core code for one species of tama, out of a document thats 1000 lines long, all mostly the same as this:
Code
if ($thispet["species"] == 1) {
            // CHUNNEKO
            if ($thispet["age"] == 0) {
                // 0
                $pet = [$device[6] + 12 * $multiplier, $device[7] - 26 * $multiplier, 0, 306 * $multiplier, 16 * $multiplier, 26 * $multiplier];
            }
            if ($thispet["age"] == 1) {
                // 1
                $pet = [$device[6] + 10 * $multiplier, $device[7] - 18 * $multiplier, 18 * $multiplier, 314 * $multiplier, 20 * $multiplier, 12 * $multiplier];
            }
            if ($thispet["age"] == 2) {
                // 2
                $pet = [$device[6] + 12 * $multiplier, $device[7] - 20 * $multiplier, 40 * $multiplier, 312 * $multiplier, 16 * $multiplier, 14 * $multiplier];
            }
            if ($thispet["age"] == 3) {
                // 3
                $pet = [$device[6] + 12 * $multiplier, $device[7] - 24 * $multiplier, 58 * $multiplier, 308 * $multiplier, 16 * $multiplier, 18 * $multiplier];
            }
            if ($thispet["age"] == 4) {
                // 4
                $pet = [$device[6] + 12 * $multiplier, $device[7] - 28 * $multiplier, 76 * $multiplier, 304 * $multiplier, 16 * $multiplier, 24 * $multiplier];
            }
            if ($thispet["age"] == 5) {
                // 5
                $pet = [$device[6] + 12 * $multiplier, $device[7] - 32 * $multiplier, 94 * $multiplier, 300 * $multiplier, 16 * $multiplier, 26 * $multiplier];
            }
            if ($thispet["age"] == 6) {
                // 6
                $pet = [$device[6] + 10 * $multiplier, $device[7] - 32 * $multiplier, 112 * $multiplier, 300 * $multiplier, 20 * $multiplier, 26 * $multiplier];
            }
            if ($thispet["age"] == 7) {
                // 7
                if ($thispet["sex"] == 0) {
                    // FEMALE
                    $pet = [$device[6] + 6 * $multiplier, $device[7] - 32 * $multiplier, 162 * $multiplier, 298 * $multiplier, 26 * $multiplier, 28 * $multiplier];
                }
                if ($thispet["sex"] == 1) {
                    // MALE
                    $pet = [$device[6] + 8 * $multiplier, $device[7] - 32 * $multiplier, 134 * $multiplier, 298 * $multiplier, 26 * $multiplier, 28 * $multiplier];
                }
            }
            if ($thispet["age"] == 8) {
                // 8
                if ($thispet["sex"] == 0) {
                    // FEMALE
                    $pet = [$device[6] + 4 * $multiplier, $device[7] - 32 * $multiplier, 222 * $multiplier, 298 * $multiplier, 30 * $multiplier, 28 * $multiplier];
                }
                if ($thispet["sex"] == 1) {
                    // MALE
                    $pet = [$device[6] + 6 * $multiplier, $device[7] - 32 * $multiplier, 190 * $multiplier, 298 * $multiplier, 30 * $multiplier, 28 * $multiplier];
                }
            }
            if ($thispet["age"] == 9) {
                // 9
                if ($thispet["sex"] == 0) {
                    // FEMALE
                    $pet = [$device[6] + 4 * $multiplier, $device[7] - 32 * $multiplier, 286 * $multiplier, 298 * $multiplier, 30 * $multiplier, 28 * $multiplier];
                }
                if ($thispet["sex"] == 1) {
                    // MALE
                    $pet = [$device[6] + 6 * $multiplier, $device[7] - 32 * $multiplier, 254 * $multiplier, 298 * $multiplier, 30 * $multiplier, 28 * $multiplier];
                }
            }
            if ($thispet["age"] == 10) {
                // 10
                if ($thispet["sex"] == 0) {
                    // FEMALE
                    $pet = [$device[6] + 6 * $multiplier, $device[7] + 12 * $multiplier, 356 * $multiplier, 280 * $multiplier, 38 * $multiplier, 46 * $multiplier];
                }
                if ($thispet["sex"] == 1) {
                    // MALE
                    $pet = [$device[6] + 10 * $multiplier, $device[7] + 12 * $multiplier, 318 * $multiplier, 276 * $multiplier, 36 * $multiplier, 50 * $multiplier];
                }
            }
        } // end if species block for Chunneko

What exactly do these numbers mean? How are they calculated? I only vaguely know! If any really smart PHP wizards want to figure out how to replace this with an automatic system ~ I would be eternally grateful  :omg:


Ok wow, yeah that looks a mess! I wonder what the $device array holds? It's pulling something out of there to get to stats, and it's also not using the first 6 objects in it (at least not here). It also looks like each of the species have different stats?

I'd have to see all of the code to know for sure, but it seems like the pets would best be handled by objects (because it looks like they're currently stored as variables?). Then you could collapse all of that repetition into an object call for each of them instead of copy/pasting a bunch of variables over and over again. But I dunno, that could be totally wrong based on what else is going on with the site. Also changing the basic pet code would probably entail a lot more work than just this portion you've posted here.
Logged

Melooon
Hero Member ⚓︎
*****


So many stars!

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: melon
iMood: Melonking
Itch.io: My Games
RSS: RSS

View Profile WWWArt

Emergency feel-good teaa silly heart 4 melon :)Ozwomp wants to know your locationHyperactive DonutGreat Posts PacmanOfficially Dog
« Reply #61 on: February 05, 2025 @738.02 »

I wonder what the $device array holds?
Ok so I can decode it a little; what your looking at is called the img2.php file; and its the final render of all TamaNotchis, when you see a tama, it was created by this file.

The $device contains the parameters for the tama's device (the console thingy they are in before adulthood); Im unsure why that pet does not used the first 6 values though.
EDIT: I found a key in the comments!
Code
//********** set device shape coords (x/y start, width/height, x/y start for the buttons, x/y to place buttons)
        // of course only do this if the pet isn't fully-grown!

The $multiplier is only ever 1 or 0.5, and it's what lets you select between a big tama or a small one in your embeds. I believe all the actual numbers are relative positioning coordinates to pull the pets template out of a single sprite sheet.

Once it has all the parts of the pet from the spritesheet, it layers them, tints them based on your colour choices from the database and renders them as a single png.

I think your suggestion of converting it into a class is actually a really good one; this is an end-result file, meaning no other scripts depend on it; it just returns images; so it can be changed pretty freely, the key thing is that this file gets called prob 100k+ times a day, so it needs to be reaallly fast :omg:

Maybe there is a hope :grin:
Logged


everything lost will be recovered, when you drift into the arms of the undiscovered
TheFrugalGamer
Hero Member ⚓︎
*****


⛺︎ My Room
Itch.io: My Games
RSS: RSS

View Profile WWWArt

See A Bug Summer 2025 ParticipantGreat Posts PacmanFirst 1000 Members!Pocket Icelogist!Joined 2022!
« Reply #62 on: February 05, 2025 @746.25 »

I think your suggestion of converting it into a class is actually a really good one; this is an end-result file, meaning no other scripts depend on it; it just returns images; so it can be changed pretty freely, the key thing is that this file gets called prob 100k+ times a day, so it needs to be reaallly fast :omg:

Maybe there is a hope :grin:

Yeah, I would've also suggested switch statements for the age, but I think in most languages those are actually slightly slower than the if statements, though they are easier to read.

I'm not sure how you'd streamline the sprite sheet--working with images for me has always lead to ugly code. I am a bit confused by the multiplier bit, though. Since the sprites themselves are so small, I would've served up the same image for both and used CSS to make one smaller, which would clean up the code a lot and be faster, since CSS always renders pretty quick. Come to think of it, the tints could also be done via CSS probably, but it wouldn't work for folks who wanted to right-click save their sprites for whatever reason.
Logged

GlitchyZorua
Sr. Member ⚓︎
****


existing

⛺︎ My Room
SpaceHey: Friend Me!
iMood: glitchyzorua
Matrix: Chat!

View Profile WWW

Great Posts Pacmanmicrosoft toaster-finderzoru gameboy dudeGlitched Away From SinnohJoined 2024!
« Reply #63 on: April 08, 2025 @875.37 »

Suggestion! Would be very smart if you can allow us to login with Melonland Forum, (you know, like login with Google), so it'll be easier to login for forum users without the need to type in your password!

you just gotta link your forum account to tamanotchi, (to verify its your forum account, and your tamanotchi), and voila!

This will feel much more nicely this way, since the wiki, melons post office, pad, and more, connects your melonland forum account. Is this to replace the current register username & password system? No. this just makes things feel more nice. :)
Logged

With loves and hugs, GlitchyZorua

grubbyfox
Sr. Member ⚓︎
****


forever in 2006

⛺︎ My Room
SpaceHey: Friend Me!
iMood: grubbyfox

View Profile WWW

Joined 2023!
« Reply #64 on: August 14, 2025 @538.19 »

maybe it's somewhere here in the thread already but i couldn't find it - is it possible to get a code for websites in which you feed the tamanotchi (clicking on it) without going to the website? maybe you want clicking on it directed to the website, haha idk but i wouldn't mind a small text underneath like "thanks for the food" / click to visit or something? they look very clickable but it's feels kinda odd that it just makes you leave the website, ya know?
Logged

Melooon
Hero Member ⚓︎
*****


So many stars!

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: melon
iMood: Melonking
Itch.io: My Games
RSS: RSS

View Profile WWWArt

Emergency feel-good teaa silly heart 4 melon :)Ozwomp wants to know your locationHyperactive DonutGreat Posts PacmanOfficially Dog
« Reply #65 on: August 14, 2025 @814.06 »

is it possible to get a code for websites in which you feed the tamanotchi (clicking on it) without going to the website?
It's not currently provided since tamanotchis are just images with links, you'd have to convert the notchi to a script to do this - I think it would be possible to write such a script yourself though (make it send a fetch request to the tamanotchi when its clicked instead of it being a link, then add your own Thanks for the food text)

That would be a nice mini project for someone to figure out :wink:
Logged


everything lost will be recovered, when you drift into the arms of the undiscovered
grubbyfox
Sr. Member ⚓︎
****


forever in 2006

⛺︎ My Room
SpaceHey: Friend Me!
iMood: grubbyfox

View Profile WWW

Joined 2023!
« Reply #66 on: August 14, 2025 @923.03 »

It's not currently provided since tamanotchis are just images with links, you'd have to convert the notchi to a script to do this - I think it would be possible to write such a script yourself though (make it send a fetch request to the tamanotchi when its clicked instead of it being a link, then add your own Thanks for the food text)

That would be a nice mini project for someone to figure out :wink:


:-0 interesting! i dont know squat about writing scripts, lmao i can barely put text in italics yet in html yet, hehe but if someone did, i hope they'll share it here cause I love putting those lil notchis on web pages lol :loved:
Logged

duducat
Newbie ⚓︎
*

⛺︎ My Room

View Profile WWW

Joined 2025!
« Reply #67 on: August 15, 2025 @651.30 »

Is it possible to add a public API for retrieving the tamaNOTchis' info via JavaScript so I can show them on my website? If it's not possible you can at least add a
Code
Access-Control-Allow-Origin: *
header to the embed image response so I can hack my way into getting the hunger value ;P
Logged
Pages: 1 ... 3 4 [5] Print 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi