|
Post by griffy on Feb 4, 2023 11:56:22 GMT -5
Haven't been here for a while but got curious about something wondered if anyone knew anything. I was thinking about the way the 3D style in petz works as it is kind of interesting. I heard the petz way of doing 3D is based on this thing called Ballz which was first used in a different game. From using the hex editor I do remember how the ballz were grouped and some were bridged together like the ears. Though it has been a while for me since I touched it xp
I wondered has anyone actually tried to make petz like character outside of editing and hexing in petz? Have there been any games which used a similar sort of aesthetic or implementation? And also what do people understand of it. I heard the ballz technology is kinda like a point cloud? Or something I don't know just heard. I remember I heard it was patented tech or something being unique but would guess it would have expired. I haven't seen much that does remind me, other than pixel petz reminds me of petz but that is not alike graphically just some elements do other than the name. And i've seen some weird indie games, pet games the like with weird block shapes or such but still nothing quite like, like sphere based graphics. Another thing I did/do like was all those cool textures with petz, and ofc the community ones are pretty nice.
|
|
|
Post by Reflet on Feb 5, 2023 13:32:57 GMT -5
Hoo boy this is a big question lol. I will share what I know at this time: - Petz's graphics are all rendered in software using custom algorithms (presumably) that draw elements pixel by pixel.
- There is a Z axis in animations, but this is used purely for determining what order to draw elements in. They don't change size depending on their distance from the camera/each other.
- The DrawPort that holds the pixel data each frame is always as big as your largest monitor's resolution, even if the game window is smaller. Space extends to the right and down from the top left corner, and space outside the game window in those directions goes unused. The game leaves a 128-pixel margin on all sides in order to properly draw elements that are partially off-screen.
- In Petz 3/4, the DrawPort is a bitmap with 8-bit indexed color (aka, 1 pixel = 1 byte). It is StretchBlt'd directly to the client area of the game window (mode SRCCOPY).
Now, the algorithms for creating the shapes are pretty complex, but I will try to sum them up to the best of my ability (Note that I'm very bad at + not knowledgeable in math, but through careful reverse engineering I've been able to extract the algorithms even if I don't really understand the theory behind them.) According to my notes (I need to double check this eventually), the "size" property in LNZ code is translated to pixels as follows:
((speciesScale + petScale) * ballScale) / 512 BallzGiven a diameter d in pixels, for each y point along the radius r, calculate the corresponding x point, starting from y=1 and ending when y≥r. This will draw an arc: ...which is mirrored vertically: Then the width of each row of pixels is calculated via: w = d - (x * 2) Now, there are 6 different types of ballz: - Normal
- Emboss
- Outline
- Specular
- Clip (iris)
- Rotated (eyelid)
Emboss colors the first pixel in each row on EITHER the left or right half with the outline color.Outline width 1 looks like the image above, where the first AND last pixels of each row are colored with the outline color. Outline widths > 1 is kinda like drawing a ball of size s and then drawing a ball of size s - outlineWidth on top of it:Specular, used in dog noses, calculates a "shine" effect with up to 8 different colors (including the ball color, which is forced to be black).Given a ball of diameter d whose top-left corner coordinates are x1y1 and bottom-right coordinates are x2y2, the algorithm offsets both x1y1 and x2y2 for each of the 7 specular colors. If the ball is small enough, the calculations in the algorithm will eventually yield 0, therefore no longer changing the coordinates of each remaining shine color and causing them to overlap. In the following image, only shine colors 1, 2, and 7 are present, because 3-7 overlap:Clip and Rotated (especially Rotated!) are more complex. The former is used for irises, to "clip" their position inside the eye ball (the crosshairs here are showing the center of the eye ball, which is the game's point of reference for clipping):
Currently I am still working on documenting the algorithm of Rotated circles (eyelids). It is extremely complex and factors in the pet's overall rotation, head rotation, and eyelid angle. If you look closely at the above image, you can see that the iris's final position is also affected by how open/closed the eyelid is. LinezA line is really a four-sided polygon that functions as a line connecting two ballz. The exact distance between the two vertices on each end depends on the corresponding ball’s diameter and a given “thickness” percentage t for that end of the line. Given two ballz with diameters dn and coordinates xnyn, first calculate the X and Y coordinates of the line’s four vertices (two vertices per ball, where tn is a percentage to reduce dn by). Now, we must calculate the origin of the line (the top left corner), as well as its height and width in pixels, by finding the leftmost X coordinate, topmost Y coordinate, rightmost X coordinate, and bottommost Y coordinate out of all our vertices. Finally, with the above information, we can calculate the start and end X points of each Y point in the line. Linez outlines have two modes. The first outlines all 4 sides of the line, with the L and R colors each taking 2 sides: And the second simply outlines the two visible sides ('visible' assuming the ballz are drawn after the linez, which is not the case in these images): Unlike ballz, linez outlines don't have a width setting, iirc they just overwrite the outermost pixel colors. But they do have a flag that can force them to render after ballz (without using the global [Draw Linez Before Ballz] setting). Fuzz, for both ballz and linez, is simply the number of pixels to shift a given horizontal slice along the X axis, half in each direction. Fuzz can range from 0 - 7. Fun fact: the exact number of pixels to shift each row (for each fuzz level above 0) are generated randomly when the game starts. I have not yet looked into paint ballz or textures but they are on my list after eyelids.
|
|
|
Post by lobb on Feb 17, 2023 13:51:34 GMT -5
I don't know about using the actual same technology but there was another Andrew Stern pet game for iPhones way back when. It used 3D graphics but had a very similar aesthetic to petz!
Reflet this explanation is so cool, thank you! The only thing I can add (if you or anyone else are curious about PFM graphics in general) is that Babyz implemented yet another feature called "polygonz" that draw a flat shape between more than two ballz. It would have been so awesome if we'd ever gotten a Petz game with those! It seems like PFM were trying to expand the possibilities of their system but sadly didn't get to do that more.
|
|
|
Post by Reflet on Feb 18, 2023 20:16:46 GMT -5
I don't know about using the actual same technology but there was another Andrew Stern pet game for iPhones way back when. It used 3D graphics but had a very similar aesthetic to petz!
Reflet this explanation is so cool, thank you! The only thing I can add (if you or anyone else are curious about PFM graphics in general) is that Babyz implemented yet another feature called "polygonz" that draw a flat shape between more than two ballz. It would have been so awesome if we'd ever gotten a Petz game with those! It seems like PFM were trying to expand the possibilities of their system but sadly didn't get to do that more. Yes I heard about those! I've not played Babyz but they sound like the same concept as linez actually, except all 4 vertices can be specified independently as opposed to being determined by the positions+sizes of 2 ballz. I think if you tried hard enough you could do "polygonz" in Petz, sorta... just give the ballz invalid types to make them invisible and be really precise about their placement, anchoring, and size.
|
|
|
Post by griffy on Feb 20, 2023 16:21:36 GMT -5
Finally got a look back at thread RefletOh wow that's a lot more on this topic than I expected even the algorithms thanks for all this detail Rotation of the eye compared to eye lid makes sense if they are moving around The linez were something I was wondering on too and the fuzz. So that fuzz is really just a lot of pixels shifting lobb oh thats interesting to hear that there are other games with a similar aesthetic >-< The polygons could be pretty cool in petz honestly baby had many neat features that could have worked in petz too or maybe that's just me wanting more lol
|
|