April 26, 2019, 05:35:57 AM

Author Topic: Strata Nova  (Read 859 times)

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1010
Re: Strata Nova
« Reply #15 on: April 10, 2019, 03:03:49 PM »
Sort of working on the initial ship stuff now:


When a ship is created it sits in stationary orbit until it has a destination

I've also been working on homeworld allocations and a base AI. In essence all planets are being tracked and research points are allocated when the AI feels it needs to. You pick your homeworld. the combator automatically picks it's own homeworld too.

I have run a few tests and  watched as the AI allocated resources and watched one planet go nuts with resources - very interesting stuff!

I am toying with the concept of triggers, so when resources reach a certain point then the planet would start to look for trade, or maybe conquest, etc...

Offline Derron

  • Hero Member
  • *****
  • Posts: 1963
Re: Strata Nova
« Reply #16 on: April 10, 2019, 03:41:16 PM »
Do not "trigger".
Give the AI priorities ... and maybe little tasks. These tasks need to get fulfilled and lower priorities when done.
So an explorative AI decides to build X ships. Task for X ships is created - and this leads to a task about collecting ressources ...
Once ressources are there, task is fulfilled - and the build-ship-task can get fulfilled too.

Using that approach allows for a versatility of AIs - with their own priorities (explorer, trader, ...).


bye
Ron

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1010
Re: Strata Nova
« Reply #17 on: April 11, 2019, 05:46:41 AM »
how would you approach the actual programming of an AI?

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1733
Re: Strata Nova
« Reply #18 on: April 11, 2019, 06:09:30 AM »
how would you approach the actual programming of an AI?
In it’s simplest form a state machine. Each AI action is based on a task so assign task IDs and action based on those. They call it AI but 99% of the time it’s nowhere near it.
Until the next time...

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1010
Re: Strata Nova
« Reply #19 on: April 11, 2019, 06:37:59 AM »
That's the sort of thing I thought.

I suppose the thing about AI is it should be able to do its' thing without any interaction from you. So it should be able to function as a player with its' own goals - however those goals are decided.


Offline Derron

  • Hero Member
  • *****
  • Posts: 1963
Re: Strata Nova
« Reply #20 on: April 11, 2019, 06:44:04 AM »
Yes I do not talk about a "real" AI.
All computer player decisions I am talking about are based on priorities/weighting.
This prio/weighting is influenced by simple mathematic values.


In TVTower the AI has certain options what to do:
- plan their programme schedule (movies ad spots)
- buy new ad contracts/check what is offered
- buy new programme/check what is offered
- rent rooms
- plan new news shows
- ...

Now each of this tasks is identifyable by a simple TaskID. Behind every task is a more or less complex object. ("TaskType" or how you call it).
Each TaskType has functions/methods to retrieve priority information:
- GetSituationPriority() - task might analyze current situation/environment and adjust prio accordingly
- GetStrategicPriority() - task might return a "player character indivdiual" priority
- ...

The situation priority for example checks for the buyMoviesTask if we have enough programmes to broadcsst to avoid outages. In the signContractsTask we check for suiting contracts to estimated audience ratings.
And so on.
Of course these tasks might influence other tasks too. Eg the programmeScheduleTask can add requirements/subtasks to the signContractsTask ...so it knows what to look for without being strictly coupled to the programmeplan (logic decoupling).

Once the current task is completed, all tasks are sorted by their freshly calculated "final priority" (GetSituationPriority() + GetStrategicPriority() + ...  or multiply depending on how you connect stuff). The task with highest priority is choosen.


As this task system would not react to outside events, you could have a "update()" for each task - and/or some events they get informed about ("onPlanetGetAttacked()" or so).
Also you should have some "emergency" system which allows to abort a current task in favor of a more important one.

To have the AI "develop" in a basic sense you would save eg who attacked you where etc. (array of entries). Then during calculating "whom to attack" you could still use a random number but increase chances according to the percentage of attacks by this person.


For your game you would need eg. tasks like:
- ProduceShips
- HarvestRessources
...

Just think of a human player: what does he do? "ahh have to check if planet produces enough" ..."oh I got attacked, lets build ships to send them out".


At least this is similar to how TVTower-AI does it and of course it is far from the holy grail - but it is kind of a state machine which allows a pretty easy extension.


Edit: you posted meanwhile - the TVTower-AI can replace the human player ingame (with a dev command) and just takes what it gets to continue playing. So this system of course allows that.

bye
Ron

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1010
Re: Strata Nova
« Reply #21 on: April 11, 2019, 11:53:17 AM »
mmmm

Watching the planets and their allocation of resources. They behave in some respects like the towns in 'Transport Tycoon'.

I've give each planet a ranged random trigger value. When this is reached then the planet has done enough research for space travel (of some kind).
My general thought is to see about using double the trigger value to decide the planet becomes hostile and more war-like (it might already be this, but if it isn't this becomes another trigger). That way there will be the possibility of conflict, and also there is how you decide to weight things yourself.

I would have thought that any planet you are in conflict with would not allow you to allocate their resources?

Offline Derron

  • Hero Member
  • *****
  • Posts: 1963
Re: Strata Nova
« Reply #22 on: April 11, 2019, 11:56:35 AM »
In an easy world yes, enemy <> trading partner.

In a real world ... commerce >> diplomacy.
If in war prices would increase (as it might be "illegal" to sell stuff). So give it a modifier "price = priceRaw * sympathyMod" or so. Sympathy depends on how friendly you are with them.


bye
Ron

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1010
Re: Strata Nova
« Reply #23 on: April 11, 2019, 12:18:03 PM »
yep, I've now got a workable 'friend' system.

In essence you can allocate planets resources for them - they like that.
or the planet does it for themselves - they don't like that

So you have a sort of guide as to how they feel towards you...

Again, here I thought that a super high rating would mean they would join forces with you?
and a super low rating would mean they join forces with your enemy?

so there is a sort of management system going on

Offline Derron

  • Hero Member
  • *****
  • Posts: 1963
Re: Strata Nova
« Reply #24 on: April 11, 2019, 12:36:37 PM »
I would say each planet's "government" holds a sympathy for each other government.

so its not a "I like the human player" vs "I don't like the human player".


Depending on how many "governments" exist in a game you could even have this then:
Player 1 does X to Player 2
-> inform ALL players
-> adjust standings according to sympathy of Player X to Player 1 / to Player 2

That way a Player 3 which is a close friend of Player 2 looses a bit sympathy for Player 1 too when this one attacks Player 2


This "network" of sympathy can create a more vivid/lifely environment.


Similar can be said about prices: "oh you sell product X to planet Y for only 22 credits, we lower our prices from 36 to 33 now to accumulate that".
Similar can be said about... so much more stuff.


Of course this complicates a bit the code - but once you get uses to do it via an event system every interested object can react to your actions.


bye
Ron

Offline mainsworthy

  • Jr. Member
  • **
  • Posts: 11
Re: Strata Nova
« Reply #25 on: April 11, 2019, 01:13:15 PM »
Hi Guys, Just to let you know I'm in the forum, I will readup this thread today, thanks for the link Adam

Offline mainsworthy

  • Jr. Member
  • **
  • Posts: 11
Re: Strata Nova
« Reply #26 on: April 11, 2019, 01:56:41 PM »
I'm playing catchup here, but here are my thoughts on A.I.

First A.I. should be as simple as possible because this game suggests vast complexity, So I would have three variables for everything & three variables to oppose them ACTUALVAUE & TARGETVALUE & SPEEDVALUE, each gamecycle could be a timeloop say 1day, so all things happen in one day at SPEEDVALUE utill they reach TARGETVALUE. now all JOBS , TASKS , MOVEMENT , MILITARTY BATTLES ,have become automatic, just set the VALUES and watch the LOOP run one day at a time. I would also have OPPOSINGVALUES reduces ACTUALVALUE & SPEEDVALUE etc...


that's the system I would go with, if you want an A.I. its best to have a template in your head & simplicity is the key, I would run everything with this method, BUT you guys are so clever Im sure you can tweek it.

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1010
Re: Strata Nova
« Reply #27 on: April 12, 2019, 06:02:39 AM »
That's a really interesting mechanic and one that can be coded very simply.

I could code up an AI variable class that would be the core of all other variables...

Offline Derron

  • Hero Member
  • *****
  • Posts: 1963
Re: Strata Nova
« Reply #28 on: April 12, 2019, 06:21:06 AM »
That is a static AI which ignores events happening between their daylie call.

Of course you have to set targets for your AI but current values are dynamic and might change with attacks, lost ships... So this needs to be taken into account.

Bye
Ron

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1010
Re: Strata Nova
« Reply #29 on: April 12, 2019, 07:11:52 AM »
I've coded a base AI class with all the general stuff
I'll do a test with a ship and report