#~~Pokemon~~ Bot
1 messages · Page 1 of 1 (latest)
awesome stuff! Gonna beat poketwo with those awesome graphic!
Latest visual update.
This is:
• A command to explore the current zone
• "Rolls a dice" to see if you come across a pokemon, an item, or nothing.
• Creates the pokemon if you find one and puts it into the DB as a wild pokemon.
• Loads both pokemon from the DB (player party and wild pokemon)
• Getting the sprite based on the pokedex id.
• Slapping the background on, then the health bars (which change color based on the % of health left, and is tied to the pokemons hp), adding the status boxes, then the pokemon, then the text box, then the actual text
• Saves the picture to a folder, then loads it as an attachment for an embedded message.
This is the "oc" professor I'm having made for this bot/game.
Devlog #2 - 9/24/23
Updates:
- I implemented SFML to the project in order to provide all those cool graphics we love and enjoy.
- With this, I currently have "dynamic" battle screens that can be generated. Pictures below.
- These dynamic battle screens are intended to mimic the mainline Pokémon games. Of course the pictures wont be interactable, but buttons will be provided to allow you to battle, catch, use items, and run away. I have begun the process of creating these buttons and their functions.
- Generating the images took me some time to get them where they're at now, but the knowledge of how I'm going to continue to approach them should speed things up somewhat.
- On the topic of graphics, shiny Pokémon will be disabled when the beta does begin. If account wipes happen to come in the future, I'd rather people not be as upset.
- I realize this isn't a huge update for three weeks worth of time, but I intend to have "simple battles" with wild pokemon done by the end of October and things should get way more interesting after that point. One of the most time consuming things to do will be to get every move in the game working (there's roughly 900).
- Simple battles will be something along the lines of pokemon having access to simple moves like tackle; if it hits, it does damage and nothing else.
I use a command to search the current area. A wild pokemon shows (I have it set between national dex id 1 - 151) with the wild pokemons HP set to 50% and my pokemons HP set to 19% (testing purposes). My pokemon is already stored in the database under my caught pokemon and in my team. The pokemon chosen for me is taken from my team and the first one alive. The wild pokemon is generated then stored in the database. Running away will remove it from the database.
Just a quick question. Do you have some implementation for image caching? Or you draw images from begining everytime?
And also. Are positions and sizes of parts of images hard coded or are they coefficients so you can create images of any resolution?
Each time the function is called, a new image is created. Positions and sizes are hard coded.
The original sprites are small. Small pokemon are like 32x32 pixels. SFML has a scale function and I double the size of everything.
I am creating the image and saving it to a folder, just in case.
Creating and saving all possible combinations of images is a bad idea
You have a lot of pockemons
And the amount of possible combinations is mind-blowing
I'm not saving all combinations 
When you "explore" and a pokemon appears, a new image is created.
When you explore again and find another pokemon, the old image will be overwritten.
Well, imagine have 10k users
Will you store 10k images
And overwrite them each time?
I also intend, when after you attack, the image will be overwritten with the new health bars and resent
Not very efficient thing. But it fine for beginning
At the moment.
So you caching image without health bar and changing parts
Nice
It is good approach
How could I do it better?
But saving them to disk, well
Each image is like <1mb iirc
In @jade plover I have similar approach, but I store images in RAM while game is active. If it has ended, or timeout has been reached I just clear it
I realize this does stack up
This way I do not utilize disk, have fast access, and caching
Some parts like "dominoes" are cached all the time
Generated once and reused
Chess images as well, loaded once and stays forever
Disk is very slow thing in computer world
Even best SSD is slow compared to ram
And not only in speed, in latency
I need a way to bring fights back if the bot times out or if the bot gets restarted
And in our case latency is a case
You can use database, if you need this
And store just like "user fight"
With data
Well, @jade plover finishes all unfinished games with draw after restart, but you have a different situation
And there is system for safe shutdown
So it will not allow new games but will wait until the old one ends
After each attack used, I'll have to save info to the db
New hp value, for example, yes
Last moves used, field state, etc etc etc
But you need to do something like that anyway, no?
I have some of it at the moment
You can't restore game just from image
Well yeah lol
Also, are you saving PNG or jpg?
Png
PNG is smaller in size but takes much more resources to create
As it has loseles compression
It is fine for now, but can cause something in future
Well, depends what you will be limited to. Cpu or internet
If I put pngs together and save it as a jpg, the transparency from any png should not show up right?
It will.
As transparency at the end creates some color anyway
Then I gotta keep it png.
Like if you have some not filled background it will begin black on jpg
But if you have a fully filled image it will look the same on PNG and jpg
This is all png. Each piece. Charmader has transparency around him. Saving as a jpg, the transparency won't be filled in?
Saving the final image will look the same as with png
It will be the same
As anyway when you put one image on another it begins being one image
It is not different layers like Photoshop
Alright, I'll switch that over to jpg
I'll keep saving images though, until I at least know battles are fully working
should be one line of code to change for you 🙂
It is lol
I have worked with sfml before, so ye
"image.png" -> "image.jpg"
What if 2 people will have fight at the same time?
Would it override someone's images?
Saved to different spots
Ok than
Ah yeah I do need to change that
10k images isnt that much...
trivia@ns3130725:~/www/images$ find {q,r,n} -print | wc -l
12831
triviabot has 12831 cached images right now, for questions, answers, hints
trivia@ns3130725:~/www/images$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 330M 2.8G 11% /run
/dev/md2 412G 144G 248G 37% /
nowhere near full
But images is something which will have full redesign
if i thought i was going to hold many hundreds of thousands however or millions i'd use cloud buckets, e.g. aws or gcloud
you shouldnt - theyre changing how cdn works and adding a timestamp and expiry to the images
while the image remains referenced by a discord api element like an embed, it will remain valid and the expiry will refresh, but take it out of discord e.g. reference the discord cdn image on a website, the link will expire after 24h
Well, all images are runtime generated
Well, it works not like that now
