Not logged inOpenClonk Forum
Up Topic Development / Scenario & Object Development / Boni says we need a wind-ish system for windmills
- - By Matthias [de] Date 2012-03-26 20:05 Edited 2012-03-26 20:09
... And caesar says it's too expensive. What about something simple, like this?

The idea is to simply check at 5 points instead of only at the center of the windmill. There would be a formula which is used to compute the turning speed. Each point where there is sky in the background would be summed in with some weightinf factor.
For example, from left to right: 5, 20, 50, 20, 5 (most likely not the optimal distribution of weights, I think Peter can come up with something better). This way, windmills would work better when build in open places, but could also still work when placed in cave entrances.
This won't be a perfect imitation of wind behaviour, of course, but it would be better than it is now.. ;)
Attachment: windish.png (38k)
Reply
Parent - - By Zapper [de] Date 2012-03-26 20:08
But don't forget to check for a free path :)
Parent - - By Matthias [de] Date 2012-03-26 20:09
Not really. Why? If theres an obstacle between two of those points, chances are that its just some loam bridge or a rather thin chunk of material. Wind would ignore that. ;)
Reply
Parent - - By Zapper [de] Date 2012-03-26 20:35
PS: Yes, I am going to build that!
Parent - - By Matthias [de] Date 2012-03-26 20:42
Besides that it would not turn due to its vertices being stuck, where is the problem? Since there is sky in the middle of your construction there, it must be some kind of tube... so wind should be able the get through it. Also: The same "problem" arises with the current solution! ;)
Reply
Parent - - By Zapper [de] Date 2012-04-21 11:05
When I implemented your suggestion I noticed that currently the vertices of the generator do not play any roll since it uses mesh animations atm :/

a) replace animated mesh with attached object (bad for rotation and construction wireframe) or b) additional invisible attached object that has to be synced with the animation (more hacky but cleaner in the end).
I tend to do the latter atm *loud thinking*
Parent - By Maikel Date 2012-04-21 11:08
b is preferred by me also, to the other question, please go ahead an implement this.
Parent - - By Clonk-Karl [de] Date 2012-04-21 13:39
Make sure to apply the mesh transformation to the vertices of the invisible object or you will have the same problem with "bad for rotation" (collision vertices not being in sync with graphics).
Reply
Parent - - By Zapper [de] Date 2012-04-21 16:28
Custom vertices reset when you rotate the object :/

I guess I will rely on "the windmill is never rotated too much" and just use hardcoded vertices
Parent - By Günther [de] Date 2012-04-21 16:34
We probably should change that one of these days.
Reply
Parent - - By boni [at] Date 2012-04-21 16:46
Parent - - By Zapper [de] Date 2012-04-21 17:37
Oh, I see
Parent - - By boni [at] Date 2012-04-21 20:01
Your answer pleases me. I totally feared you were talking about a different problem. ;P
Parent - By Zapper [de] Date 2012-04-21 20:11
I just remembered using SetR(GetR()) in CR to reset my custom vertices.. :)
Parent - - By Caesar [de] Date 2012-04-21 23:16
Reply: Can't you make the default mesh have a rotor (and probably a ring which indicates how big it is going to be) and make that go away on construction?
Parent - - By Zapper [de] Date 2012-04-21 23:25
The whole windmill is rotated by a random amount at construction for visual effects. Also it's not facing the screen like in CR
Parent - - By Caesar [de] Date 2012-04-22 10:23
How does that make my suggestion impossible?
Parent - - By Zapper [de] Date 2012-04-22 12:20
You still want another object to rotate like in CR, right?
Parent - By Caesar [de] Date 2012-04-22 14:09
Yes, because as far as I can see, that would put the position syncing magic for the helper objects into the engine.
Parent - By Zapper [de] Date 2012-03-26 20:39
PPS: Then just check for a existing paths to those points (GetPathLength)
Parent - - By Zapper [de] Date 2012-04-21 07:44
Is anything speaking against implementing it they way you suggested or should I just go ahead and do it? *revives dead topic*
Parent - By boni [at] Date 2012-04-21 10:36
I don't see anything wrong with testing it. The windmill wont be changed much, anyway and we can backout the change at any time :)
Parent - - By Zapper [de] Date 2012-04-21 20:13
Implemented.
I used 10 25 30 25 10.

For the "wings can be obstructed now"-thing:
I had no good idea to keep them in sync 100%. So that means if the windgenerator is obstructed and the wings stuck, the generator might stop a little bit later. If anyone wants to improve that, feel free
Other than that, we should see whether it annoys anyone ingame.. :)
Parent - - By Clonk-Karl [de] Date 2012-04-21 20:48
Would it be helpful if I added an Anim_R function to the engine which synchronizes the animation state with the rotation of an object?
Reply
Parent - By Zapper [de] Date 2012-04-21 21:00
If you could pass another object as the parameter then yes :)

The situation is that object A has the animation, but object B is the one that is actually rotating
Parent - - By PeterW [gb] Date 2012-04-23 16:43

> most likely not the optimal distribution of weights, I think Peter can come up with something better


Uhm, only now I realize that I was name-dropped :-o

Well, I don't really have a strong opinion on this topic. I still think that having a safeguard against building completely useless windmills would be a good idea. And optimality is very hard to define here... What exactly would you try to optimize?

Instead, here's a random idea: Instead of five static points you could sample three points into a somewhat random direction every couple of frames - then weight the result, add to a moving average, and set the windmill speed accordingly. I think that could give some nice organic results.
Parent - By boni [at] Date 2012-04-23 21:45

>I still think that having a safeguard against building completely useless windmills would be a good idea. And optimality is very hard to define here...


A CanBeBuiltHere(x,y) definition callback wouldn't be hard to implement, considering our construction preview.
Up Topic Development / Scenario & Object Development / Boni says we need a wind-ish system for windmills

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill