Jump to content

Digital

Members
  • Posts

    1,503
  • Joined

  • Last visited

  • Days Won

    28

Posts posted by Digital

  1. 10 hours ago, Hare said:

    Thank you for the input! That's what I hoped. 

    There's a lot of ways the colros could be done with the genetics so I'm not sure which would be best. 

    Maybe the creator uploads the layer with the color they want to be the 'natural' version, but the presence of certain alleles in a particular gene can change the color. For example, color of the base is determined by N = natural, ylwylw = yellow, blublu = blue, redred = red, ylwblu = green, ylwred = orange, redblu = purple, etc. 

    That could definitely make things very cool. I have not really taken too much time in researching anything more then the general concepts of genetics, but now that you clarified it, it makes sense.

  2. It is a really good idea! I love the premise.

    I believe you covered enough to protect the copyrights on the pets, and with a little vetting before new pets go live (say maybe they have to reviewed before going live to other players), you remove the worry of seeing a wild Trump appear.

    I like the idea of layers, I already in my mind see the UI being awesome for that. I am a little ponderous on the how the colorization and genetics would work together though?

    Great idea for a game @Hare!

  3. 6 hours ago, Hare said:

    Oh my goodness, thank you Digital! I didn't know you could do it that way with PDO. =D

    In my game (inactive development), I actually moved all the setup for a species into a database. That way I could actually add new species without having to edit code unless I wanted to add something more to all species. I figured it made more sense.

    Usually by separating your data (species colors or layers) into the database, you end up with very manageable code.

  4. 1 hour ago, Dinocanid said:

    What version of ImageMagick are you using? It seems that Imagick PHP 5.4 can't find relative paths, or at least I can't get it to. I tried using absolute paths (C:\xampp), but that seems to break the code:

    
    $images = array(
    	'C:\xampp\htdocs\wild-souls\picuploads\wolf_images\pup\bases\' . $pet['base'] . 'base-pup.png',
    	'C:\xampp\htdocs\wild-souls\picuploads\wolf_images\pup\markings\' . $pet['marking1'] . '-pup.png',
    	'C:\xampp\htdocs\wild-souls\picuploads\wolf_images\pup\lineart-pup.png'
    );

    (My naming conventions for these files are usually things like "brown base-pup.png" or " white ears-pup.png")

    Absolute paths work without the variables in-between, but I need those unless I use a very long switch statement.

    Escape your \ characters. So they would look like:

    $images = array(
    	'C:\\xampp\\htdocs\\wild-souls\\picuploads\\wolf_images\\pup\\bases\\' . $pet['base'] . 'base-pup.png',
    	'C:\\xampp\\htdocs\\wild-souls\\picuploads\\wolf_images\\pup\\markings\\' . $pet['marking1'] . '-pup.png',
    	'C:\\xampp\\htdocs\\wild-souls\\picuploads\\wolf_images\\pup\\lineart-pup.png'
    );

     

  5. 1 minute ago, Hare said:

    Ooh, I want to know about this. =o I noticed (at least from what I can tell) that queries do not seem to work in Imagemagick files. So if you were to only $_GET the pet's ID, how would you go about getting species/color info? Is there a special kind of query or other trick to it? 

    I can see how just passing the ID through $_GET would work for customizations if you have the images for those saved by pet ID.

    The idea is not to save the image (you could cache them if you wanted to), but rather store the details of the pet in a database for retrieval and rebuild the image dynamically off of that. if you concerned about performance, you could apply caching, however that is a more advanced topic and really just wraps around the generation.

    A very simple process is to have a pet with say 3 columns that identify them. species, marking, and color. You can even have several different tables, but in the example here, let's keep it simple. If enough people ask, I can actually provide a more complex structure that I used in my game in development.

    Below is the script from above with some added PDO (PHP's database layer) to query for pet information before we render.

    <?php
    
    // First lets see if we have an "pet_id" added to the query string.
    if(!isset($_GET['pet_id']))
        die('We need an id!'); // if this page is called in am img tag, it will appear broken.
    
    // Not included in this example is any validation that pet_id is a number or safe.
    
    // Lets setup the database.
    $host = '127.0.0.1';
    $db   = 'test';
    $user = 'root';
    $pass = '';
    $charset = 'utf8';
    
    $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
    $opt = [
        PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
        PDO::ATTR_EMULATE_PREPARES   => false,
    ];
    $pdo = new PDO($dsn, $user, $pass, $opt);
    
    // Lets get the pet information.
    // Note, the pet table has 3 columns + id in this example for customization:
    //   pet_id = INT
    //   species - VARCHAR
    //   markings - VARCHAR - contains a marking type to include
    //   color - VARCHAR - contains a string in a ImagicPixel format (i.e. "rgba(125,125,125,1)")
    // Your pet table would normally contain name or other fields, we are keeping simple in this example.
    
    $stmt = $pdo->prepare('SELECT * FROM pets WHERE pet_id = ?');
    $stmt->execute([$_GET['pet_id']]);
    $pet = $stmt->fetch();
    
    // Remember to order these in reverse, the last element in the array should always be the top layer you will see (usually lineart). All images should be the same dimensions.
    // Note that we are using variables from our table to build the correct images we would need for this pet.
    $images = array(
    	'path/to/' . $pet['species'] . '/base.png',
    	'path/to/' . $pet['species'] . '/' .  $pet['markings'] . '.png',
    	'path/to/' . $pet['species'] . '/lineart.png'
    );
    
    // This creates the Imagick class that we will use.
    $composed_image = new \Imagick($images);
    
    // Now we can actually do some fun stuff such as color or tint the layers.
    // For instance, let's tint the base. I am using random (probably awful colors)
    
    // Base
    $composed_image->setIteratorIndex(0);
    $composed_image->colorizeImage(new \ImagickPixel($pet['color']), new \ImagickPixel("rgba(128,128,128,1"));
    $composed_image->tintImage(new \ImagickPixel($pet['color']), new \ImagickPixel("rgba(128,128,128,1"));
    
    // As you see above, by calling setIteratorIndex(), you switch your "working layer" to the layer you wish to modify.
    // Now lets flatten it and display it. This creates a new Imagick instance to work with with only one flat image.
    $image = $composed_image->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
    $image->setImageFormat('png');
    
    header('Content-type: image/png');
    echo $image->getImageBlob();

    The main point is to store what you need to reconstruct the pets image. This sample means one script can display really any species of pet, with a different base color and markings layer.

    @Hare I hope this is what you are asking about?

  6. 7 hours ago, Hare said:

    Yeah, you can use $_GET for that. Have your $_GET variables at the top of the imagemagick file and use them to determine which layers are rendered (and how). 

    Say you want to render the image on a pet's profile. This pet is a Cat with orange markings. 

    You echo  <img src='petimage.php?species=cat&markings=orange'>

    I'm not real familiar with ajax. What I do is put the image files in a pet image folder, and have the names of the files be in the database. So you'd have a folder for each pet species, and each one has a lineart.png in it for example. And then each species' folder also has the markings and whatnot. Keep the names consistent accross all species folders to make sure your imagemagick code and database are synced up.

     

    You can use also use a variable that is a pet's id in a database or anything else to get the information if you don't want to pass all the options in, or you have very unique customizations going on.

  7. $composed_image->compositeImage( new \Imagick($images[0]), \Imagick::COMPOSITE_OVERLAY, 0, 0 );

    You can try the above. Basically the error is saying that you are passing in a string (the image path) instead of a Imagick object. Bascially just taking the image and creating an instance will solve it.

  8. On 8/7/2017 at 3:48 PM, hurricaneviolet said:

    Finishing up a few odds and ends so I can re-apply for Adsense, and also to tie up some loose ends before I go on vacation (re-write the TOS, send some marketing emails, send the newsletter). Nothing super exciting!

    But don'tcha know.. rewriting a TOS is the most exciting part of pet site ownership! :D 

  9. I am not sure if @Hare would be up to help more.

    So, basically you are merging layers together into a new image. You determine the layers to compose together. You are basically piecing parts of it together.

    A simple (untested) version could look like:

    <?php
    // Remember to order these in reverse, the last element in the array should always be the top layer you will see (usually lineart). All images should be the same dimensions.
    $images = array(
    	'path/to/base.png',
    	'path/to/marking.png',
    	'path/to/lineart.png'
    );
    
    // This creates the Imagick class that we will use.
    $composed_image = new \Imagick($images);
    
    // Now we can actually do some fun stuff such as color or tint the layers.
    // For instance, let's tint the base. I am using random (probably awful colors)
    
    // Base
    $composed_image->setIteratorIndex(0);
    $composed_image->colorizeImage(new \ImagickPixel("rgba(24,35,22,1)"), new \ImagickPixel("rgba(128,128,128,1"));
    $composed_image->tintImage(new \ImagickPixel("rgba(24,35,22,1)"), new \ImagickPixel("rgba(128,128,128,1"));
    
    // As you see above, by calling setIteratorIndex(), you switch your "working layer" to the layer you wish to modify.
    // Now lets flatten it and display it. This creates a new Imagick instance to work with with only one flat image.
    $image = $composed_image->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
    $image->setImageFormat('png');
    
    header('Content-type: image/png');
    echo $image->getImageBlob();
    
    			

    Hopefully this helps to provide a little more insight. The documentation is rather useful.

  10. Just now, Hare said:

    We're still in the year-long process of switching all our breeds over to the new layer system. Just got done with Lionheads, this week my goal is to finish the Lop Crosses (which are getting a full artwork update).

    rabbit.php?abre=lc&%20%20style=1&%20%20brabbit.php?abre=lc&%20%20style=1&%20%20b

    These are the updated Lop Crosses so far in black and white (albino). Attached is the old one (in a different color, but you can still see the artwork difference). 

    5985494033916_ScreenShot2017-08-05at12_57_18AM.png.36b468bf4c7cbb3f43734d74f2edded1.png

    I love that art update for the Lop Crosses. Those eyes tho :heart: 

    Sounds like you are making great progress on moving everything over to the new system!

  11. As I am sure everyone is noticing, some new colors have been used on the forums, as well as a new logo and header background. I was beginning to feel that the old design, although clean and presentable didn't match the feel I wanted. I wanted the colors to be a little more vibrant and alive feeling as well.

    The new logo is designed be more minimalist and clean. I have dropped the joystick feel as it isn't really representative of our community. Altough the TGL logo will stay, the logo may change still with the slogan.

    Tweaks can still happen, and I would love to hear some feedback.

    Social network branding will be updated over the next week as well to match the logo change.

  12. 16 hours ago, Aminirus said:

    Well, as Wild Howlz is still in development, I'm mostly working on written aspects and information. A lot of it will be just gathering and putting together images and figuring out what still needs to be done for first explorable region. I also have a battle system to rework and write out the details for that for @Anoua . I love doing the artwork and the creative process, but main, writing up information, documents, and organizing things so that way it can be better used for the future is exhausting. It's surely not my favorite thing, but I know that it needs to be done.

    I can totally relate about having to write things up. As a developer, often times I find myself dreading having to document what I did.

    16 hours ago, Dinocanid said:

    I plan to add more 'essentials' to my game this weekend. Right now it's pretty bare-bones, and I have to work towards stuff you would normally see in a breeding sim; like a proper trade system, and breeding requests. The economy is all out of wack too, so I need to fix that. After I do all of that, then I can focus on adding new species.

    I am looking forward to seeing more awesome updates about your progress @Dinocanid!

    3 hours ago, SilverBrick said:

    @Digital- nothing much so preparing some ideas for the town so far we know that the town is called Wingsville and done a WIP art of it and have some exam so studying for it and relaxing because my right hand is broken and it might soon recover

    I hope your hand recovers soon and well! The WIP art looks amazing!

  13. This is for those members who are still completing their classes, and have been on break over summer. Ready to go back? Looking forward to it?

    I guess in retrospect, as a grown working adult, I kinda miss breaks. I will however enjoy when my older son gets back into the daily school thing.

×
×
  • Create New...