PokeAPI / sprites

Repository containing all the Pokémon sprites
Other
1.08k stars 268 forks source link

Can we add animated sprites and svg files? #12

Closed Zahinize closed 4 years ago

Zahinize commented 5 years ago

Hi Everyone! I hope all of you are well and doing great 😃 .

Firstly, i would like to congratulate the whole PokeAPI team for building a fantastic product that serves free Pokemon related information to millions of developers every month! Take a bow, you all 👏 🎉

Secondly, as stated in my question, is it possible to add animated sprites like Animated-Zapdos and svg files like SVG-Squirtle for available pokemons in this repository? I can imagine that both animated sprites and svg files will provide their valid use cases for different category of developers (like game/apps/web developers) and PokeAPI will enrich its data offering with these new additions.

I would like to know what PokeAPI team think about this? @Naramsim I would love to take up this responsibility and make a pull request to add animated sprites and SVG files in this repository and discuss further on how we can provide these files in API.

Looking forward to our discussion on this. Zahin

Naramsim commented 5 years ago

Hi Zahin. We would love to, I guess. The problem is that I'm not sure whether we can legally. Do you think so?

Also keep in mind that we can find basically all the images on veekun: http://git.veekun.com/pokedex-media.git/tree

Zahinize commented 5 years ago

Hi @Naramsim. I hope you are fine and doing great 😃.

I apologize for answering so late on this discussion thread. Pokemon is very close to my heart and I am very excited to be a part of it 😄 . I was ill and needed some time off with family.

The problem is that I'm not sure whether we can legally. Do you think so?

Before I raised this issue on your repo, I went through the source websites of animated sprites and SVG files that I was tinkering with.

Animated sprites link such as Zapdos was taken from PokemonDB website and below is an excerpt from one of their relevant FAQ question, Can I use some content from your site?

However, official Pokémon artwork and sprites are not our creations and are used under a Fair Use Policy, so you are free to use them however you like. Each of the Pokémon sprites pages has an easy way to add images to your site or forum post.

I think we can legally scrap/download these image sprites (static and animated) from either their server or from Veekun bulk image downloads page that is free to use.

SVG file link such as Squirtle was taken from Veekun website only. I think it is free to use in any way we want to.

So, in my opinion, we can legally use these animated sprites and SVG files in PokeAPI. What do you guys think about this?

Zahin

Naramsim commented 5 years ago

Hi, ok probably all of them are free to use. Anyway, I don't see anyone implementing the feature on our server. Sure, we could add them to this repository but the ideal thing would be to link each resource to each pokemon. Right now this is the structure for the sprites:

sprites: {
back_default: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/25.png",
back_female: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/female/25.png",
back_shiny: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/25.png",
back_shiny_female: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/female/25.png",
front_default: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/25.png",
front_female: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/female/25.png",
front_shiny: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/25.png",
front_shiny_female: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/female/25.png"
},
C-Garza commented 4 years ago

Hello, I'm interested in working on this issue and get it working but I have a couple of questions. The sprites currently used for the API have a 2D animation sprite but only up to Gen 5 (The first 649 Pokemon). After that, the games start using 3D models and 3D animtion sprites.

My first question is should we add both sets of animation sprites?

My second question is how do we want to configure the new data? Should they be added in one big sprite resource like:

sprites: {
front_default: "",
front_default_2d_ani: "",
front_default_3d_ani: "",
back_default: "",
back_default_2d_ani: "",
back_default_3d_ani" "",
...
},

Or should we add a new resource like:

sprites: {
front_default: "",
back_default: "",
front_female: "",
back_female: "",
...
},
sprites_animate: {
front_default_2d_ani: "",
front_default_3d_ani: "",
back_default_2d_ani: "",
back_default_3d_ani: "",
...
}
Naramsim commented 4 years ago

Hi @C-Garza, thanks first of all.

So, I think that we could add all the sprites then. I would first define a structure for this repository and then reflect the changes to our API. We need to keep in mind that we shouldn't break the API with breaking changes.

We could add all the sprites that Veekun offers to this repo.

Right now we have two folders:

/sprites/pokemon
/sprites/items

I would transform it to:

/sprites/pokemon
/sprites/pokemon/other/conquest
/sprites/pokemon/other/dream-world
/sprites/pokemon/other/global-link
/sprites/pokemon/other/overworld
/sprites/pokemon/other/sugimori
/sprites/pokemon/other/trozei
/sprites/pokemon/versions/black-white
/sprites/pokemon/versions/crystal
/sprites/pokemon/versions/diamond-pearl
/sprites/pokemon/versions/emerald
/sprites/pokemon/versions/...
/sprites/pokemon/versions/x-y
/sprites/pokemon/versions/yellow
/sprites/items

And then having a mapping to the API like the one below, so as not to break anything.

sprites: {
back_default: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/133.png",
back_female: null,
back_shiny: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/133.png",
back_shiny_female: null,
front_default: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/133.png",
front_female: null,
front_shiny: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/133.png",
front_shiny_female: null,
other: {newstuffhere}
versions: {newstuffhere}
},

We could also use Pokemon Showdown as a source, they provide Gifs: http://play.pokemonshowdown.com/sprites/

C-Garza commented 4 years ago

So I've forked the PokeAPI and I've started to map the new sprites to the API but I've got another question. I've noticed that the PokeAPI repo has its own sprites folder, and in the build.py script it gets all the file names in the sprites folder and prepends "media/sprites/" to the file path.

My question is am I going to have to upload all the new images to that repository as well?

Naramsim commented 4 years ago

Hi @C-Garza, yes. The sprites folder of pokeapi has to be the same as the sprites one.

Christian, could you tell me the size of all the new images that you've added. Because maybe it's worth reducing the number of pictures inside the repository.

Ah, feel free to change the logic of pokeapi, so that the local sprites folder isn't necessary anymore.

Naramsim commented 4 years ago

@C-Garza, also I would take the opportunity to discuss the new structure of the sprites property that I mentioned some comments above.

Maybe also @Zahinize could contribute. We also need to think about adding the 3D sprites you were asking for, so better to have a clear picture before moving on too much with the development.

Thanks

C-Garza commented 4 years ago

I was going to map it like @Naramsim suggested above:

sprites: {
back_default: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/133.png",
...
front_shiny: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/133.png",
front_shiny_female: null,
other: {
  dream-world: {...sprites},
  sugimori: {...sprites},
  ...
}
versions: {
  black_white: {...sprites},
  crystal: {...sprites},
  ...
}
},

essentially mirroring the folder structure of the repo here. The pull request I currently have is all the images mentioned above in two folders, other and versions. The other folder contains images from Veekun in 8 folders for conquest, dream-world, global-link, overworld,sugimori, and trozei. I also added two more folders, animated-2d and animated-3d, with gifs from pokemon showdown. I had to edit the file names for these gifs because they used the pokemon name instead of their id. The versions folder contains 16 folders for all the main games sprites from Veekun.

In total, there are 55,675 files totaling 1 GB. versions has 34,906 of these files and 63.5 MB. other has 20,769 files and 966 MB, but animated-2d, sugimori, and animated_3d take up a majority of that space with 159 MB, 417 MB, and 506 MB respectively.

Ah, feel free to change the logic of pokeapi, so that the local sprites folder isn't necessary anymore.

So if I change some logic I don't have to upload sprites to the PokeAPI repo as well? Because from what I can see it looks like that sprites folder only exists to check if an image exists or not in that code snippet from the build.py file. Is that sprites folder not used anywhere else? Because if that's the case, I was thinking of replacing that folder with a JSON file instead containing the image paths to check if an image exists or not.

Naramsim commented 4 years ago

I also added two more folders, animated-2d and animated-3d, with gifs from pokemon showdown.

What would be the content of the animated-2d and animated-3d folders? Directly images or other flders? I'm asking this question because maybe there are different gifs for different versions. Maybe we could identify from which version those gifs are taken from and add a gif-2d and gif-3d folder under the correct version. Something like below:

sprites: {
back_default: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/133.png",
...
front_shiny: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/133.png",
front_shiny_female: null,
other: {
  dream-world: {...sprites},
  sugimori: {...sprites},
  ...
}
versions: {
  black_white: {
        front: https://url/img.jpg,
        back: https://url/img.jpg,
        shiny-front: https://url/img.jpg,
        shiny-back: https://url/img.jpg,
        front-2d-animated: https://url/img.gif,
        front-3d-animated: https://url/img.gif
  },
  crystal: {...sprites},
  ...
  }
},

So if I change some logic I don't have to upload sprites to the PokeAPI repo as well?

I see a change of logic something that has to be done soon or later, we can't have a duplication of data in two repos. The solution that you proposed about using a JSON to store which images are available and which aren't could work but it can be a pain in the neck when we need to add new images.

Do you know what I was thinking? That maybe we could add the sprites repository as submodule inside the pokeapi repo. So we will have no duplication and to add the images we will only need to add them to the sprites repo without updating any JSON file.


Tell me what you think about the two observations above, please.

C-Garza commented 4 years ago

I believe the animated-2d gifs are the animated sprites from black and white, so they have the same layout as it with a front, back, shiny, and female. I could add them to the black_white in the versions folder. The animated-3d gifs I'm not entirely sure which version they are from, because I think X-Y and Sun-Moon used the same models? It contains animated sprites from Sun-Moon though so I suppose they could go in that versions folder.

I think using this repo as a submodule could work. I tried thinking of some other ways but this seems like the best way to keep track of the changes in this repo.

Naramsim commented 4 years ago

Ok, nice! So I'll see if I can do the submodule later on. In the meantime, you can assume the dream-world sprites are there and try to extend the APIs :)

Thanks a lot!

Naramsim commented 4 years ago

I added the submodule to our pokeapi: https://github.com/PokeAPI/pokeapi/tree/staging

Feel free to use the staging branch and submit your PRs over there :)

Naramsim commented 4 years ago

Now that we added all the Veekun sprites we can think about adding GIF files. I would like to keep the size of this repo quite low. So maybe it's better to add only one gif version. Which GIFs do you suggest adding?

C-Garza commented 4 years ago

The 2D gifs is 159 MB but only go up to gen 5 (they are from Black and White, up to id #649), while the 3D gifs is 347 MB and go up to gen 7 (they are from Sun and Moon, up to id #807 ).

I wanted to add the 2D gifs because the default sprite images are from black and white as well so they are identical really, just animated. But if we do that, then gen 6 and 7 wouldn't have animated sprites. But the 3D gifs have all them up to gen 7, just with their 3D model versions from Sun and Moon.

Personally I like the 2D animations better and want to add them since they match with the default sprite images. The 3D animations are a bit stiff and about twice the size. But at the same time these 3D models are used in gen 6,7, and I even think they're used in gen 8 and there's a model for every pokemon so I'm not sure which to add. What do you think?

Naramsim commented 4 years ago

Then let's add the 2D GIFs of b&w. Later on, we will figure out the 3D. It would be cool to add the 3D in future if there are also the ones for sword&shield.

About the 2D, let's put them in /sprites/version/generation-v/black-and white/animated/

Where can we take them from?

C-Garza commented 4 years ago

I've had them downloaded and renamed to their pokedex id's from Smogon at the same time I got the images from Veekun (the 2D animated folders begin with gen5ani on their site). Should I make a pull request with these gifs then?

Naramsim commented 4 years ago

Well, I guess we can close this issue. Huge thanks to @C-Garza!

We now have animated and SVG images!