Author Topic: Idea for Speeding Up Aurora  (Read 13277 times)

0 Members and 1 Guest are viewing this topic.

Offline letsdance

  • Warrant Officer, Class 2
  • ****
  • l
  • Posts: 71
Re: Idea for Speeding Up Aurora
« Reply #15 on: September 09, 2014, 02:10:19 AM »
It's not quite as simple as that. Contact would have to be maintained on every sub-pulse of every increment or missiles would lose lock, for example. Also, how do you decide when to stop using the constant sensor phase and go back to occasional?
it's hard to make senseful suggestions in this regard without knowing the code =)

if possible i would add a flag (bool) to each system. if the flag is TRUE, sensor phase is done in short intervals (like it's done now), if it's FALSE, sensor phase is only done every 5 days (or any other interval that makes sense). the flag ist set to TRUE if any NPR requests it. the request would be a decision to attack, and maintaining it during the fight or engagement. when the combat is over or all involved AIs decide to stop engagement, the flag can be set to FALSE again. any time the use of a jump point results in a human player being in the same system as anything else sets the flag TRUE as well, until this changes.

this assumes that the AI at some point decides to attack, and also to stop attacking, and recognises that a combat is over. at these events the flag can be set/unset. there could be other events as well, depending on the set POIs or related actions. it also assumes that we can turn sensor phase on/off for each system separately (which seems to be the case from your suggestion). when implementing, care would need to be taken that no TRUE request can be canceled by any FALSE request.

this would make short interval sensor phases happen only where and when it matters, hopefully giving us the benefits of both solutions (NPR combat can still happen almost like now, but less calculations where it does not matter). it makes only sense if currently the sensor phase takes significant time even if it produces no results. otherwise this suggestion wouldn't do much.
« Last Edit: September 09, 2014, 02:32:15 AM by letsdance »
 

Offline alex_brunius

  • Vice Admiral
  • **********
  • Posts: 1242
  • Thanked: 154 times
Re: Idea for Speeding Up Aurora
« Reply #16 on: September 09, 2014, 02:29:56 AM »
As for the main topic on detection, I'll just repeat what others have said for statistical purposes - no detection means too much weird stuff will happen with NPRs, like two races establishing a colony on the same planet (maybe even on each other's homeworld) and then suddenly nuking all of them at once when the player arrives. Not exactly fun. As such I'd like this to be no more than an option for players to increase their performance at the price of the realism. I'd never use it though.

That is true, and another reason it might be good to at least simulate adjacent systems sensors fully too ( so that once a player get close systems start to behave more normally and the "dust" has time to settle, litteraly ).

This brings up another AI problem though, it's inability ( or reluctance? ) to use ground forces instead of overwhealming nukes even against bodies it has a large population of it's own on. If the AI would instead have ground wars and/or occupied populations as a result of the situation you bring up that would only be cool to watch and add a great sense of history and flavor to the game IMO.
 

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11691
  • Thanked: 20519 times
Re: Idea for Speeding Up Aurora
« Reply #17 on: September 09, 2014, 03:46:09 AM »
this assumes that the AI at some point decides to attack, and also to stop attacking, and recognises that a combat is over.

How would you define "deciding to attack" and "recognising a combat is over".

Consider for example, a survey ship in the outer system detected at several billion kilometres. How about an intruding ship that is faster than the defenders? What about enemy warships that have launched a missile attack and are retreating toward a jump point?
 

Offline letsdance

  • Warrant Officer, Class 2
  • ****
  • l
  • Posts: 71
Re: Idea for Speeding Up Aurora
« Reply #18 on: September 09, 2014, 04:11:20 AM »
How would you define "deciding to attack" and "recognising a combat is over".

Consider for example, a survey ship in the outer system detected at several billion kilometres. How about an intruding ship that is faster than the defenders? What about enemy warships that have launched a missile attack and are retreating toward a jump point?
i don't know how the AI handles such things. but surely, if the AI is fighting at all, it must at some point decide that it wants to attack a ship. otherwise it would never happen. likewise, at some point it must recognise / decide that there are no more enemy ships and stop attacking / executing combat moves / scanning.

survey ship: depends on the plan. if the AI wants to attack it, sensor checks are needed. if the AI does not want to attack it (for whatever reason), no sensor checks are needed. there must already be AI code for those decisions. in the last case, there'll be another sensor check at the set interval again, allowing the AI to decide again. if the AI does not want to fight, but wants to keep watching (this one is probably not in the AI code right now, but it's not that important), sensor checks are needed.

an intruding ship that is faster than the defenders: if the defenders want to fight (even though it's unlikely or impossible that they will succeed - but you won't know this unless you calculate the whole combat), sensor checks are needed. if the defenders do not want to engage (for example because they realise it's hopeless), and the intruder does not want to fight either, no sensor checks are needed. if the AI does not want to fight, but keep watching in case the intruder gets closer, sensor checks are needed. it all depends on the requirements of the AIs planned actions. there must already be code for most of this, otherwise the AI wouldn't ever do anything. it's a matter of adding the requirement for sensor checks to those decisions. of course i don't know how easy that is.

as long as there are missiles running, combat is not over. there might be a problem with special missiles (mines, buoys), but those should be solved one way or the other.

it's not about making it perfect, the goal is an improvement, right? if we can't solve all possible solutions, it's better to fix it at least for most of them.

again, i don't know how much time of the current sensor phase is needed for such things anyways. my suggestion makes only sense if most of the sensor phase calculations are needed for other things that would get filtered out.
 

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11691
  • Thanked: 20519 times
Re: Idea for Speeding Up Aurora
« Reply #19 on: September 09, 2014, 06:45:31 AM »
i don't know how the AI handles such things. but surely, if the AI is fighting at all, it must at some point decide that it wants to attack a ship. otherwise it would never happen. likewise, at some point it must recognise / decide that there are no more enemy ships and stop attacking / executing combat moves / scanning.

The AI makes decisions on whether to close on targets, or avoid them or shadow them or remain at a set range, and continually checks for firing opportunities. It does not make a specific decision to 'attack' at some point in that process apart from the decision to fire (even that is judged by whether the target could evade missiles before they arrive even if in range at that moment).

Quote
survey ship: depends on the plan. if the AI wants to attack it, sensor checks are needed. if the AI does not want to attack it (for whatever reason), no sensor checks are needed. there must already be AI code for those decisions. in the last case, there'll be another sensor check at the set interval again, allowing the AI to decide again. if the AI does not want to fight, but wants to keep watching (this one is probably not in the AI code right now, but it's not that important), sensor checks are needed.

an intruding ship that is faster than the defenders: if the defenders want to fight (even though it's unlikely or impossible that they will succeed - but you won't know this unless you calculate the whole combat), sensor checks are needed. if the defenders do not want to engage (for example because they realise it's hopeless), and the intruder does not want to fight either, no sensor checks are needed. if the AI does not want to fight, but keep watching in case the intruder gets closer, sensor checks are needed. it all depends on the requirements of the AIs planned actions. there must already be code for most of this, otherwise the AI wouldn't ever do anything. it's a matter of adding the requirement for sensor checks to those decisions. of course i don't know how easy that is.

as long as there are missiles running, combat is not over. there might be a problem with special missiles (mines, buoys), but those should be solved one way or the other.

it's not about making it perfect, the goal is an improvement, right? if we can't solve all possible solutions, it's better to fix it at least for most of them.

again, i don't know how much time of the current sensor phase is needed for such things anyways. my suggestion makes only sense if most of the sensor phase calculations are needed for other things that would get filtered out.

I guess what I am driving at is the 'combat' is a lot more than shooting. If you are faced with a faster ship then you might still be able to intercept if its is moving toward you, or you can set a converging course, or if another unit may be closer and could damage it to slow it down or if it decides to hold position for some reason, or it suddenly changes course, or you can attract it with another unit and pull it into range, or some of the other situations you mentioned above, etc. etc.. You would have to do this for any combination of ships in the system.

You would end up with a longer, slower piece of code deciding whether sensors should be used than just running the sensor phase anyway. Aurora is very complex in terms of interactions so what sounds simple, usually isn't.

« Last Edit: September 09, 2014, 06:50:54 AM by Steve Walmsley »
 

Offline letsdance

  • Warrant Officer, Class 2
  • ****
  • l
  • Posts: 71
Re: Idea for Speeding Up Aurora
« Reply #20 on: September 09, 2014, 07:03:52 AM »
I guess what I am driving at is the 'combat' is a lot more than shooting. If you are faced with a faster ship then you might still be able to intercept if its is moving toward you, or you can set a converging course, or if another unit may be closer and could damage it to slow it down or if it decides to hold position for some reason, or it suddenly changes course, or you can attract it with another unit and pull it into range, or some of the other situations you mentioned above, etc. etc.. You would have to do this for any combination of ships in the system.
any of these would require short sensor intervals. but all these examples have one thing in common: they start with a successful detection, which is the core of my suggestion to start using short sensor phase intervals once it matters.[/quote]

You would end up with a longer, slower piece of code deciding whether sensors should be used than just running the sensor phase anyway.
that's possible but only you can judge if it's worth it. setting a bool flag shouldn't take much time though, compared to calculating all sensor ranges to all ships.

besides this, maybe it's possible to optimize the sensor phase in some other way. for example stop it when all ships in the system are detected or similar tricks.

another thought concerning civilian shipping lines: much thought and effort went into these, but from a gameplay point of view they are just a nice little feature, which doesn't justify a CPU usage high enough to significantly slow down the game. i wouldn't mind if they could (optionally) be removed alltogether. maybe as compensation wealth from taxes should be increased accordingly.

i maybe unable to post for a few days, but i'll check back here.
 

Offline alex_brunius

  • Vice Admiral
  • **********
  • Posts: 1242
  • Thanked: 154 times
Re: Idea for Speeding Up Aurora
« Reply #21 on: September 09, 2014, 07:16:46 AM »
I think I understand what letsdance is getting at. Basically splitting up sensor checks into two levels.

High level - Initially detecting hostile ships at all ( only needed perhaps every 24 hours or every 5 days? )
Low level - Tracking of hostile ships and missiles ( at subpulse like presently )

So before any NPR ship is activly tracking other NPR ships ( or after they lost contact ), you can skip subpulse sensor steps. This should mean less combat, but still ensure that they can't both camp the same body or jump point without detecting and engaging.
« Last Edit: September 09, 2014, 07:18:38 AM by alex_brunius »
 

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11691
  • Thanked: 20519 times
Re: Idea for Speeding Up Aurora
« Reply #22 on: September 09, 2014, 07:48:06 AM »
I'm going to make this my last reply on this particular line of thinking because we are starting to go in circles a little.

any of these would require short sensor intervals. but all these examples have one thing in common: they start with a successful detection, which is the core of my suggestion to start using short sensor phase intervals once it matters.
that's possible but only you can judge if it's worth it. setting a bool flag shouldn't take much time though, compared to calculating all sensor ranges to all ships.

Obviously setting a bool flag is easy. As I've tried to explain - calculating the logic that allows you to know when to set it is a little trickier. Also, if the intervals are 5 days for example, you run into the major issue raised by objections to the non-detection option. Ships may be very close (in orbit for example) when detected.

Quote
besides this, maybe it's possible to optimize the sensor phase in some other way. for example stop it when all ships in the system are detected or similar tricks.

Ships can be detected using four different methods - you would have to continue until all ships are detected with all methods (at least those available) but part of detection is also knowing when you lose contact so if you stop sensor phases you wouldn't know when that happened.

Quote
another thought concerning civilian shipping lines: much thought and effort went into these, but from a gameplay point of view they are just a nice little feature, which doesn't justify a CPU usage high enough to significantly slow down the game. i wouldn't mind if they could (optionally) be removed alltogether. maybe as compensation wealth from taxes should be increased accordingly.

i maybe unable to post for a few days, but i'll check back here.

Whether civilian shipping lines are fluff or a useful part of the game is really a matter of opinion. For me, they add a lot to the game by simulating the civilian traffic that would be affected when hostilities break out. If you have to start protecting defenceless, scattered merchantmen that could be a key part of your economy, it makes the game much more interesting that defending a few key bases or choke points. They could also be the first things attacked - even starting the war in the first place by being in the wrong place at the wrong time.
 

Offline alex_brunius

  • Vice Admiral
  • **********
  • Posts: 1242
  • Thanked: 154 times
Re: Idea for Speeding Up Aurora
« Reply #23 on: September 09, 2014, 08:34:59 AM »
I also agree that civilian traffic adds alot to the environment, story and combat situation with civilian ships in every corner of your empire that needs to be protected.

Wouldn't want to take them away even if it made the game 4 times faster.  ::)
 

Offline letsdance

  • Warrant Officer, Class 2
  • ****
  • l
  • Posts: 71
Re: Idea for Speeding Up Aurora
« Reply #24 on: September 09, 2014, 08:38:18 AM »
steve if you think disussing a point is... pointless, stop it. i'm just throwing out ideas that i would check. since i don't know the code it's hard to tell what would make sense and what doesn't.

but part of detection is also knowing when you lose contact so if you stop sensor phases you wouldn't know when that happened.
why? if i don't detect anything anyways it doesn't matter if i run all detection checks first. the AI doesn't know if it didn't detect anything because there is nothing, or because all detection checks failed.

other ideas would be to auto-detect all ships once at least one ship is detected (in a system), or to detect all ships/missiles of a certain class once one of that class is detected. this would let missiles and small ships keep part of their small size advantage (they usually travel in groups anyways), while probably reducing sensor calculations by alot (since small ships are usually numerous).

since small ships usually come in higher numbers it would probably reduce sensor time if higher resolution sensors searched first. (assuming that already found ships are not checked again for other sensors, which would then be another optimization idea).

civilian shipping lines: seeing the effort you put into them, i assumed that you like them alot. i think they're nice, but if it significantly reduces calculation time, i'd rather not have them. effects of war could be simulated by providing an income per system (slowly building up), and constantly reducing this while hostile ships are in the system.
 

Offline tenim

  • Leading Rate
  • *
  • t
  • Posts: 8
Re: Idea for Speeding Up Aurora
« Reply #25 on: September 10, 2014, 07:38:44 AM »
why not use multithreading in aurora? every thread could calculating on star system separately (they would be interact, or?) and if one thread is finished, he takes the next system that isn´t already calculated.  on a 4 core cpu with hyperthreading: 8 simultaneously threads possible -> speedup 8x.  ok, not exact, because of the synchronisation overhead, but the gain speed would be enormous.  on problem could be the database update if this happens during calculation.  in this case the update might me happen at the end of the calculation.

on vb6 multithreading is possbile:

hxxp: www. freevbcode. com/ShowCode. asp?ID=1287

no need to use a new language.  :-)
otherwise,  if a rewrite of aurora is planned, i strongly recommend lazarus (hxxp: www. lazarus. freepascal. org/) -a free delphi clone and sqlite (hxxp: www. sqlite. org/) as database.  i´m using this combination since many years and it works great and fast.  the other advantage is: both is free and runs under windows, linux and macos.

tenim
 

Offline Ninetails

  • Petty Officer
  • **
  • N
  • Posts: 19
  • Thanked: 1 times
Re: Idea for Speeding Up Aurora
« Reply #26 on: September 10, 2014, 01:57:43 PM »
I have already been thinking about the problem of detection in aurora (and other systems like it) before I saw this thread.  In general, one first need to realise that detections are a type of colition detection, and can make use of many of the relevant algorithms for dealing with this.
My suggestion is to try to predict when the next change of detection status could occure.  There are many ways to go about this, so I will just present the most simple one, and leave more powerfull and complex versions until another time.  The general idea is to come up with some prediction of when 2 objects (either detector or detectable) can either lose sensor contact or gain sensor contact.  In general this can only happen when 1 of 2 things occure: Either sensors/emission is turned on or off by some event (like activating active sensors, changing speed, jumps between systems, damaging components and such) or an object enters or leaves the detection range of a sensor.  Since the change events can be handled when they happen (and as such does not need to be handled by the sensor phase), we just need to predict when objects enter or leave the detection range.
In general we can group all objects into 3 catagories of movement: stationary objects (such as jump points and stranded ships), orbiting objects, and freely moving objects.  For each set of object types, we simply need to assign some prediction of when they could happen to detect each other.  The most conservative and simple option would simply be to assume that any 2 objects will be heading strait toward each other (ignoring that they are probably following another trajectory) and by using their current speed calculate when they will get within the range for each other.  If we are tracking disengagement, we would instead assume they were moving away frome each other.  For stationary objects, their speed will be 0, while orbitig objects could be described as bands of detection, though this can easily get quite complicated with nested orbits or orbit to orbit detection.  Anyway, since we can always atleast use the "move dirrectly toward or away" model, we can always come up with an estimate which will never be too late, and will work for all types of movement.

When we have such detection times, we can simply put them into an ordered queue (such as a min-heap), and simply only check for detection when we arrive at the time of the event at the top of the queue.  There are 2 speed ups form this.  First off, events could be many many subpulses away from each other, and we would not need to do any sensor checks in those phases.  Second off, it would only really be necessary to do a single sensor check when an event fires off, since it was only really relevant with one pair of sensor/detectable.  Ofcause one could do a full check and reset update the positions in the queue, if there is some reason to do it that way instead.  This could potentially significantly reduce the amount of sensor checks needed to be done, since it will only try it when it is relevant.  Since it is possible to ensure detection at the same accuracy as before with the conservative models metioned above, it would not even have to be limited to NPR vs NPR detection, though one could definitely get away with using some less conservative models, which would generate fewer events but risk being slightly inaccurate.

Concerning the civiliance, I would personally be happy if there was an option to disable them.  I would rather have to do most of the jobs they do myself.  While they do add something to the game, their potential high performance cost makes them a decent target for performances optimization (just as grafic heavy games often have options which makes the game much more ugly but significantly increases performance).

There are a lot of things that could be potentially be done to the NPR movements and civilian trade runs, which could improve performance.  But those would depend on what type of system is already implemented, and they would only really be improvements if they are upgrading from a slower system.
 

Offline letsdance

  • Warrant Officer, Class 2
  • ****
  • l
  • Posts: 71
Re: Idea for Speeding Up Aurora
« Reply #27 on: September 10, 2014, 02:44:40 PM »
would it be possible to make detection checks only against one ship per class per task group (same for missle volleys)? and use this result for all ships of this class in this task group /volley. this would reduce the detection checks by alot without changing much else (and contrary to my suggestion above, also works when nothing is detected). active sensors on/off should probably be distinguished, too.
« Last Edit: September 10, 2014, 02:54:37 PM by letsdance »
 

Offline letsdance

  • Warrant Officer, Class 2
  • ****
  • l
  • Posts: 71
Re: Idea for Speeding Up Aurora
« Reply #28 on: September 12, 2014, 06:13:47 PM »
Probably the most common complaint about Aurora (besides the UI and the install :)) is the speed at which the game runs. This is particularly an issue for larger long-term games. Another element of this is the 5-second slowdown which can occur during NPR combat.
by the way, it's not just the speed in general, it's also that often the game stops earlier than i wanted, without anything new happening for me. a better turn sequence like i suggested in the semi-official suggestion thread http://aurora2.pentarch.org/index.php/topic,5896.msg75601.html#msg75601 would also be a great improvement - together or independent from a general speedup.
 

Offline Barkhorn

  • Commodore
  • **********
  • B
  • Posts: 719
  • Thanked: 133 times
Re: Idea for Speeding Up Aurora
« Reply #29 on: September 15, 2014, 06:21:12 PM »
I had an idea about civilian shipping lines.  I think they should be abstracted most of the time.  You only really care where each individual ship is when an enemy is detecting them.  You don't need to know precisely where that ship full of merchandise is 24/7, so why bother even tracking it most of the time?  Civilian lines should just generate income and move colonists, goods, and installations on a monthly or 5-day basis, calculated based on the profitability of the routes they run.  When an enemy ship shows up, you could use the density of the civilian lines in that system to decide how many civilian ships might get spotted, and only then do you actually spawn non-abstract ships.