Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
Dynamically Generated images?
I learned that some sites use this for pet images (and that it can be useful for markings, colors, etc). How would one go about coding this with mysidia? I found a couple of php tutorials but I don't know if they would still work with this script or not. If so, this might make things a lot easier on me just for the pet images (instead of creating about 755 separate breeds, just for Common goldfish alone!)
|
#2
|
||||
|
||||
There are a couple of ways it could be done. Lioden stacks ordinary images on top of one another, Flight Rising saves a bunch of images with the pet's ID (I think), HTML5 Canvas could be an option, but dynamically generating an image from merged layers with a meta header declaring a php script as an image should also work -- I'm just not sure how I feel about the load time of this. If you don't save the "image", merely load it every time for each adopt on the page, then it's like Flight Rising but without the script storing the image afterward.
No matter which route you go you'll want to plan a folder structure ahead of time and add these attributes for your fish into the database as columns (in the table for owned adoptables). You'll want to make a new method inside of the ownedadoptables class, I named mine getLayers(). Look through the whole class and you'll find the method that's being used to call up the images in the site - find every instance where it's being called inside the framework and call your method that'll place in a generated image instead. I won't give you hints on that, though. It's very easy to call up the variables once they exist in your database! I simply made a column called "p_color" to hold my primary colors, its a SMALLINT, and holds simply numbers. They correspond to array that holds all my color names - and all of these color names are the name images in my folders. So, like... PHP Code:
You're basically just going to concatenate these variables together as a string of folders and file names. These are how your code will find the images you want to merge. I'm already storing some custom images in an /img/ folder I created, and my creatures are called Novu, so my folder structure looks like this - Obviously you need to make a folder structure that makes sense for you needs. Genders look different, things get bigger with age, that nonsense. Anyway, I've basically already successfully been able to imitate Lioden with its overlapping images (but not a dynamically generated single image). The concept is virtually the same, its just what you do with those variables once you have them ready to go. I hope its understandable, though, that I don't want a bunch of sites running around with a clone of this particular technique, at least not for free. So this is about all the help I'm willing to give. But I hope I've at least managed to push you in the right direction!
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. Last edited by Kyttias; 03-17-2015 at 03:21 PM. |
#3
|
|||
|
|||
Thanks so much! I thought I had responded to this but I guess I didn't xD
I went over this with my new programmer last night and he has a good idea on where to start now. I do have another question though: In my game, the colors are set up kinda like Flight rising, with a primary, secondary, and tertiary (art wise, I think I like doing that sort of thing for the markings and such rather than more slots for markings like Lioden). Would I have each type of color in it's own folder then? Like this: That's just for the adult forms (I am having three other stages where the colors are slowly revealed, much like actual goldfish). I'm not sure if that's what the folder structure should be though. I'm working on recoloring the art to match the folder structure a little more. I'm also wanting to add on mutations if the offspring is inbred, so would that also be in this folder structure? I'm thinking yes, but am not sure. Last edited by ilrak; 08-25-2015 at 10:14 AM. |
#4
|
||||
|
||||
I'd recommend something like this (just go another folder down):
If you wanted to build a female oranda at level 5, with an obsidian stipple body (primary), copper point fins (secondary), and a chocolate dot marking (tertiary), you'd want to load just these files: images/oranda/f/5/body/stipple/obsidian.png images/oranda/f/5/fins/point/copper.png images/oranda/f/5/markings/dot/chocolate.png images/oranda/f/5/lines.png (And really, you could just store the lines with the colored images. This would even allow you to make fins of slightly different shapes.) I won't help, because I've done it myself and it's a trade secret at this point, but ask your programmer if you can save ONE image (for each body, fin and marking pattern), in just a base color, instead of individual colors -- that he can tint with a color hex code programatically. It's definitely possible, and then you don't have to save each color manually! Think about it, as it can even work with markings that involve more than one color (rather than saving a black and white image, you could, for example, make a yellow dot surrounded by a slightly red outline... tinting it programmatically would be to the same effect as sliding the hue in art program so it's a slightly different shade). If you can get your programmer to tint an image programatically, you can bring it down to just: images/oranda/f/5/body/stipple.png images/oranda/f/5/fins/point.png images/oranda/f/5/markings/dot.png
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. Last edited by Kyttias; 08-25-2015 at 09:27 PM. |
#5
|
|||
|
|||
Thank you so much! I'll show this to my programmer when ge comes over next! I'm guessing that the pets are still created in the admincp, but I'll have him look at it and see what the best way will be to create them! Thank you again so much!
|
#6
|
||||
|
||||
I've personally been thinking about creating a separate place to create pets outside the adminCP, too. x'D They're still created there in name and functionality, even though those images aren't ever seen (I'm uploading lines-only placeholders there so I have a visual). Stages of pets and what level they reach them are all still done in the adminCP.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. |
#7
|
||||
|
||||
Thanks for this info! I'm actually making a non-Mysidia game (a strategy game, not pet related) with an avatar system and I've been trying to decide if I'm going to use the php ImageCopy or try layering images with CSS. This post is very informative.
|
#8
|
||||
|
||||
The plus side to layering images is that they'll be cached by the browser for fast loading. On the other hand, these images are relatively small in size to begin with so load times don't really matter. The down side is, they're a collection of images rather than a truly merged image and therefore cannot be saved. Merging things with GD is definitely possible, so keep looking into it! On the other-other hand, separate images means you can even layer animated gif images onto your avatars - something PHP is still incapable of doing even a decade after people first asked for such features.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. |
#9
|
||||
|
||||
Posting here so I can keep track of this post and not lose it again >.>
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
GD images | mapleblade | Mys v1.2.x Mods | 11 | 03-04-2012 05:39 AM |
no images | RoconzaArt | Questions and Supports | 1 | 03-13-2011 11:39 AM |
More images would be nice. | RoconzaArt | Feedback and Suggestions | 12 | 01-22-2011 11:24 PM |
I cant see the images | zKaZy | Questions and Supports | 11 | 03-28-2010 12:49 PM |
Images not showing | Tequila | Questions and Supports | 22 | 03-07-2009 08:15 AM |
What's New? |
What's Hot? |
What's Popular? |