View unanswered posts | View active topics It is currently Fri Mar 29, 2024 9:08 am



Reply to topic  [ 80 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
 Simple Lua requests thread. 
Author Message

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: Simple Lua requests thread.
Code:
for Water in MovableMan.Particles do
  if Water.PresetName == Water then
    if not Water.Pos == Water.Pos then
        if Water.Pos - Water.Pos > 20 then
            Water.Vel = Water.Pos - Water.Pos / 5;
        end
    end
  end
end


So I'm trying to get dynamic water to work so see if it really is as laggy as so many people claim.

I'm going to explain what I'm trying to do, line by line.

Ln 1 and 2 are self explanatory (I know they work.)

Ln 3. I'm trying to get a particle so it doesn't preform the velocity modification on it self and it only takes into account other particles around it.

Ln 4. Detects if a particle is in the proximity of 20 pixels (I know it's big) of another particle.

Ln 5. The particles repel each other.

------------------------------------------------------------

When I try spawning a few "Water" particles nothing happens
(except what'd normally happen if you spawned a particle).

Could someone explain to me what is wrong with my code and not just ignore this like my last 5 questions?


Wed Sep 03, 2008 2:53 am
Profile WWW

Joined: Tue May 29, 2007 6:21 pm
Posts: 5
Reply with quote
Post Re: Simple Lua requests thread.
Water.Pos - Water.Pos is ALWAYS 0.

Think about it ;)


You probably wanted to make an inner loop... something like this
Code:
for Water in MovableMan.Particles do
  for Water2 in MovableMan.Particles do
    if Water.PresetName == Water and Water2.PresetName == Water then
      if not Water.Pos == Water2.Pos then
          if Water.Pos - Water2.Pos > 20 then  -- does this work on Vectors?
              Water.Vel = Water.Pos - Water2.Pos / 5;
          end
      end
    end
  end
end


Wed Sep 03, 2008 4:57 am
Profile WWW

Joined: Fri Mar 16, 2007 1:28 pm
Posts: 328
Location: Finland
Reply with quote
Post Re: Simple Lua requests thread.
Har har, solved the angle problem. It was pretty simple to begin with. First I calculate distance between the two objects,
Code:
Math.sqrt ( actorX * aimpointX + actorY * aimpointY )

and I get the direction with...
Code:
Math.acos ( actorX * aimpointX + actorY * aimpointY )


Wed Sep 03, 2008 12:49 pm
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: Simple Lua requests thread.
zalo wrote:
Code:
for Water in MovableMan.Particles do
  if Water.PresetName == Water then
    if not Water.Pos == Water.Pos then
        if Water.Pos - Water.Pos > 20 then
            Water.Vel = Water.Pos - Water.Pos / 5;
        end
    end
  end
end


So I'm trying to get dynamic water to work so see if it really is as laggy as so many people claim.

I'm going to explain what I'm trying to do, line by line.

Ln 1 and 2 are self explanatory (I know they work.)

Ln 3. I'm trying to get a particle so it doesn't preform the velocity modification on it self and it only takes into account other particles around it.

Ln 4. Detects if a particle is in the proximity of 20 pixels (I know it's big) of another particle.

Ln 5. The particles repel each other.

------------------------------------------------------------

When I try spawning a few "Water" particles nothing happens
(except what'd normally happen if you spawned a particle).

Could someone explain to me what is wrong with my code and not just ignore this like my last 5 questions?



What? You can check how much dynamic water lags by using an emitter that spams infinite lifetime particles with the properties of water. You'd only need lua if you want to make stuff float. That's kind of pointless though due to all the lag it'd produce anyways.


Wed Sep 03, 2008 7:30 pm
Profile

Joined: Sun May 18, 2008 5:47 am
Posts: 265
Reply with quote
Post Re: Simple Lua requests thread.
Daman wrote:
You'd only need lua if you want to make stuff float.

Thats the point of water - making items float or sink on it. And an "water like quality" isnt possible WITHOUT LUA. Things settle.


Wed Sep 03, 2008 10:42 pm
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: Simple Lua requests thread.
smithno13 wrote:
Daman wrote:
You'd only need lua if you want to make stuff float.

Thats the point of water - making items float or sink on it. And an "water like quality" isnt possible WITHOUT LUA. Things settle.



It's perfectly ♥♥♥♥ possible without Lua? And it's not LUA. It's not an ACRONYM. Water like quality = low friction low bounce slight sticky no sharpness low mass. TOTALLY NEEDS Lua FOR THAT RIGHT. Stop being a sheep, Lua isn't some magical fairy stick you can just wave around and change the engine with. Actual pixel-physics water requires particles. GJ knowing nothing and flamebaiting someone who knows more about everything than you.

As I said before the only thing Lua would be good for is making things float and WHAT IS THE POINT IN THAT if you can only have a puddle 2 x 6 pixels in dimension without lag.


Thu Sep 04, 2008 1:59 am
Profile

Joined: Sun May 18, 2008 5:47 am
Posts: 265
Reply with quote
Post Re: Simple Lua requests thread.
Daman wrote:
smithno13 wrote:
Daman wrote:
You'd only need lua if you want to make stuff float.

Thats the point of water - making items float or sink on it. And an "water like quality" isnt possible WITHOUT LUA. Things settle.



It's perfectly fudge possible without Lua? And it's not LUA. It's not an ACRONYM. Water like quality = low friction low bounce slight sticky no sharpness low mass. TOTALLY NEEDS Lua FOR THAT RIGHT. Stop being a sheep, Lua isn't some magical fairy stick you can just wave around and change the engine with. Actual pixel-physics water requires particles. GJ knowing nothing and flamebaiting someone who knows more about everything than you.

As I said before the only thing Lua would be good for is making things float and WHAT IS THE POINT IN THAT if you can only have a puddle 2 x 6 pixels in dimension without lag.

Dont give me the ♥♥♥♥ with "Lua isnt an acronym" I know that, im not a moron. And you know how many people tried to make a good representation of water in CC? Alot. It doesnt work, things settle, frictionless or not. And no, you dont know more about everything than me. Infact you are being rather stupid. His idea of a water simulation will work very well, with the 20 pixel repulsion range. If he sprites it right, It could make something that looks and acts alot like dynamic water, yet with only one particle where there would be over 1000.


Thu Sep 04, 2008 3:25 am
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: Simple Lua requests thread.
smithno13 wrote:
Daman wrote:
smithno13 wrote:
Thats the point of water - making items float or sink on it. And an "water like quality" isnt possible WITHOUT LUA. Things settle.



It's perfectly fudge possible without Lua? And it's not LUA. It's not an ACRONYM. Water like quality = low friction low bounce slight sticky no sharpness low mass. TOTALLY NEEDS Lua FOR THAT RIGHT. Stop being a sheep, Lua isn't some magical fairy stick you can just wave around and change the engine with. Actual pixel-physics water requires particles. GJ knowing nothing and flamebaiting someone who knows more about everything than you.

As I said before the only thing Lua would be good for is making things float and WHAT IS THE POINT IN THAT if you can only have a puddle 2 x 6 pixels in dimension without lag.

Dont give me the crap with "Lua isnt an acronym" I know that, im not a moron. And you know how many people tried to make a good representation of water in CC? Alot. It doesnt work, things settle, frictionless or not. And no, you dont know more about everything than me. Infact you are being rather stupid. His idea of a water simulation will work very well, with the 20 pixel repulsion range. If he sprites it right, It could make something that looks and acts alot like dynamic water, yet with only one particle where there would be over 1000.


Are you dumb or something? How is it dynamic water if there is only one particle that is manipulated for water? Yes, I do know a lot more than you, and particles that don't settle for long enough to show you how laggy dynamic water is would be easy to make without Lua. And Lua isn't an acronym, ♥♥♥♥♥♥♥. You used it as one. I'll give it to you all I want. Then again, your grammar is atrocious anyways so I don't think you even know what an acronym is.


You don't even understand his idea. It's not one particle where there is over 1000. Great job making yourself look dumb while asking for it.


Thu Sep 04, 2008 3:51 am
Profile

Joined: Sun May 18, 2008 5:47 am
Posts: 265
Reply with quote
Post Re: Simple Lua requests thread.
"Ln 4. Detects if a particle is in the proximity of 20 pixels (I know it's big) of another particle."
Which means it will push away from any particle in 20 pixels. Sure, there will be a few particles within 20 pixels, but if the push is strong enough, there will be a circle with a radius of 20 around one particle, taking up the space of 1256 pixels, which in "water without Lua" would be 1256 lagging particles. And I know Lua isnt an acronym, and I was not using it as an acronym. Unless of course WITHOUT is an acronym too. And just because you have been around longer than me still does not mean you know more than me. You are not understanding his theory of making water work.


Thu Sep 04, 2008 4:06 am
Profile

Joined: Fri Mar 16, 2007 1:28 pm
Posts: 328
Location: Finland
Reply with quote
Post Re: Simple Lua requests thread.
Don't hate me for this daman, but smith is right in this, although he made some invalid points.
The idea is that every pixel keeps distance to the others while still looking like it would be filled with water. The particles are big but not as much lag.


Thu Sep 04, 2008 3:12 pm
Profile

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: Simple Lua requests thread.
So It'd take less particles to fill a bigger space.

But apparently the Lua function for checking the
Water Preset Names that Geforz Suggested are quite
laggy, even if a normal rocket explodes or a clone gibs, it's choppy.
(And I have a 3.0 Ghz CPU with 4 Gigs of RAM)

How stupid I was to forget my basic pre-school training for calculating distance.
I'm gonna try Atomic's method for proximity this afternoon after school.


Thu Sep 04, 2008 3:27 pm
Profile WWW

Joined: Fri Mar 16, 2007 1:28 pm
Posts: 328
Location: Finland
Reply with quote
Post Re: Simple Lua requests thread.
Hmm, as for the preset names thingy, how about a function like
Code:
//Note, this is pseudocode:
var i = 1
Function  (
spawn instance of water named ("water"+i)
i+1
)

And for the comparations
Code:
 //This code is referencing to every water instance, each one at a time.
see if self within range of water* excluding self //Insert calculations for range here
//* = wildcard mark


Edit: I just noticed lots of typos. I fixed them now.


Last edited by AtomicTroop on Fri Sep 05, 2008 12:38 pm, edited 1 time in total.



Thu Sep 04, 2008 6:36 pm
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: Simple Lua requests thread.
AtomicTroop wrote:
Don't hate me for this daman, but smith is right in this, although he made some invalid points.
The idea is that every pixel keeps distance to the others while still looking like it would be filled with water. The particles are big but not as much lag.


It's not going to be water then? When you shoot it it won't splash. There will be an area above the water where things will float when not even in the water. Might as well just make it one pixel big water and call it a day. OR wait, hey, 0 pixel big water and use zones instead!

Point is it's not water if physics isn't going to be able to be applied to it. It's just space where stuff floats, except with added lag because of the use of particles far apart from each other instead of zones.


Fri Sep 05, 2008 5:21 am
Profile
User avatar

Joined: Fri Mar 21, 2008 10:48 pm
Posts: 46
Location: QLD, Australia
Reply with quote
Post Re: Simple Lua requests thread.
Can someone perhaps create a quick script that attributes some gold to Team 0 each time someone on Team 1 is killed? And if possible, perhaps make it so only Team 1 deaths caused by Team 0 count.


Fri Sep 05, 2008 6:24 am
Profile

Joined: Fri Mar 16, 2007 1:28 pm
Posts: 328
Location: Finland
Reply with quote
Post Re: Simple Lua requests thread.
Daman wrote:
It's not going to be water then? When you shoot it it won't splash. There will be an area above the water where things will float when not even in the water.

Point is it's not water if physics isn't going to be able to be applied to it. It's just space where stuff floats, except with added lag because of the use of particles far apart from each other instead of zones.


Pardon me for again taking against you, but...
I never said it wouldn't have physics applied to it.
I meant that the pixels can be covered with, for example, water-like screen effects, so they keep the distance between each other as 20(or just about any number).
The water is not as fluid, but it will still flow around and stack on each other. It will only keep the distance to terrain, each other, and maybe bullets for splashing. Actors just have effects like damping applied to them when in range of the water pixels. The water flows and affects things, but doesn't cause that much lag thanks to reduced amount of particles.

Edit: Typofix


Fri Sep 05, 2008 12:36 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 80 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.073s | 15 Queries | GZIP : Off ]