View topic - Engine streamline suggestion



All times are UTC + 1 hour


Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: 09 Oct 2008, 15:09 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
Currently we have a lot of behaviors and unit logic that runs even though it isn't necessary in all situations. Sometimes it would be advantageous to strip a lot of stuff out and have only whats needed to run the simulation actually running.

Then there's the problem of having to recreate those behaviors in lua and have them running twice if they need to be modified.

So I suggest we start moving the TA unit logic out of the engine C++ code, and into lua gadgets. These gadgets would be bundled along with the OTA base archives. This way they can be overriden and modified if necessary, and those games that do not need them can simply not include them.

This should allow for small gains in performance, possibly negligible, but the added flexibility both in content development and in cleaner engine code should outweigh that immensely.

It would also allow people to fix behavior bugs without requiring a whole new release of the engine, and it would increase the pool of potential contributors since you would not need to be able to compile and understand the engine in order to modify things.

An added benefit would be that it can be done incrementally and not all at once.

Examples of unit logic that could be moved into lua gadgets:

  • Air repair pads
  • Construction animations & wireframes
  • Compound commands such as patrolling


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 15:35 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
Others:
Com ends
Limit d-gun
Resource sliders
Diminishing metal maker
(and made to work as mod options)

Why remove patrol/airbases af?


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 15:50 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
not remove, but move. This way the logic can be modified by games without duplication.

It also means games that do not have aircraft or repair pads no longer need the behavior running


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 16:17 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
ok so what about patrol?


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 16:23 
User avatar

Joined: 23 Oct 2004, 00:43
smoth wrote:
ok so what about patrol?


"Patrol" is really just a looped group of "fight" commands, isn't it?


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 16:27 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
"Fight" was added later wasn't it, but to be honest I am not sure pxtl. Sorry. I need to go grab the source again, I have some lingering curiosities about the engine.


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 17:04 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
fight is a patrol command that doesnt repeat, and patrol is the same as a set of fight commands with repeat turned on.


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 18:26 
Spring Developer
User avatar

Joined: 13 Nov 2004, 08:35
Location: Central Time Zone, USA
Fight was added later, but Patrol was rewritten (if I remember correctly) to do the looping part, and then transform the currently executing one into a fight command. Most of the code in fight was originally in patrol.


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 18:36 

Joined: 27 Feb 2006, 02:04
I was under the impression that Lua code was orders of magnitude slower than native compiled C++ code. I'm sure most of these features aren't too CPU intensive, but it would suck if we traded some unused code that slightly slows you non-TA mods down for some Lua code replacements that REALLY slow down the TA based mods and anything else that use those features.


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 18:40 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
It would suck if it slows it down but from what I understand the direct call-in stuff was pretty quick.


Top
 Offline Profile  
 
PostPosted: 09 Oct 2008, 20:23 
P.U.R.E. Developer
User avatar

Joined: 21 Feb 2005, 03:38
Location: Herding cats uphill whilst wearing roller skates.
Um, from most of the studies we viewed, Lua's pretty fast- remember, it's being compiled at runtime.

Just like anything, there are pitfalls, but they're well understood.

And during the process of moving things, it's quite likely that things could be modularized better and otherwise streamlined. I think that this might be a winner of an idea, for everybody.

That said... who in the heck is going to do it? I'm not really qualified, and we're talking about a huge amount of work here. Do we have enough guys who know Lua and C++ well enough, and do they have enough interest to see this through?


Top
 Offline Profile  
 
PostPosted: 10 Oct 2008, 11:03 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
Its not as hard as one would think, nor does it need to be done all at once.


Top
 Offline Profile  
 
PostPosted: 12 Oct 2008, 05:39 
Redacted
User avatar

Joined: 08 Jan 2007, 06:13
Location: Don't be silly. If there's no machine heaven, where do all the toasters go?
Each patrol command acts like a fight command with a special repeat feature. This is different than a unit that's running actual fight commands and on repeat because you can mix in normal commands into a patrol route and they won't be repeated. (Though it would be nice if they went next in line instead of at the end.)


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.