Nice engine :-)

Started by
52 comments, last by richardve 22 years, 4 months ago
Hi!
Sorry no answer....
I know the original water code from lonerunner but as yours it comes without description....I completely understand your and lonerunner´s code but I don´t really understand why and how it works....Can you give me a little rough description what exactly the algo does?Especially the stuff in the two nested for loops after // Animate.

Thanx in advance, XBTC!

Edited by - XBTC on December 28, 2000 5:41:05 PM
Advertisement
Im no expert, but it looks like

------------------------------
for (i=0; i for (j=0; j[j].fForce = 0.0f;
-------------------------------

can be combined with

-------------------------------
for (i=0; i{
for (j=0; j {
m_pWaterMesh[j].fVelocity += m_pWaterMesh[j].fForce * fScaledSpeed;<br> m_pWaterMesh[j].fVertex[1] += m_pWaterMesh[j].fVelocity;<br> m_pWaterMesh[j].fVertex[1] -= m_pWaterMesh[j].fVertex[1] / m_iTesselation;<br> }<br>}<br>———————————<br><br>so, instead of looping that twice, just loop it once with all that code.<br> </i> <br><br>—————————–<br><br>A wise man once said "A person with half a clue is more dangerous than a person with or without one."<br><br><a href="http://theotherside.com/t-shirts/msbsod.pl">The Micro$haft BSOD T-Shirt</a>
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
XBTC: Um... I''m in the same situation. The code is pretty structured and good to handle. But this guys doesn''t seem to like commnting his stuff, awful ;-) I took my countless time to figure out that this describing "DT" is the speed ;-) I have no idea how the animation loop really works...

ImmaGNUman: How do you mean that ? I can''t reset the force AFTER I recalculated it... I also looked to combine the three loops, but I haven''t found a good way yet



Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
Hi!
Thanx for replying....
Everybody admires your engine for the beautiful water and you don´t understand the code for it....a little strange heh?
Anyway I´ll trie to get an answer from lonerunner himself....
If I understand I´ll tell you how it works....

Thanx again and bye, XBTC!
Hi!
Thanx for replying....
Everybody admires your engine for the beautiful water and you don´t understand the code for it....a little lame heh?
Anyway I´ll trie to get an answer from lonerunner himself....
If I understand it I´ll tell you how it works....

Thanx again and bye, XBTC!

Edited by - XBTC on December 28, 2000 5:53:53 PM
I know how it''s done, I had no problem coding it by myself. The only code that I don''t understand is the actualy water animation fucntion ;-) It didn''t have any comments and the variable naming was very poor. But it worked well... I really don''t like reusing code from others, most of the time you end up rewriting eveything because it is nor your coding style and it s not 100% suited for what you want...

Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
I wasn't able to determine any optimizations (aside from the i+1,j+1 stuff) that you could use with my first review of your code but a couple of things caught my attention...

Is this by design or a bug? Unless I'm missing something here, or it's a bug, FD will always = 0 and therefore this chunk of code is redundent (2nd FD block in loop)...    fD = m_pWaterMesh[j].fVertex[1] - m_pWaterMesh[j].fVertex[1];<br>m_pWaterMesh<i>[j].fForce -= fD;<br>m_pWaterMesh[j].fForce += fD;<br>  </pre>  <br><br><br>And<br><br><pre><br><b>This is the last two lines in the loop… Notice how they are identical to the two lines above it? Shouldn't this be …[i+1][j+1]? That seems to be the missing combination in the block of 8-FD assignments. If not, then these lines are probably redundant too, right? </b>  <br>m_pWaterMesh[j].fForce -= fD;<br>m_pWaterMesh[j - 1].fForce += fD;<br>  </pre>  <br><br>Regards,<br>Jumpster   </i> <br><br>Edited by - Jumpster on December 28, 2000 10:08:41 PM    
Regards,JumpsterSemper Fi
LOL ;-) I realy should review the code before I copy it, I guess you''re right

Thanks ;-)

Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
1) After much tinkering, I have come to the conclusion that the flickering has something to do with the depth buffer. Lowering the resolution a notch makes it go away.

2) Try using the Intel c/c++ compiler 5.0. It''s at least twice as fast (fact) as msvcpp6 in my experience. It can vectorize your three loops so they all run at the same time. No need to combine them

Needless to say, it probably won''t work too well with AMD processors
void *post;
Yes, I guess your probably right. I heard in many places that Intels compiler is much better... Maybe it runs even faster on the Athlon. Some programs that were recompiled for the P4 also ran better on the AThlon. I mean one of the greatest strength of this CPU is the heavy pipelining which is rarely used in today''s shitty x86 code ;-)

Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity

This topic is closed to new replies.

Advertisement