don't click here

WindowsZone

Discussion in 'Fangaming Discussion' started by MainMemory, Mar 31, 2010.

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    Something I've been working on for the past few days...

    You may know that for one of my hacks, I had an idea for a Windows Zone based on the Windows OS. Unfortunately I lack the level design skills to make that work.
    So instead, I went the other way, and implemented a decent imitation of the Sonic engine in VB.NET, and made it able to interact with all the windows you have open.

    So here's the current version of WindowsZone, and here's the Animation editor.

    You'll also need the DirectX Runtimes if you don't have them.

    Note: if your entire screen turns magenta, you'll need to switch your color mode to 24-bit or less. This is a bug with GDI+ and I don't think I can fix it.

    Features:
    Can collide with the inside and outside borders of open windows.
    Physics values based on the Sonic Physics Guide, multiplied by 4 in most cases.
    Sound Effects that somebody else ripped from S3K
    Animations from S3K ripped with SonMapEd, aligned and timed by me
    Can pick Sonic up with the mouse and move him
    Useless looking up animation
    Useless ducking animation
    Sonic can Roll, Jump and Spindash (Spacebar = jump)
    Uses braking animation if you have enough speed
    Menu available by right-clicking Sonic's icon in the system tray
    Can choose which boundaries are solid for windows
    Can choose what happens when he reaches the edge of the screen area: Wrap, Stop, Ignore
    Can go up off the top of the screen indefinitely
    Dies when he hits the bottom of the screen
    Uses pushing animation when pressing against a wall
    Adjustable framerate (defaults to 16ms ~ 60fps)
    Can show collision boundaries (red for windows, green for Sonic)
    Has customizable physics and animations, by editing or copying sonic.ini

    In-progress features:
    Objects other than Sonic (springs etc.) this will likely mean you won't be able to stand inside of windows anymore

    Feel free to suggest improvements or new features.
    I may take this and make a more normal fangame engine out of it, but I'd need to rework collision some to get slopes to work.
     
  2. Aquaslash

    Aquaslash

    Emerald Dragoon Moderator
    2,818
    0
    16
    Hampton, VA
    The S Factor: Sonia and Silver
    This is genius, though it'd be nice if I could interact with other windows while doing it. I had them all minimized and this locked up controls, unless I hit the Windows button.
     
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    Assuming you're not getting a magenta screen, you should be able to click on windows as normal, and then click on Sonic to bring the focus back so you don't accidentally do something you didn't mean to with the arrow keys.
     
  4. FraGag

    FraGag

    Tech Member
    It crashes for me on startup. Visual Studio shows me this exception message:
    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Une erreur s'est produite lors de la création du formulaire. Pour plus d'informations, consultez Exception.InnerException. L'erreur est : La conversion de la chaîne ".875" en type 'Double' n'est pas valide.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Stack trace:
    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->à WindowsZone.My.MyProject.MyForms.Create__Instance__[T](T Instance) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 197
    à WindowsZone.My.MyApplication.OnCreateMainForm() dans C:\Users\Mike\Documents\Visual Studio 2008\Projects\WindowsZone\WindowsZone\My Project\Application.Designer.vb:ligne 35
    à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicat
    ionModel()
    à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String
    [] commandLine)
    à WindowsZone.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81<!--QuoteEnd--></div><!--QuoteEEnd-->
    Basically, you're converting strings to doubles but it fails. In my locale (fr-CA), ".875" is not a valid floating-point number; ",875" would be. However, the solution would be to use <a href="http://msdn.microsoft.com/en-us/library/3s27fasw.aspx" target="_blank">Double.TryParse</a> by passing <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.invariantculture.aspx" target="_blank">CultureInfo.InvariantCulture</a> to the provider parameter (the default is <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx" target="_blank">CultureInfo.CurrentCulture</a>, which crashes on my system).
     
  5. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    0
    0
    across town from Hinchy
    All the bitches.
    It eats my CPU and ram like crazy, but it's an amazing idea.
     
  6. Digiku

    Digiku

    Oldbie
    51
    0
    0
    I LOVE this! It's like a good, entertaining way to kill boredom :)

    It'd be perfect for me if you could block keyboard input for other apps, so I don't have to deal with Explorer opening files or Notepad typing stuff on me. I'd do just fine with dragging windows willy-nilly to make Sonic platform on them.
     
  7. NeonSynth

    NeonSynth

    Previously 'SonicVaan' Member
    390
    1
    18
    Germany, Würzburg
    Betatesting, Various hacking projects, programming synthesizers, music production
    Cannot play it. I always have to send a report to Microsoft.

    EventType : clr20r3 P1 : windowszone.exe P2 : 1.0.0.0 P3 : 4bb2786a
    P4 : windowszone P5 : 1.0.0.0 P6 : 4bb2786a P7 : f P8 : c6
    P9 : system.invalidoperationexception
     
  8. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    <!--quoteo(post=434337:date=Mar 31 2010, 12:16 AM:name=FraGag)--><div class='quotetop'>QUOTE (FraGag @ Mar 31 2010, 12:16 AM) <a href="index.php?act=findpost&pid=434337">[​IMG]</a></div><div class='quotemain'><!--quotec-->It crashes for me on startup. Visual Studio shows me this exception message:
    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Une erreur s'est produite lors de la création du formulaire. Pour plus d'informations, consultez Exception.InnerException. L'erreur est : La conversion de la chaîne ".875" en type 'Double' n'est pas valide.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Stack trace:
    :words:
    Basically, you're converting strings to doubles but it fails. In my locale (fr-CA), ".875" is not a valid floating-point number; ",875" would be. However, the solution would be to use <a href="http://msdn.microsoft.com/en-us/library/3s27fasw.aspx" target="_blank">Double.TryParse</a> by passing <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.invariantculture.aspx" target="_blank">CultureInfo.InvariantCulture</a> to the provider parameter (the default is <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx" target="_blank">CultureInfo.CurrentCulture</a>, which crashes on my system).
    <!--QuoteEnd--></div><!--QuoteEEnd-->
    I keep forgetting that :argh: but right now I can't make a quick fix and reupload because I'm in the middle of rewriting it so it can have other objects. You could just replace the periods in sonic.ini with commas.

    <!--quoteo(post=434474:date=Mar 31 2010, 06:35 AM:name=SonicVaan)--><div class='quotetop'>QUOTE (SonicVaan @ Mar 31 2010, 06:35 AM) <a href="index.php?act=findpost&pid=434474">[​IMG]</a></div><div class='quotemain'><!--quotec-->Cannot play it. I always have to send a report to Microsoft.

    EventType : clr20r3 P1 : windowszone.exe P2 : 1.0.0.0 P3 : 4bb2786a
    P4 : windowszone P5 : 1.0.0.0 P6 : 4bb2786a P7 : f P8 : c6
    P9 : system.invalidoperationexception<!--QuoteEnd--></div><!--QuoteEEnd-->
    Do you even have the .NET Framework installed? Because that's not an error message like .NET gives.

    Digiku: You can click on Sonic again to get around that.
     
  9. <!--quoteo(post=434537:date=Mar 31 2010, 02:49 PM:name=MainMemory)--><div class='quotetop'>QUOTE (MainMemory @ Mar 31 2010, 02:49 PM) <a href="index.php?act=findpost&pid=434537">[​IMG]</a></div><div class='quotemain'><!--quotec--><!--quoteo(post=434474:date=Mar 31 2010, 06:35 AM:name=SonicVaan)--><div class='quotetop'>QUOTE (SonicVaan @ Mar 31 2010, 06:35 AM) <a href="index.php?act=findpost&pid=434474">[​IMG]</a></div><div class='quotemain'><!--quotec-->Cannot play it. I always have to send a report to Microsoft.

    EventType : clr20r3 P1 : windowszone.exe P2 : 1.0.0.0 P3 : 4bb2786a
    P4 : windowszone P5 : 1.0.0.0 P6 : 4bb2786a P7 : f P8 : c6
    P9 : system.invalidoperationexception<!--QuoteEnd--></div><!--QuoteEEnd-->
    Do you even have the .NET Framework installed? Because that's not an error message like .NET gives.
    <!--QuoteEnd--></div><!--QuoteEEnd-->
    It does exactly the same for me.
    I'm using windows XP and I have .NET framework 3.5
     
  10. Darkon

    Darkon

    Member
    44
    0
    6
    UK
    Hah, this is great, there seems to be a little lag between the time he jumps/rolls etc and the sound playing for me however.
    Would it be possible to make so collision boxes of the active window overwrite/mask the ones behind?
    Currently he can walk on windows that are behind your active window which looks a little weird.
     
  11. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    CarrierHack: does it give you an error message like FraGag's or is that all it gives you?

    Darkon: I'm aware of the sound lag, it's probably because it reads the file from disk every time it plays it. As for the window masking, not sure. If I could get the windows' z order values I might be able to do it, but I'd also have to compare every window's rectangle to the rectangle of every window above it. This might introduce lag and increase CPU usage even more.

    On the other hand, if I can get the SetWindowsHookEx function to work for me, I might not have to rebuild the list of window pointers every frame, which will probably cut down on CPU usage a bit.
     
  12. <!--quoteo(post=434575:date=Mar 31 2010, 04:26 PM:name=MainMemory)--><div class='quotetop'>QUOTE (MainMemory @ Mar 31 2010, 04:26 PM) <a href="index.php?act=findpost&pid=434575">[​IMG]</a></div><div class='quotemain'><!--quotec-->CarrierHack: does it give you an error message like FraGag's or is that all it gives you?<!--QuoteEnd--></div><!--QuoteEEnd-->
    Code (Text):
    1. EventType : clr20r3 P1 : windowszone.exe P2 : 1.0.0.0 P3 : 4bb2786a
    2. P4 : windowszone P5 : 1.0.0.0 P6 : 4bb2786a P7 : f P8 : c6
    3. P9 : system.invalidoperationexception
    That's all it gives me.
     
  13. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    Then it's probably an error in one of the PInvoke calls or something :S
    I really have no idea. :(
     
  14. Mad Echidna

    Mad Echidna

    Gone Oldbie
    5,219
    0
    0
    <!--quoteo(post=434319:date=Mar 30 2010, 09:30 PM:name=MainMemory)--><div class='quotetop'>QUOTE (MainMemory @ Mar 30 2010, 09:30 PM) <a href="index.php?act=findpost&pid=434319">[​IMG]</a></div><div class='quotemain'><!--quotec-->Something I've been working on for the past few days...

    You may know that for one of my hacks, I had an idea for a Windows Zone based on the Windows OS. Unfortunately I lack the level design skills to make that work.
    So instead, I went the other way, and implemented a decent imitation of the Sonic engine in VB.NET, and made it able to interact with all the windows you have open.

    So here's the current version of <a href="http://x-hax.cultnet.net/MainMemory/WindowsZone.7z" target="_blank">WindowsZone</a>

    Note: if your entire screen turns magenta, you'll need to switch your color mode to 24-bit or less. This is a bug with GDI+ and I don't think I can fix it.

    Features:
    Can collide with the inside and outside borders of open windows.
    Physics values based on the [Sonic Physics Guide], multiplied by 4 in most cases.
    Sound Effects that somebody else ripped from S3K
    Animations from S3K ripped with SonMapEd, aligned and timed by me
    Can pick Sonic up with the mouse and move him
    Useless looking up animation
    Useless ducking animation
    Sonic can Roll, Jump and Spindash (Spacebar = jump)
    Uses braking animation if you have enough speed
    Menu available by right-clicking Sonic's icon in the system tray
    Can choose which boundaries are solid for windows
    Can choose what happens when he reaches the edge of the screen area: Wrap, Stop, Ignore
    Can go up off the top of the screen indefinitely
    Dies when he hits the bottom of the screen
    Uses pushing animation when pressing against a wall
    Adjustable framerate (defaults to 16ms ~ 60fps)
    Can show collision boundaries (red for windows, green for Sonic)
    Has customizable physics and animations, by editing or copying sonic.ini

    In-progress features:
    Objects other than Sonic (springs etc.) this will likely mean you won't be able to stand inside of windows anymore

    Feel free to suggest improvements or new features.
    I may take this and make a more normal fangame engine out of it, but I'd need to rework collision some to get slopes to work.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Any chance you could make a video of it on your system?
     
  15. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    Okay, I made a minor update which fixes FraGag's issue. Now I'm going to be using the <a href="http://mwinapi.sourceforge.net/" target="_blank">Managed Windows API</a> instead of trying to figure out how to get all these Winapi functions to work. This build has a bunch of extra code that I either haven't started using yet or haven't removed, and there's really nothing "new" about this one, so you don't need to download it.

    Mad: I will yes.
     
  16. Lostgame

    Lostgame

    producer/turnablist. homebrew dev. cosplayer. Oldbie
    4,131
    54
    28
    Toronto, ON
    The O.I.C.
    Video or screenies please? D:
     
  17. Tanks

    Tanks

    Member
    1,045
    103
    43
    <!--quoteo(post=434605:date=Mar 31 2010, 08:29 AM:name=Mad Echidna)--><div class='quotetop'>QUOTE (Mad Echidna @ Mar 31 2010, 08:29 AM) <a href="index.php?act=findpost&pid=434605">[​IMG]</a></div><div class='quotemain'><!--quotec-->Any chance you could make a video of it on your system?<!--QuoteEnd--></div><!--QuoteEEnd-->

    He'd have to have a damn good system to do that. The thing locked up one of my cores when I ran it.
     
  18. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    I managed to get a laggy video with Fraps, I'm encoding it in H.264 and then I'll upload it to YouTube. I expect it'll take at least 45 minutes.
    Here's a really old screenshot:
    [​IMG]
    That window title does a nice job obscuring a secret channel's name ;)

    Edit: uploading...
     
  19. Chaos Knux

    Chaos Knux

    Stable avatar temporary. Randomizer site down. Misfit
    Yeah this locks out my control too. If you click, the focus shifts back on Sonic, and that's NO GOOD. Also, could it be possible to make this thing detect horizontal lines?
     
  20. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    By "locks out control", do you mean that Sonic doesn't respond or that you can't do anything else while it's running?

    And what do you mean by horizontal lines?