A suggestion for ONS gamemode

A suggestion for ONS gamemode

Moderator: Content Developer

Post Reply
Wolfword
Posts: 60
Joined: 19 Dec 2009, 14:12

A suggestion for ONS gamemode

Post by Wolfword »

I've noticed that when you play ONS, the data vents "links" that are connected to the enemy base are visible no matter if I don't have LOS of them.

I suggest to make these links invisible until I have LOS of the data vent.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: A suggestion for ONS gamemode

Post by zwzsg »

Yeah, ideally I would want the ONS links to be visible only when in line of sight as well. But technically, it aren't that easy: The way it is now, I recalculate the vertice of the link lattice only when a factory is finished or destroyed. And then I cache it in a display list, so that drawing is fast. If it were to obey los, I wouldn't be able to cache anymore the link geometry, I would have to recalculate it every frame. Or maybe just a couple time per second, but still, I'm afraid it would cost too much CPU.

I know that a couple version ago, when ONS was set to "homebase only" which causes long links, on a map such as major madness, you could feel the game pause for like half a second or so everytime the ONS link lattice had to be recalculated. Since then (KP 3.6 -> KP 3.7) I optimised by fixing a silly mistake in my code that made it use many super short segments, but I'm not sure that's enough to allow it to run several time per seconds without decreasing performance. It may seem odd that drawing such simple links could have a CPU cost, but keep in mind they're coded in Lua, and that I'm not the best OpenGL coder.

The code change to make ONS links obey los is simple enough, but measuring the associated performance drop is not. CA used to have a gadget profiler, but it relied on a custom gadget handler with so many differences in the callins I couldn't get it to work with KP last time I tried. Now that I understand a bit better Spring's Lua, maybe I could port it or write my own, and eventually I hope that I will, since ONS is not the only gadget I'm curious to know the CPU cost of, but that's the sort of unenticing task I keep delaying forever.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: A suggestion for ONS gamemode

Post by KDR_11k »

Maybe put each link into a display list and only draw the ones that have at least one end point in LOS?
Post Reply

Return to “Kernel Panic”