-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Custom Sprites to Bots #24
Comments
OK, That is cool. Keep in mind that robots in the viewer must be scaled to the arena and screen size. See "scale" in viewer code. Not all images will scale well. What are the requirements of the image? What can tkinter display? How do we send the image from robot to server to viewer? Also, we need to make sure this does not conflict with #28. |
Regarding tkinter's display capabilities, tkinter can display .gif images using the PhotoImage class and has a function to scale images. There should be a size requirement of the image such as 25 by 25 pixels. I have not figured out what kind of scaling tkinter uses. |
OK, lets' assume we go with 25x25 images. There is a limit for the size of a message being sent over the network but I think a 25x25 image should be OK. I am concerned about how we can send the bytes over the network. I suggest a prototype test that loads an image, packs it in network format, unpacks it back to python PhotoImage class, then scales and displays it in a tk window. In python/pseudocode:
|
This encodes the image in base64 so it can be transferred, then uses the built in feature of tkinter's PhotoImage class to translate the base64 string to an image.
|
Good work on this! The base64 encoding is not actually requited. MesssagePack is capable of packing a python byte array. So you can just read the file data into memory and then pack it. This will be a bit faster because you don't do the base64 encode/decode. It will also send about 20% less data over the network since base64 is larger.
|
Since adding custom images to bots isn't feasible with just tkinter, would we be able to add a feature that would allow bots to customize their colour? |
Yes, that would be good. Then during testing the bot you care about would always have the same color. I suggest:
This still has the issue of two bots in the viewer which end up with very similar colors but it a robot's preferred color is not close to any of the default viewer colors then it would work. |
Is your feature request related to a problem? Please describe.
Currently there are only eight colours of bots, which the bot/client does not select. These limit the visual customization of a bot.
Describe the solution you'd like
When the bot connects to the server, it would have a choice to send an image that would replace the colour of the bot. This image would replace the colour for the whole tournament.
Describe alternatives you've considered
Allow the bot to chose its own colour would also allow for limited customization of the bot. This could be done by sending a hex code to the server. However, this might cause an issue if two bots pick similar or the same colours.
The text was updated successfully, but these errors were encountered: