The thorny path on the Windows Store
Like many programmers, I was cautious (and relate) to Windows 8, but could not resist trying to write a couple of programs for the Windows Store. Nevertheless, this is a fashionable trend: .Net 4.5, C # 5, XAML.
Just these days, December 4th, I came across an article about the Microsoft W8 application contest for W8. It was somehow not serious to lay out experimental programs (although the market was literally crowded with such crafts), so I decided to port a fairly large-scale project with MonoTouch and iOS. Stock up on popcorn, because in addition to programmer details, there will be comedy, drama, and a life ending.
The code for MonoTouch / MonoDroid is written in C #, but this is normal, "canonical" C # with System.Drawing, System.Xml, System.IO, etc. I expected all the same under Windows 8, with bonus bridge and lawyers, but the reality turned out to be brutal: the listed namespace are basically absent. No more PointF, crossed out XmlNode, no File.ReadAllText () can be done, no FileStream and anything compatible with it. Even with images, you can do only one action - load, and even then asynchronously, i.e. even the size in pixels immediately after loading, we won’t be able to find out without a tambourine.
Actually, in general, all I / O operations with the outside world became asynchronous, with the keywords async and await, which after several hours of work caused me attacks of uncontrollable rage. In fact, this is a good innovation and an interesting approach, but if in a stable and verified code a text file of 500 bytes was read (level order in the game, script, etc.), now a significant alteration of the code is implied, as well as the whole chain of calls must be marked as async. Another option is to write a wrapper that mimics the old syntax, inside of whichthere is a non-kosher synchronous invocation of the asynchronous method (hello to future supporters!).
In general, I am a supporter of code freezing: business logic is written once, debugged, and then not touched at all, and the changes relate only to user interaction. Therefore, having overcome an attack of disgust, I sat down to create my ownbikes wrappers.
In half a day, their implementations of PointF, RectangleF, XmlDocument, System.IO.File, etc., which, according to the syntax, are the same as in .Net 2.0-4.0, but they already use the Windows Store realities inside. To work with resources, I had to come to terms with crutches for “asynchronous synchronization”:
It turned out to be more complicated with XmlDocument and XmlElement, such classes exist in a “lite” form in the Windows.Data.Xml.Dom namespace, but now they do not inherit from XmlNode, but implement the IXmlNode interface with some syntax changes. My wrapper is not very handsome, does not know how to work with XPath and many other features, but he worked perfectly for the simplest tasks. If someone needs it as a blank, here is the code: paste2.org/p/2664348
On iOS / Android, our games draw sprites through OpenGL ES 1.1. No shaders, no transformations, no VBO - with glDrawTexiOES calls. In Windows, of course, GL does not smell, because I counted on XNA and SpriteBatch, but ... it was not there. In the Windows Store world, there’s no XNA in its pure form, only due to its cross-platform implementation of MonoGame! The product is quite entertaining, but I wanted to get by with the capabilities of the platform, and in the future I was interested in the Silverlight port option. The WPF / XAML solution looks homebrew, but it works almost as it should: for each sprite I create a Rectangle of the right size on the Canvas and assign it an ImageBrush that references the desired texture, and only part of it is extracted through transformations. Technically, WPF uses DirectX to render,
I found only one pitfall when the port was almost finished: in principle, there is no method to change the color of a sprite. For example, in a puzzle with colors, we painted different parts in red and blue through glColor4f (1.0f, 0.0f, 0.0f, 1.0f). With all the wealth of choice, I did not find an alternative (except for rewriting on MonoGame), so I had to work with three different textures. A similar problem happened in the puzzle with bones, but here I could do with transparency - the fixed bones are now “gray” (on the right), and not “yellow”, as on other platforms (on the left).
The noticeable difference between the Windows Store games from mobile / tablet is also that they can be displayed on huge screens and resolutions. For example, the graphics for the iPhone 3GS do not look very good on a 27 "monitor with a resolution of 2560x1440. Fortunately, a certain amount of hi-res content was prepared for the iPad 3, but at the same time it was time to redraw some levels and controls. I'm not an artist, because it took me almost more time than porting.
In total, on December 6, early in the morning, the program was ready to be sent for certification. There was not much time left until the contest deadline, December 10, but I was hoping for the best. Screenshots for the Windows Store are supposed to be made in a simulator with a resolution of 1366x768 in png format, which, in the best traditions of Microsoft, is bloated to impossibility. The size is acceptable for the same type of graphics, but not for photographs or pictures: the screenshot shown above with Dali’s work took 2.9 megabytes. This is not a problem for the modern Internet, but the program submission form does not accept files larger than 2 MB. It doesn’t take JPEG either, because I previously passed the screen through optipng, which made it visually unchanged, but it became a megabyte smaller.
On Saturday morning, December 8th, I received a refusal to certify the program. The reason was amazing: “one or more screenshots were changed in third-party programs.” Mentally cursing myself for my carelessness, and developers and testers for all their sins not committed and committed, I deleted the screen and resent the program.
I’ll say separately that I notified support, the official forum, of the company’s representatives I knew about theidiocy of the situation with screenshots, but I didn’t get any intelligible answers. A colleague from Belarus contacted me yesterday, whose situation is even more complicated: their programshows the most beautiful photographs of the corners of the Earth, and all as one screenshots are obtained more than 2 MB. Apparently, for each such screenshot you need to make a postscript like "changed in Photoshop to reduce the size."
Often testers in the iTunes Store / Samsung Store / Amazon AppStore look at the basic qualities of the program: are there any obvious bugs, time bombs, naked beauties, keyloggers. Certification in the Windows Store was no exception for my other products and took one, maximum two days. But this time, as I understand it, the testers decided to complete the game, otherwise I do not understand what else they could do 11 (!!) calendar days. Or simply could not pass the first puzzle.
The support service replied that only 7 working days have technically passed and this is not so scary, we still have to be patient. Accepting that I was allegorically called patient, I talked with the organizers of the contest and found out that the deadline for filing applications was shifted from December 10 to December 28. This was encouraging, although it was already clear that the chances of getting into the contest were slim.
On the night of December 17-18, I received a notification that the program was certified and will appear in the store after 4 hours.
A few days later, the program did not appear in the store. Just these days, Microsoft, almost in its entirety, was planning to go on a week-long vacation (or to meet the COP in the family), so I sounded the alarm and quickly contacted the support service. A girl with a beautiful name Brandi (or a poorly named boy) reported that, unfortunately, all my screenshots were irretrievably lost during the certification process! It was December 20th, one day before the proposed vacation and side event. In order not to delay the process, I immediately proposed three options: send screenshots by mail, cancel certification of the program, take screenshots from the free version of the same game, which has already been sent for consideration. The decision, apparently, turned out to be not simple, because on December 23, they answered me that I probably need to send screenshots by mail ...
It is said - done, I attached a set of screenshots, wrote descriptions in Russian and English, sent and within 15 minutes I received the answer:
At the end of 2012, after the end of the Mayan calendar, in the era when the Higgs boson was found, and a curious robot sends pictures from Mars in real time, phones take 41 megapixels, and companies buy petabyte data storages, the limit on mail messages in MS turned out to be 14 megabytes ...
I wrote a new letter, threw out some of the screenshots and ... received a response from another robot:
At this stage, I freaked out, uploaded all the files to my hosting and sent the links. The next answer came 6 days later, on December 29th, when the competition was no longer a question. He said that the screenshots were uploaded, everything is fine, but have not yet uploaded the program, because the logs show that there was still a certain promo image (picture on the right) - in fact, a decorated tile-banner for the market, in case the editors want to put the program on the main page. So, this promo image was also lost and they are asking for my advice on how to proceed - release without it, or I will send an updated one.
I really wanted to write an obscene answer, but I answered with one phrase that we can do without a promo image.
In the meantime, the competition was preliminarily awarded the "8 best New Year programs." They won the “Salads” and the psychedelic game Lighthouse, somewhat remote from the New Year’s theme and common sense.
Now my product is also on the list of participants, because I managed to apply for a certification of a free version of the same program and certification passed in one day. It differs from a paid one only in a banner that leads to a paid purchase, which means nowhere :)
Unfortunately, the main prize - a tablet with Windows 8 - can not be compared with the promotion and 4k banner displays that Salads will receive, so the meaning of participation is somewhat lost. The final will be the other day, and at the same time they will award the winner in the nomination "The largest number of published applications by one participant." Some perceived this nomination as a call to action and began to make programs that add or subtract two numbers. I’m advertising a couple of such masterpieces:
I will not blame the authors of the programs and MS employees who have missed this into the market, but I hope that it’s more pleasant for the contest organizers to announce the victory and to promote something like Cut The Rope than 12345 and Salads.
This is the end of the story, although in reality the final is yet to come: the end of the world has not come, but the program has not yet reached the store, the competition has not yet been completed, and the technical problems in the Windows Store have not been solved.
Just these days, December 4th, I came across an article about the Microsoft W8 application contest for W8. It was somehow not serious to lay out experimental programs (although the market was literally crowded with such crafts), so I decided to port a fairly large-scale project with MonoTouch and iOS. Stock up on popcorn, because in addition to programmer details, there will be comedy, drama, and a life ending.
Completely different c #
The code for MonoTouch / MonoDroid is written in C #, but this is normal, "canonical" C # with System.Drawing, System.Xml, System.IO, etc. I expected all the same under Windows 8, with bonus bridge and lawyers, but the reality turned out to be brutal: the listed namespace are basically absent. No more PointF, crossed out XmlNode, no File.ReadAllText () can be done, no FileStream and anything compatible with it. Even with images, you can do only one action - load, and even then asynchronously, i.e. even the size in pixels immediately after loading, we won’t be able to find out without a tambourine.
Actually, in general, all I / O operations with the outside world became asynchronous, with the keywords async and await, which after several hours of work caused me attacks of uncontrollable rage. In fact, this is a good innovation and an interesting approach, but if in a stable and verified code a text file of 500 bytes was read (level order in the game, script, etc.), now a significant alteration of the code is implied, as well as the whole chain of calls must be marked as async. Another option is to write a wrapper that mimics the old syntax, inside of which
In general, I am a supporter of code freezing: business logic is written once, debugged, and then not touched at all, and the changes relate only to user interaction. Therefore, having overcome an attack of disgust, I sat down to create my own
In half a day, their implementations of PointF, RectangleF, XmlDocument, System.IO.File, etc., which, according to the syntax, are the same as in .Net 2.0-4.0, but they already use the Windows Store realities inside. To work with resources, I had to come to terms with crutches for “asynchronous synchronization”:
publicstaticstringReadAllText(string path)
{
IAsyncOperation<StorageFile> file =
StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///" + path));
file.AsTask<StorageFile>().Wait();
IAsyncOperation<string> result = FileIO.ReadTextAsync(file.GetResults());
result.AsTask<string>().Wait();
return result.GetResults();
}
It turned out to be more complicated with XmlDocument and XmlElement, such classes exist in a “lite” form in the Windows.Data.Xml.Dom namespace, but now they do not inherit from XmlNode, but implement the IXmlNode interface with some syntax changes. My wrapper is not very handsome, does not know how to work with XPath and many other features, but he worked perfectly for the simplest tasks. If someone needs it as a blank, here is the code: paste2.org/p/2664348
Graphics
On iOS / Android, our games draw sprites through OpenGL ES 1.1. No shaders, no transformations, no VBO - with glDrawTexiOES calls. In Windows, of course, GL does not smell, because I counted on XNA and SpriteBatch, but ... it was not there. In the Windows Store world, there’s no XNA in its pure form, only due to its cross-platform implementation of MonoGame! The product is quite entertaining, but I wanted to get by with the capabilities of the platform, and in the future I was interested in the Silverlight port option. The WPF / XAML solution looks homebrew, but it works almost as it should: for each sprite I create a Rectangle of the right size on the Canvas and assign it an ImageBrush that references the desired texture, and only part of it is extracted through transformations. Technically, WPF uses DirectX to render,
I found only one pitfall when the port was almost finished: in principle, there is no method to change the color of a sprite. For example, in a puzzle with colors, we painted different parts in red and blue through glColor4f (1.0f, 0.0f, 0.0f, 1.0f). With all the wealth of choice, I did not find an alternative (except for rewriting on MonoGame), so I had to work with three different textures. A similar problem happened in the puzzle with bones, but here I could do with transparency - the fixed bones are now “gray” (on the right), and not “yellow”, as on other platforms (on the left).
The noticeable difference between the Windows Store games from mobile / tablet is also that they can be displayed on huge screens and resolutions. For example, the graphics for the iPhone 3GS do not look very good on a 27 "monitor with a resolution of 2560x1440. Fortunately, a certain amount of hi-res content was prepared for the iPad 3, but at the same time it was time to redraw some levels and controls. I'm not an artist, because it took me almost more time than porting.
Putting to market
In total, on December 6, early in the morning, the program was ready to be sent for certification. There was not much time left until the contest deadline, December 10, but I was hoping for the best. Screenshots for the Windows Store are supposed to be made in a simulator with a resolution of 1366x768 in png format, which, in the best traditions of Microsoft, is bloated to impossibility. The size is acceptable for the same type of graphics, but not for photographs or pictures: the screenshot shown above with Dali’s work took 2.9 megabytes. This is not a problem for the modern Internet, but the program submission form does not accept files larger than 2 MB. It doesn’t take JPEG either, because I previously passed the screen through optipng, which made it visually unchanged, but it became a megabyte smaller.
Renouncement
On Saturday morning, December 8th, I received a refusal to certify the program. The reason was amazing: “one or more screenshots were changed in third-party programs.” Mentally cursing myself for my carelessness, and developers and testers for all their sins not committed and committed, I deleted the screen and resent the program.
I’ll say separately that I notified support, the official forum, of the company’s representatives I knew about the
Testing
Often testers in the iTunes Store / Samsung Store / Amazon AppStore look at the basic qualities of the program: are there any obvious bugs, time bombs, naked beauties, keyloggers. Certification in the Windows Store was no exception for my other products and took one, maximum two days. But this time, as I understand it, the testers decided to complete the game, otherwise I do not understand what else they could do 11 (!!) calendar days. Or simply could not pass the first puzzle.
The support service replied that only 7 working days have technically passed and this is not so scary, we still have to be patient. Accepting that I was allegorically called patient, I talked with the organizers of the contest and found out that the deadline for filing applications was shifted from December 10 to December 28. This was encouraging, although it was already clear that the chances of getting into the contest were slim.
On the night of December 17-18, I received a notification that the program was certified and will appear in the store after 4 hours.
Losses
A few days later, the program did not appear in the store. Just these days, Microsoft, almost in its entirety, was planning to go on a week-long vacation (or to meet the COP in the family), so I sounded the alarm and quickly contacted the support service. A girl with a beautiful name Brandi (or a poorly named boy) reported that, unfortunately, all my screenshots were irretrievably lost during the certification process! It was December 20th, one day before the proposed vacation and side event. In order not to delay the process, I immediately proposed three options: send screenshots by mail, cancel certification of the program, take screenshots from the free version of the same game, which has already been sent for consideration. The decision, apparently, turned out to be not simple, because on December 23, they answered me that I probably need to send screenshots by mail ...
It is said - done, I attached a set of screenshots, wrote descriptions in Russian and English, sent and within 15 minutes I received the answer:
At the end of 2012, after the end of the Mayan calendar, in the era when the Higgs boson was found, and a curious robot sends pictures from Mars in real time, phones take 41 megapixels, and companies buy petabyte data storages, the limit on mail messages in MS turned out to be 14 megabytes ...
I wrote a new letter, threw out some of the screenshots and ... received a response from another robot:
At this stage, I freaked out, uploaded all the files to my hosting and sent the links. The next answer came 6 days later, on December 29th, when the competition was no longer a question. He said that the screenshots were uploaded, everything is fine, but have not yet uploaded the program, because the logs show that there was still a certain promo image (picture on the right) - in fact, a decorated tile-banner for the market, in case the editors want to put the program on the main page. So, this promo image was also lost and they are asking for my advice on how to proceed - release without it, or I will send an updated one.
I really wanted to write an obscene answer, but I answered with one phrase that we can do without a promo image.
Competition
In the meantime, the competition was preliminarily awarded the "8 best New Year programs." They won the “Salads” and the psychedelic game Lighthouse, somewhat remote from the New Year’s theme and common sense.
Now my product is also on the list of participants, because I managed to apply for a certification of a free version of the same program and certification passed in one day. It differs from a paid one only in a banner that leads to a paid purchase, which means nowhere :)
Unfortunately, the main prize - a tablet with Windows 8 - can not be compared with the promotion and 4k banner displays that Salads will receive, so the meaning of participation is somewhat lost. The final will be the other day, and at the same time they will award the winner in the nomination "The largest number of published applications by one participant." Some perceived this nomination as a call to action and began to make programs that add or subtract two numbers. I’m advertising a couple of such masterpieces:
I will not blame the authors of the programs and MS employees who have missed this into the market, but I hope that it’s more pleasant for the contest organizers to announce the victory and to promote something like Cut The Rope than 12345 and Salads.
This is the end of the story, although in reality the final is yet to come: the end of the world has not come, but the program has not yet reached the store, the competition has not yet been completed, and the technical problems in the Windows Store have not been solved.