Posted: 17 Sep 2007, 23:44
LOL.C++ <> LUA. You don't really have inheritance
LOL.C++ <> LUA. You don't really have inheritance
First off, if you have to attack that sub-point to get anywhere, then you are speaking from a position of weakness. It's like the Winston Churchill speech, where he annotated his text with a note saying, "argument weak here- shout".Saying C++ has no inheritance really is your biggest feat of stupidity in this thread.
QFT. If statements might mean that there's some unnecessary nesting, but that should be just factored out into smaller functions. If maintainability is the problem, rip out the problem code into it's own function and work on that.KDR_11k wrote:I wrote a long reply picking your points apart but then I decided only to write the most important point down so it's not missed:
There's O(n²) code in the update loop and you're worried about a few if statements?
Yes, really all it is is abstracting the "If" into a virtual function call on an owned (auto_ptr) reference. It's cleaner, but no more effecient.KDR_11k wrote:Oooh, I can imagine Argh hating that idea because of the number of stack operations and pointer references in use...
Code: Select all
if (isWobbling) {
--wobbleTime;
if (wobbleTime == 0) {
float3 newWob = gs->randVector();
wobbleDif = (newWob - wobbleDir) * (1.0f / 16);
wobbleTime = 16;
}
wobbleDir += wobbleDif;
dir += wobbleDir * weaponDef->wobble * (owner? (1 - owner->limExperience * 0.5f): 1);
dir.Normalize();
}
if (isDancing) {
--danceTime;
if (danceTime <= 0) {
danceMove = gs->randVector() * weaponDef->dance - danceCenter;
danceCenter += danceMove;
danceTime = 8;
}
pos += danceMove;
}
That would cause incomprehensible code bloat, you'd need to create a new weapon type for every combination of tags.Argh wrote:Both of these functions could be put into a separate #include, "projectileMovementTypes", that would have functions for all of this stuff (think- we could have Wobble and Dancing for just about anything!) and only run per-frame if they were part of the TDF definition, otherwise they shouldn't ever get called.
Can't we just have weapons call only those functions that are activated via TDFParser? So that, for example, if we want to have a noExplode BeamLaser, noExplode == 1, and if noExplode == 0, then that logic is never called? The problem, as I see it, is that a totally "universal weapon" is going to be massively bloated, because it will be chock-full of IFs-per-frame, but we could get closer to that goal without the bloat if we had some strict archetypes that could make use of a fairly wide number of properties.That would cause incomprehensible code bloat, you'd need to create a new weapon type for every combination of tags.
fixedMadRat wrote:I just want someone to make a patch that puts a cone on the target that can be fired upon, basically the opposite of the aiming cone. Would solve the problem.