Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39

Thread: Trouble porting liquid simulation to Pascal - AARRGGHH!

  1. #1

    Trouble porting liquid simulation to Pascal - AARRGGHH! (SOLVED)

    Hey all,
    I found this article the other day:
    http://w-shadow.com/blog/2009/09/01/...id-simulation/

    and I just HAD to make a Pascal version of the code...I am hoping to get something like this added to The Probe game

    Unfortunately I have been pulling out my remaining hair trying to get it working, and I am not succeeding!!

    In my code, I have changed all references of Mass to Water, and my coordinate system uses -y for going up, and +y for going down which is the opposite of the source code posted on the site.

    I have also used sx,sy for the source water tile (instead of x,y), and dx,dy for the tile the water is trying to move to instead of x,y+1, and similar.

    It works sort of, but definitely is not correct - some water doesn't even fall down, and other anomalies...

    I have attached a .zip file containing my project if anyone has time to try it out, and get it working correctly. It is driving me nuts!!

    xeEngine - liquid sim.zip

    It has both Lazarus and Delphi 2010 projects if this helps, and includes the engine DLL and a pre-compiled exe

    Any help would be much appreciated!!

    cheers,
    Paul
    Last edited by paul_nicholls; 30-08-2011 at 04:18 AM.

  2. #2
    So it is almost-C code, intended for an interpreter? I would start by making it run as C code, and convert from there, but OTOH you have already made the conversion. I'll have a look at it.

  3. #3
    Quote Originally Posted by Ingemar View Post
    So it is almost-C code, intended for an interpreter? I would start by making it run as C code, and convert from there, but OTOH you have already made the conversion. I'll have a look at it.
    Thanks mate, much appreciated

    cheers,
    Paul

  4. #4
    Making a pure C version wasn't worthwhile. Evil twisted code full of vague implications, lots of undefined stuff. Maybe it isn't very strange that your port didn't work, I have some trouble understanding what the original code does.

  5. #5
    LOL! ok, perhaps it doesn't work and is different that what is actually being used then

    EDIT: hmm...I might try downloading the Java-Based Processing Programming Language mentioned, and try the supplied code to see if it is flawed or not

    ZOIKS! It is ~85MBs in size...oh well, downloading...

    cheers,
    Paul

  6. #6
    Ok, after a few minutes working out how to use Processing, I got the code as downloaded from the site to work just fine, so that is ok - it must be my port that is not working

    Here is the direct link to the processing code that I ported if you hadn't already gotten that

    http://1.shadowcdn.com/files/water_sim.zip

    cheers,
    Paul

  7. #7
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Looking through it - gives me a break from modularization of prometheus so you're welcome for posting this... Plus thats a nice article - maybe making a pascal version of the tutorial would be nice for the PGD archives
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  8. #8
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    paul: It wouldn't be a big nono if I wrote an equivalent bit of code to this since my port does not look too pretty in the IDE and gave you that instead? Trying to translate this C/C++ is not hard its just a tad annoying TBH. I wish we had a continue statement in pascal (not sure one does not exist actually ).

    I'll get back to you guys with my equivalent code for this most soon... A fluid simulation engine would be quite nice for my games too.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  9. #9
    I wish we had a continue statement in pascal (not sure one does not exist actually).
    It does in fact exist.

  10. #10
    Quote Originally Posted by paul_nicholls View Post
    EDIT: hmm...I might try downloading the Java-Based Processing Programming Language mentioned, and try the supplied code to see if it is flawed or not
    The whole idea of making an interpreted language running with an interpreter written in Java, clinging to every design flaw of C from 1970 (even re-intruducing some flaws that were fixed in the 80's), it stinks so bad from start to end that I don't want to let more of it than the example source near my computer. But fluid simulation is nice, so freshing it up it by porting it to FPC could be useful.

    One wish for the port: Portability! How about isolating all platform dependent stuff into one unit?

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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