Win2D 0.0.11 – CanvasAnimatedControl


Win2D version 0.0.11 is now available on NuGet and Github.

New this sprint:


Comments (10)

  1. drd says:

    Perhaps the new MS hololens-tech has solved all these… ? I'd like to see it myself to see if they have learned anything from where Windows PC's went wrong.

    Here's a good test to try to see whether things are better than what we had 20+ years ago for 2D games:

    Create an impression that the screen is full of high fidelity high contrast (1 pixel wide and "infinite" height) vertical lines that can then pan and rotate spanning the entire screen all the time. While the lines are vertical, pan/scroll them horizontally. Then rotate and pan/scroll them vertically.

    The test:

    Watch for any jitter, tearing, flicker or any inconsistency in pan/scroll speed.

    I'm thinking you may atleast need a pc with:

    1) consistent interrupt to process latency (not just low dpc latency) (yeah you could probably get around this requirement by not involving the CPU through declarative gpu programming but that's not going to be satisfactory for scenario 6 below)

    2) maybe one of those new nvidia/amd supported displays that promise flicker free panning and such

    3) 200+ DPI display to avoid the 1 pixel wide line flicker when scrolled

    4) scalable yet consistent high update rate – to scroll the 1px wide lines at any speed without stepping/skipping

    5) maybe also 4K OLED display or CRT, if the lines and background are colored in some suitable color combination, LCD's can vary in how fast the colors transition, so cycling the fg/bg palette may show issues

    6) if the game/app is about interactive sounds or music, then you also need low interrupt to process latency, not just consistent. And low user input to output (sound or visual) latency.

    Now assuming you have all that, can you achieve the effect that things are moving completely smoothly and everything stays consistent over say a hour? If so, then welcome back to pre-Windows era, maybe we'll start to see some games worth playing again – as a perfectionist I can't even bother getting into game development if few minutes of testing shows that you can't even do a perfectly smooth game loop never mind a game.

  2. drd says:

    I should add that the 1px lines should be irregularly spaced – eg. try scroll/pan a non-antialiased visual waveform with 1px wide peaks for example instead of just equally spaced vertical 1px wide lines. Otherwise the issues may not stand out.

  3. drd says:

    I started to think whether it's possible to ensure consistent interrupt to process latency. I think this might be feasible though no doubt complicated to implement on top of existing Windows OS.

    If OS is not hard-realtime, then there should be some sort of seamless time slot scheduling degradation. eg. if the system is assuming that all end-to-end IO operations complete in 0.1 ms and some operation takes 0.2 ms, then the system degrades to work under 0.2 ms in such manner that the only effect that user notices is that end-to-end IO from keyboard to sound or visual change now takes 0.2 ms. When user applications with "performance consistency requirement" are stopped, the default scheduling is resumed. This default would of course be based on what the drivers etc allow for.

    In current Windows systems, this would essentially mean that if there is some sort of bad behaviour in the system, it would immediately degrade application performance a lot across the entire system. The current behaviour seems to be that there can be spikes of bad performance leading inconsistent performance and conditions that may be such that you can only show they exist by pointing a 1000 FPS video camera on the screen and analyzing the video frame by frame (the camera needs to be certified by capturing footage of a time reference to and analyize that each frame captured was consistent time apart).

  4. Victor says:

    Lack sprite collision detector?.

    Lack examples of code new implementations, for example one game with all new code. Lack document for studio

  5. Victor, check out the Example Gallery app (in testsExampleGallery folder) for code examples. It's AnimatedControlExample and also BurningTextExample show how to use the new CanvasAnimatedControl.

    Documentation is here: microsoft.github.io/Win2D  but I don't understand what you mean by "for studio"?

  6. Jens says:

    I guess he means a visual studio template or so.

    CanvasAnimatedControl:

    I come from XNA/C# and this new Win2D/Windows Store/Metro/XAML/UAP stuff is a good reason for me to stop programming for MS Windows. I am really upset to see MS is still not understand indi developers and their needs to have simple but rocksolid solution like XNA. But nice to have you who jump out of the bush and show a CanvasAnimatedControl, Yeah Baby! This control sems to me similar as the game class of XNA. We have Update/Draw and a kind of timer. But thats it for the similarity.

    These links are dead:

    (Update)microsoft.github.io/…/E_Microsoft_Graphics_Canvas_CanvasAnimatedControl_Update.htm

    (Draw)microsoft.github.io/…/E_Microsoft_Graphics_Canvas_CanvasAnimatedControl_Draw.htm

    (Supports) microsoft.github.io/…/P_Microsoft_Graphics_Canvas_CanvasAnimatedControl_IsFixedTimeStep.htm

    (Can deliver input events directly to its worker thread)microsoft.github.io/…/P_Microsoft_Graphics_Canvas_CanvasAnimatedControl_Input.htm

  7. Jens says:

    Flickering:

    When taking a bigger step of movement (For e.g. X+=4) for an CanvasBitmap it seems that i see them double while drawing with a 1px flickering. How can i solve that?

    Samplecode MainPage.xaml:

    <Page

       x:Class="SimpleSample.MainPage"

       x:Name="MainPageAsNameIsNotAllowed"

       xmlns="schemas.microsoft.com/…/presentation"

       xmlns:x="schemas.microsoft.com/…/xaml"

       xmlns:local="using:SimpleSample"

       xmlns:d="schemas.microsoft.com/…/2008"

       xmlns:mc="schemas.openxmlformats.org/…/2006"

       xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"

       mc:Ignorable="d"

       Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

       <Grid>

           <canvas:CanvasAnimatedControl

               x:Name="canvas"

               Margin="5"

               ClearColor="CornflowerBlue"

               CreateResources="LoadContent"

               Update="Update"

               Draw="Draw"/>

       </Grid>

    </Page>

    MainPage.xaml.cs:

    namespace SimpleSample

    {

       /// <summary>Draws some graphics using Win2D.</summary>

       public sealed partial class MainPage : Page

       {

           private CanvasBitmap bitmap;

           private float x;

           private float xd;

           public MainPage()

           {

               this.InitializeComponent();

               xd = 4;

           }

           private void LoadContent(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)

           {

               args.TrackAsyncAction(LoadContentAsync(sender).AsAsyncAction());

           }

           async Task LoadContentAsync(CanvasAnimatedControl sender)

           {

               bitmap = await CanvasBitmap.LoadAsync(sender, "Assets/Logo.scale-100.png");

           }

           private void Update(ICanvasAnimatedControl sender, CanvasAnimatedUpdateEventArgs args)

           {

               x += xd;

               if (x < 0 || x > 400)

               {

                   xd = -xd;

                   x += xd;

               }

           }

           private void Draw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)

           {

               args.DrawingSession.DrawImage(bitmap, x, 200);

           }

       }

    }

  8. Jens, what kind of screen are you viewing this on?  Does this doubling show up if you capture a screenshot of your app?

    My first guess is you may be seeing an artifact of LCD response time  (blogs.msdn.com/…/lcd-response-time.aspx)

  9. Jens says:

    It is an LCD from Eizo S2100 with 16 ms reaction time. It seems that the slow reaction time is the reason. So i should solve it by buying a quicker LCD?

    But bloom and motion blur is not a solution for me, it is just a degrade of graphics and all people i know do always switch this off in any game. It is as same useless as Lensflares, Chromatic aberration, etc. Only tricks to reduce Terrain details and trying to make 30 fps playable and look like a Film.

    So will it be possible with Win2D to create a proper Game including a base of an EntityComponentSystem. Or will there be some samples like we had in XNA for more complex issues? For. e.g. RTS maker, Plattformer, etc.?

  10. The best thing to do about LCD response artifacts is usually just not worry about them too much.  These things tend to look worse with simple test graphics than they will with a complete finished game, and there's not much you can do about them in any case…

    Sure, you can make a game using Win2D for the graphics rendering side of things.

Skip to main content