Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 82 83 [84]

Author Topic: Programming Help Thread (For Dummies)  (Read 32359 times)

kytuzian

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1245 on: April 20, 2014, 07:33:29 am »

My girlfriend (who is more familiar with Lua than I am) was telling me that it should be capitalized. Then again it could have just been sleep deprived ramblings at 3 AM.

I just did a quick test, it is case=sensitive and the actual keyword is "and"
Logged
Youtube:
http://www.youtube.com/user/Kytuzian

Alright, I'd just like to declare that we are now officially a debate group. In less than 24 hours we have created over 10 pages of proposals and counter proposals.

Antsan

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1246 on: April 20, 2014, 04:40:56 pm »

I am attempting to do a game and for that game I thought I'd use collaborative diffusion. I've got the idea from this paper:
http://www.cs.colorado.edu/~ralex/papers/PDF/OOPSLA06antiobjects.pdf

This paper offers the following diffusion equation:
u(0,t+1)=u(0,t)+d*sum[across neighbours i](u(i,t) - u(0,t))
with u(0,t) being the diffusion value of the center,
u(i,t) being the diffusion values of it's neighbours and
d being the diffusion coefficient determining how fast diffusion happens. d is in the range [0,0.5]

This formula is very likely not correct, as for 2 neighbours, d=0.5 and u(i,t)=0 for all neighbours i it returns u(0,t+1)=0, which just doesn't seem right - I don't think that's how diffusion is supposed to behave.
Even worse: With more neighbours the value for u(0,t+1) can become negative and this is definitely not right, as the magnitude of the negatvie value becomes even bigger when the diffusion value at the center is more positive beforehand.
Does anyone know the correct diffusion equation for discrete grids?

I tried to do some corrections myself, such as not multiplying with d but instead with d/(number of neighbours) or using the sum
sum[across neighbours i](u(i,t) - u(0,t)/(number of neighbours))
instead, but the results of those seemed strange.
Logged
Taste my Paci-Fist!

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1247 on: April 20, 2014, 06:31:54 pm »

If all neighbours have a value of 0, why should the value of the centre change at all?
Logged

Antsan

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1248 on: April 21, 2014, 02:48:21 am »

Because what is in the center dissipates into the neighbours. It diffuses.
The diffusion equation is calculated for any position on the map once per time step. In the end the diffusion equation is the rule of a continuously valued cellular automaton.
Logged
Taste my Paci-Fist!

AlleeCat

  • Bay Watcher
  • Meow?
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1249 on: April 21, 2014, 03:54:08 am »

Now we have another problem. I'm having a syntax error at the end of an if loop for some reason.
Code: [Select]
if gamestate == "credits" then
love.graphics.setColor(255,0,0)
love.graphics.setFont("buttonFont")
love.graphics.setColor(0,0,0)
love,graphics.print("Back",20,652)
end
I cut out some extraneous bits in the middle. It's a long loop, but I'f got an even longer loop in the same file that works just fine. The error is telling me the syntax error is on line 52, and the only code on that line is "end".

Skyrunner

  • Bay Watcher
  • :v
    • View Profile
    • Winterer
Re: Programming Help Thread (For Dummies)
« Reply #1250 on: April 21, 2014, 04:08:44 am »

You typed a comma instead of a period on the 2nd to last line. After love.
Logged


Erosion sim? ;3 (DirectX 11 required)

AlleeCat

  • Bay Watcher
  • Meow?
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1251 on: April 21, 2014, 05:02:14 pm »

And this is why coding in the middle of the night is a bad idea.

EDIT:
I Also noticed another typo in that "Back" should be printed at 20,562 instead of 20,652. It was being drawn offscreen.
« Last Edit: April 21, 2014, 05:32:55 pm by AlleeCat »
Logged
Pages: 1 ... 82 83 [84]