I chose the Python language, and the difficulty of building the environment was high, so I ended up operating it at a very high cost for maintenance and expansion.
At work I had to create a tool that would work on Mac and Windows. So I chose Python, which can be easily executed from the terminal (command line) of my Mac machine.
This tool synthesizes and outputs a lot of game icon images. The designer creates the icon material, and the Python program outputs a large number of icons while referring to the data on Google Sheets. (Finally, this icon image will be combined into one in the form of Atlas in Unity's NGUI, and it will end as multiple Atlas)
The first thing I learned from using Python this time is the difficulty of building an environment. And, rather than the convenience of a language that does not require build (compilation), there was also a lack of thought about source code control. After all, at first I was only doing simple image composition, so I passed the management of this tool to the designer by zipping the Python source code that ran on my Mac local instead of svn. Because of that, I didn't think that I would have such a hard time later, such as having to prepare a bat file and even a windows machine to check if Python works properly on windows.
I think Python is a very good language. There are already many libraries, and there are libraries for image editing as well, and it is a language that many programmers can handle.
This is because there is no need to build, and there is also the advantage that local data such as Path and file name required for each environment where the tool is used can be written directly in the Python source code and edited.
And the advantage of being able to execute a single file from the command line. Another factor in choosing Python was the lack of the idea of being able to cross-compile to Mac / Windows because it started with a really small program as a realistic task.
The problem with the Python program I made this time is that I need to have a designer who is not a programmer take the time to build an environment such as a library on a machine that runs because it does not require compilation, and I instruct to build that environment ・ This is a point that I had to do.
Now I think I should have chosen a language that can be cross-compiled.
First of all, I wrote Python on a Mac, ran the Python file from the terminal, confirmed that it worked, then zipped it and handed it to the designer via chat. But when I pass it, it doesn't work on Windows. I receive reports of situations and errors in chat and respond, but it does not work at all. Eventually I walked to the designer's seat and checked the program. This interrupted his work and delayed his other implementations.
When I followed the error, I couldn't find the library on my Mac. Certainly there was no Python Imaging Library (PIL) at that time. This guy was really annoying.
First of all, as a solution
$ brew install pil
I remember spending hours investigating the work that only needed to be done, and having the various libraries introduced in vain.
(It's like having some kind of library compiled with gcc ...)
This work was really hard.
Next is the CSV download from Google Sheets. Initially, the item data was referenced from the master data on the game project managed by Unity's Asset Server (Unity's own version control system). However, when the development of the next version is decided, the branch of the project will be newly cut to svn, and the master data referenced so far will be out of date. So to keep the item up to date, I (fortunately) decided to refer to a Google Sheets that is always up to date. I use a Python library called gspread to browse Google Spreadsheets.
I decided to ask the designer to write the google account and its password directly in the bat file that calls Python. And since I was still exchanging with zip, the designer committed zip to svn without my knowledge. This will keep his account and password on svn for the rest of his life, and anyone who can check out this zip file can hijack his account.
I had my password changed.
And because of the danger and gspread's deprecation of email addresses and passwords, OAuth support was needed. Yes, it was no longer a "little program". I skipped it, but of course I had to build gspread in the designer's environment, which was very difficult for me.
And this program is still being maintained and expanded. I'd like to switch quickly, but I haven't been able to devote time to the problem. (Various bad programmers ...)
The mission of this program has always been to reduce the workload of designers. So I'd like to run it from UnityEditor and do an Atlas import, but that's not done all the time due to lack of study and lack of time. I'm not a tool programmer. You also have to implement the game.
However, what I got from this case was very big. A strength that can be executed from the command line by Python. Also, it was found that the burden and management on the execution environment are reduced because the compiled program does not require a library environment. I think this was a very important discovery and experience for me.
And above all, I think I need other inexperienced programmers like myself. If the execution environment of the program you are trying to create spans multiple operating systems, I hope this article will be helpful.
Recommended Posts