PokeAPI / pokeapi

The Pokémon API
https://pokeapi.co
BSD 3-Clause "New" or "Revised" License
4.18k stars 938 forks source link

Missing Sprite Information #80

Closed chiangy77 closed 8 years ago

chiangy77 commented 8 years ago

I was just wondering where you got your sprites from so I could add some more (e.g. all the megas etc)

zaneadix commented 8 years ago

For V2 we haven't got sprites yet. I'm not sure how @phalt handled them with v1. We definitely need to find a solution for this.

phalt commented 8 years ago

Hey folks, we scraped the sprite data from a website and then stuck all the images in a folder. The API just calls the appropriate image. I'd accept a PR adding the additional images in the correct format, that's the best way to do it :)

chiangy77 commented 8 years ago

Which website was scraped? Are we going to continue with the same format in version 2?

phalt commented 8 years ago

@chiangy77 let's try and use the same style of sprites to keep consistency. I am not sure where they were scraped from :(

chiangy77 commented 8 years ago

Bulbapedia has the same sprite styles as version 1 so that could be used, however, each image is surrounded by a massive white margins. Don't know if they can be removed but that is an option

zaneadix commented 8 years ago

I was thinking it might be nice to have more than just sprites. I have a full set of the sugimori artwork pulled from pokemon.com. Also, plenty of rad old style sprites have been done of the new generation so it would be cool if we could have pixel sprites modern 3d sprites sugimori artwork stretch goal?

zaneadix commented 8 years ago

Of course veekun would have them. http://veekun.com/dex/downloads

Downloading the gen V collection gives most recent 2d sprites for 1-649. plenty of other good stuff here. Nice that they also already have solid naming conventions on them too se we could probably build table relations for multiple sprites to tie to different pokemon.

zaneadix commented 8 years ago

Here you can download a .rar of gen 6 spirtes. They look gooood. http://forums.pokemontabletop.com/topic/10102246/1/

phalt commented 8 years ago

The newest sprites look the best, and would fit in with the current ones. We could replace the whole lot in one go perhaps? I don't think that'd be an issue.

zaneadix commented 8 years ago

@phalt are you saying that we would just replace all of the current sprites for V1 with the ones we've linked to above then just link to those images on pokemon resources in v2 as well?

zaneadix commented 8 years ago

https://github.com/msikma/pokesprite

This is also awesome though I dont know that its totally useful to us for pokemon. The pokemon sprites included are not full size (just the small ones for team and pc organization screens). The items and other things though are great.

zaneadix commented 8 years ago

@phalt Sorry for the small barrage here. If I were to put together a folder of images to put up on the server that fit a structure that would suit this, would you be open to adding fields like this to pokemon/form/item/etc resources?

PokemonResource
{
 ...
 images: {
    front: {
      default: "images/pokemon/3.png",
      shiny: "images/pokemon/shiny/3.png"
      female: "images/pokemon/female/3.png",
      female_shiny: "images/pokemon/female/shiny/3.png"
    },
    back: {
      default: "images/pokemon/back/3.png",
      shiny: "images/pokemon/back/shiny/3.png",
      female: "images/pokemon/back/female/3.png",
      female_shiny: "images/pokemon/female/shiny/3.png"
    }
  }
 ...
},

PokemonFormResource
{
 ...
  form_name: "attack",
  images: {
    front: {
      default: "images/pokemon/3-attack.png",
      shiny: "images/pokemon/shiny/3.png"
    },
    back: {
      default: "images/pokemon/back/3-attack.png",
      shiny: "images/pokemon/back/shiny/3-attack.png"
    }
  }
 ...
}
phalt commented 8 years ago

@zaneadix the poke sprite thing looks awesome! It's a shame they're so small.

In response to your example of how the sprites could look, I think we could definitely do that. It's a reasonably big task.

zaneadix commented 8 years ago

@phalt I was thinking if I built out a directory of images I could just write a script to dig through it and build some csv data just like what we've already got. My only block is where we would put the images so people could keep contributing if needed (so we wouldn't need to keep them all in the project). Maybe we could just have a separate repofor images/icons? Not sure if that's overkill. I'll keep thinking on different ways to do it.

phalt commented 8 years ago

@zaneadix for contribution, we can add a directory to this project and allow people to open pull requests.

As for how we can provide these images. We could write a script to traverse the directory, or organise it in such a way and keep it strict enough that we can pre-build the URL links?

zaneadix commented 8 years ago

The only reason I was considering having a script that traverses a directory is for cases where we don't really have a way of knowing what to anticipate. In the case of female specific sprites there isn't really a way of knowing if a pokemon has them based on our current data set, only whether or not they can be female so it would be difficult to know if we should pre-build or not (though I may be short sighted on this). Maybe we could just add something to the build script that traverses a directory for specific resource types, that way we wouldn't need to produce CSVs

zaneadix commented 8 years ago

@phalt what is the location of the media directory on the server? I'm asking so I would be able to build out path strings for images. Would it work to just do something like /media/sprites/pokemon/1.png?

I've created a model called PokemonImageSet to test things out. Heres an example of how the table looks. Thoughts?

screen shot 2016-02-11 at 12 09 12 am
phalt commented 8 years ago

@zaneadix The table looks good, are we going to parse this csv at run time when requesting sprites? Given the size of the table that could be slow. If we store each row as a list of paths then it'll be very fast.

I believe the data is stored in the /media directory, yes

zaneadix commented 8 years ago

@phalt This actually isn't coming from csv, traversing the image directory at the top of data.v2.build and keep a reference to what images we have and then filling in the PokemonImageSet model for each pokemon so it's built dynamically based on what images we have at the time. Is this not a good way of doing this? Would the image directory even be available in on the server?

Including these file references in the pokemon request would just require one more serializer call. would a stringified list be a better way to go?

phalt commented 8 years ago

@zaneadix stringified list is a good way to go. If this is generated on the fly that's totally fine :)

zaneadix commented 8 years ago

104 takes care of this. should be live soon.