Page 1 of 1
Call-in For Unit turing
Posted: 27 Jul 2013, 11:44
by FireStorm_
Spring Q&A site, I miss it. At Q&A I felt more comfortable asking potential stupid and lazy things because you were building a handy tome of knowledge. probably gone with reason but can't remember atm. Guess the forum has to do:
I remember units (motorcycles, dominatrix in zero-K?) that show animation when they turn. I thought that, if I had the time, I could use that for moving wing-flaps on some aircraft I made. But I've been reading up on lua Call-ins and I couldn't find a UnitTuring () kind of thing.
1) Can I detect a unit turning?
2) Is it in the dominatrix script, and if yes, what is the file called?
3) Carefully considered sentiments about Q&A-site also welcome

Re: Call-in For Unit turing
Posted: 27 Jul 2013, 11:54
by Beherith
A lot of those really awesome wing flaps have been sacrificed by me on the altar of performance. Fighters, because of their spammability are unfortunately the target in this case. Unit rendering scales almost linearly with piece count.
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 12:05
by FireStorm_
Unit rendering scales almost linearly with piece count.
Oh, I never realised. That seems something I should take into account with any future endeavours.
(Still care to know how flaps might be done though, although it just plummeted on my priority list

)
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 12:10
by FLOZi
I'd like to see code for that too, nothing elegant springs to mind for it?
SpringQ&A should be brought back even if its just to archive the most useful info to the wiki, but I haven't seen koshi in ages to bug him about it.

Re: Call-in For Unit turing
Posted: 27 Jul 2013, 12:20
by KingRaptor
The ZK animations are just GetUnitValue(COB.HEADING) at regular intervals plus some math, really. (not as easy as it sounds though!)
https://code.google.com/p/zero-k/source ... car.lua#56
https://code.google.com/p/zero-k/source ... fav.bos#53
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 12:38
by FireStorm_
I see how I could (maybe sometime) make a flap with that

. Thanks.
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 13:36
by Beherith
Goddamn that corfav polls every 2 frames with its animcontrol? Pretty pricey.
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 17:04
by knorke
In spring tanks i do turning like this:
Code: Select all
function updateheading()
while (true) do
currentheading = Spring.GetUnitHeading(unitID)
Sleep (200)
For the faster tank it is Sleep (100) instead of 200.
---
Unit rendering scales almost linearly with piece count.
Linearly is good. I tested a model with ~66 pieces and combined them in Upspring into one piece.
With 50 units the difference is not really big:
~83 fps vs ~84 fps.
http://www.abload.de/img/pieces_speed_testenuzu.jpg
(94.1)
ok, BA fighters are superduper spammable but for units build in normal numbers it does not seem to matter that much.
Still try to use as few pieces as possible and in some cases I have two variants of the same model. (normal one and 1piece version)
On Q&A page a dev said it matters if you have a flat or nested piece hierachy, but did not test that yet. (iirc there was also some improvement in engine to make units with many pieces render faster)
---
Q&A page:
http://springrts.com/phpbb/viewtopic.php?f=71&t=29652
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 17:41
by jK
avgDrawFrame: 10.5ms
avgDrawFrame: 3.9ms
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 17:58
by knorke
What do you mean, that performance cost is higher than the fps suggest?
Maybe that avgDrawFrame thing doubled but fps did not halve. If it only has small impact on fps then it seems okay to me.
imo what matters for the player is how smooth the game runs.
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 20:06
by jK
it means CPU time decreased dramatically, but your GPU isn't fast enough to process the frames fast enough and blocking all speed up given by less pieces.
-> SwapBuffer is eating a damn lot of time
For other systems/game situations this doesn't need to be happen -> they get a dramatic FPS decrease with increased piece count.
Re: Call-in For Unit turing
Posted: 27 Jul 2013, 20:29
by knorke
ah. Yes my GPU is fail and probally bottleneck.
But then my CPU is fail, too.
So other computers might lose more frames but even if it goes
300 fps (few pieces)

100 fps (many pieces) that would be a dramatic drop.
But is still better performance than my 84 fps.