Avatar is mainly working from a program perspective, one is the web, this is responsible for purchasing, replacing clothing, etc., the other is the client program (if needed), this is mainly responsible for downloading updates and programs display
Of course, in fact, it can be implemented using the web to be implemented, no need to be responsible, the program only calls the web control or any other way, handle the final realistic directly over to the web to complete
The implementation of the web is not too difficult. If it is necessary to compatibility, it is a very simple method. After each time the user replaces the garment, the server generates a final completion map, so that other programs are used without re-need. Splice
Of course, in order to facilitate the client to retrieve whether Avatar is updated, it is best to record the number of Avatar's updates. If the client has a cache mechanism, you can determine if you need to re-download the new image, reduce the server load.
About the client, if it is simple, each time you download the final generated completion chart shows you.
If you are more complicated, you manage a local permanent cache, save the image of a certain number of people recently downloaded, if you use it again, first judge whether you need to download, download. This method, the number of people is not much, it is easy to happen, and if the number of online people is 100,000, it may not make much sense, then it is not as simple as downloading each time. However, it is mainly to realize difficulty. After all, this kind of congestion is on the client, and it will not bring too much negative impact, and there will always be some use.
In addition, it is to download it. If the download is very frequent, you can do a thread pool to download, the thread pool is not too big. If the download is not very frequent, it can be simply simple, multi-thread download, when you need it separately, then download a thread download, then a callback function processing status final, single-thread download, maintain a download list is OK.