Call-in For Unit turing

Call-in For Unit turing

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
FireStorm_
Posts: 666
Joined: 19 Aug 2009, 16:09

Call-in For Unit turing

Post 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 :-)
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Call-in For Unit turing

Post 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.
User avatar
FireStorm_
Posts: 666
Joined: 19 Aug 2009, 16:09

Re: Call-in For Unit turing

Post 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 :-) )
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Call-in For Unit turing

Post 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. :(
User avatar
KingRaptor
Zero-K Developer
Posts: 838
Joined: 14 Mar 2007, 03:44

Re: Call-in For Unit turing

Post 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
User avatar
FireStorm_
Posts: 666
Joined: 19 Aug 2009, 16:09

Re: Call-in For Unit turing

Post by FireStorm_ »

I see how I could (maybe sometime) make a flap with that :-) . Thanks.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Call-in For Unit turing

Post by Beherith »

Goddamn that corfav polls every 2 frames with its animcontrol? Pretty pricey.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Call-in For Unit turing

Post 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
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Call-in For Unit turing

Post by jK »

avgDrawFrame: 10.5ms
avgDrawFrame: 3.9ms
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Call-in For Unit turing

Post 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.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Call-in For Unit turing

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Call-in For Unit turing

Post 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) :arrow: 100 fps (many pieces) that would be a dramatic drop.
But is still better performance than my 84 fps.
Post Reply

Return to “Game Development”