Results 1 to 10 of 10

Thread: So I whipped together a little app that basically ripples water

  1. #1

    Thread Starter
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    So I whipped together a little app that basically ripples water



    All the rippling in the top corner was caused by one splash ricocheting off the walls. The app certainly isn't fast, but it does everything I wanted it to, and it is clear proof of concept that this method of creating that ripple effect does work.

    Now... someone wanna help me speed it up a bit?

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: So I whipped together a little app that basically ripples water

    Um... so what did you do, exactly, to make it ripple? Are you just using GDI+ to do this(ACK!)?
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3

    Thread Starter
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: So I whipped together a little app that basically ripples water

    Oh hell no. System.Runtime.InteropServices.Marshal.Copy() actually runs slightly faster than the bitmap pointers I had been using, and is a little easier to read, so that's what I went with. That, and a lot of math...

  4. #4
    Fanatic Member EntityX's Avatar
    Join Date
    Feb 2007
    Location
    Omnipresence
    Posts
    798

    Re: So I whipped together a little app that basically ripples water

    Why don't you post the code? I'd like to see it in action. You could put it in the code bank if you like.
    Make as many mistakes as you can as quickly as you can. We want to make sure that we make a great enough number of mistakes in a given amount of time so that we can be successful.

    "Persistence is the magic of success." Paramahansa Yogananda

  5. #5
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: So I whipped together a little app that basically ripples water

    Quote Originally Posted by timeshifter View Post
    System.Runtime.InteropServices.Marshal.Copy() actually runs slightly faster than the bitmap pointers I had been using

    Your pointer math does suck though, you have to take that into account.
    I don't live here any more.

  6. #6

    Thread Starter
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: So I whipped together a little app that basically ripples water

    Because I never did any real pointer math... care to educate me in yet another area?

  7. #7
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: So I whipped together a little app that basically ripples water

    Sure, post your project and we'll see what we can do. I've studied wave theory, so there's a chance I could help you optimise your math.

  8. #8

    Thread Starter
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: So I whipped together a little app that basically ripples water

    I haven't, and my math is merely the sum of my perception of loosely what's happening in a ripple. It's entirely possible that I'm completely off the mark in terms of true wave dynamics, but damnit, it looks cool
    Attached Files Attached Files
    Last edited by timeshifter; May 1st, 2009 at 07:22 AM.

  9. #9

    Thread Starter
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: So I whipped together a little app that basically ripples water

    Oi... just got the same system implemented for an isometric field instead of a pixel map... runs a heck of a lot faster and looks cooler, IMO. Sadly, I probably should spend the last three hours of the work day doing some actual work (I've been doing this all day), but maybe tonight I'll get around to adding some nice gradients based on height. The points in the array are associated with the vertexes here, not the cells... took a bit of trial and error before I finally got a single conditional which tests everything needed to determine if any given point should be the anchor for a cell...

    EDIT: Oh, and if someone could figure out why the heck the app posted (and this new one) runs into that stupid stack overflow GDI+ error? I'm somewhat at a loss for what it's screaming about...

    EDIT2: Got it. turns out the Stack Overflow was because I was driving the calculate loop with a timer (and the app clearly doesn't run at above 64 FPS), and disposing of the Graphics object every frame doubled the framerate...
    Attached Images Attached Images  
    Last edited by timeshifter; Apr 30th, 2009 at 03:14 PM.

  10. #10

    Thread Starter
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: So I whipped together a little app that basically ripples water

    Just updating the attachment above... added a couple new things, and this code should be pretty darn stable. At least, I haven't been able to make it crash.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width