Forays Into The Unknown (Officially "Cancelled" Pending Analysis Of Rebirth!)
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Forays Into The Unknown (Officially "Cancelled" Pending Analysis Of Rebirth!)
What with Atheism seeminly working in its current state I've been attempting a SonOfGod working on business methods as a primary integration of my "All stations have an account" etc. idea.
Well, I can say it's been interesting in the least.
In order to test the functionality of basic scripts already existing, I created a loop which checks a solar power plant for the number of ships it owns buying crystals, and if it has less than 3 it spawns one and sets it to do the standard (not the player) buy for best price crystals command.
This worked fine, until all the ships stopped doing anything at the same time.
I also noted, most interestingly, than when the ship dies (I killed the 3 stopped ones using a script) my loop didn't get enough time to create a new one... because it automatically did! It ordered a Mercury and a Mercury Hauler XL from Argon Prime's shipyard, and a Dolphin in Kingdom End to replace the 3 freighters! Part of me is amazed and happy, whereas the other part of me is confused and annoyed; I'm going to have to change or stop this behaviour if I want to control what it buys, where, and when.
I'd also like any insight into what 3 of the ships would just stop instantly, still running return to homebase according to Additional Information, and still all destinationed to home. But at 0m/s...
EDIT:
The Story So Far
What's done, or planned, is listed here.
All standard factories belong to a company.
All these companies are randomly created at the beginning of the game.
All the factories are at the start of the game assigned to one of these companies.
The companies expand to fill holes in the economy, grow when there's surplus to be used.
The companies hire ships for their stations, both for trade and defence.
All of this, and all trade, comes straight out of the companies account.
If the account goes negative the company is forced to start selling off its assets.
The company might be taken over by another rich company.
The ships and stations might be upgraded over time, either with new equipment or better ships, or in the case of stations an upgrade from M to L for example.
All freetraders and docktraders have an account too. They are now customised to only find trades they know they can afford.
They too spend their money on upgrades and better ships.
All of these upgrades and weapons, for example, have to be bought with real money from an equipment dock.
A central business news system is provided (for a fee...) for the entrepeneurs who wish to be up to date with the news.
An attempt at not using AP commands, to make it compatible with TC. (Will require a few specific changes such as not-not messing with the war sectors)
Well, I can say it's been interesting in the least.
In order to test the functionality of basic scripts already existing, I created a loop which checks a solar power plant for the number of ships it owns buying crystals, and if it has less than 3 it spawns one and sets it to do the standard (not the player) buy for best price crystals command.
This worked fine, until all the ships stopped doing anything at the same time.
I also noted, most interestingly, than when the ship dies (I killed the 3 stopped ones using a script) my loop didn't get enough time to create a new one... because it automatically did! It ordered a Mercury and a Mercury Hauler XL from Argon Prime's shipyard, and a Dolphin in Kingdom End to replace the 3 freighters! Part of me is amazed and happy, whereas the other part of me is confused and annoyed; I'm going to have to change or stop this behaviour if I want to control what it buys, where, and when.
I'd also like any insight into what 3 of the ships would just stop instantly, still running return to homebase according to Additional Information, and still all destinationed to home. But at 0m/s...
EDIT:
The Story So Far
What's done, or planned, is listed here.
All standard factories belong to a company.
All these companies are randomly created at the beginning of the game.
All the factories are at the start of the game assigned to one of these companies.
The companies expand to fill holes in the economy, grow when there's surplus to be used.
The companies hire ships for their stations, both for trade and defence.
All of this, and all trade, comes straight out of the companies account.
If the account goes negative the company is forced to start selling off its assets.
The company might be taken over by another rich company.
The ships and stations might be upgraded over time, either with new equipment or better ships, or in the case of stations an upgrade from M to L for example.
All freetraders and docktraders have an account too. They are now customised to only find trades they know they can afford.
They too spend their money on upgrades and better ships.
All of these upgrades and weapons, for example, have to be bought with real money from an equipment dock.
A central business news system is provided (for a fee...) for the entrepeneurs who wish to be up to date with the news.
An attempt at not using AP commands, to make it compatible with TC. (Will require a few specific changes such as not-not messing with the war sectors)
Last edited by EmperorJon on Fri, 9. Aug 13, 22:16, edited 9 times in total.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Ok, I have a set out plan now for how it all works.
So it would see a company with say 10 food fabs, it would analyse each one, pool info, and make changes at possibly 3 levels:
Ship
Station
Company
Eg. Interrupt/Wait for trade job to finish then buy more engine tunings/new software.
Eg. Not enough energy, but local area has plenty, buy another import ship.
Eg. All our stations are running low on bio for the food, build a bio fab.
Then move on to the next company once all that's done.
The result would be dynamic growing companies with their own fleets.
The bit I'm least confident with is getting ships to buy/sell for best price like they would for a human player (minus the actual transactions), interrupting scripts to say "Stop, go to the equipment dock, buy more shields, carry on" and stopping the AI getting a bit too excited in various situations, re. self-replacing ships and similar, that I'd rather have control over.
Code: Select all
Event Plugin
|
V
Loops Through Companies
|
V
Checks All Factories For The Company
|
V
Checks Ships, Resources, Etc. For Factory
|
V
Pools Data And Makes Decisions On A Factory And Company Level
|
V
Loop To Next Company
Ship
Station
Company
Eg. Interrupt/Wait for trade job to finish then buy more engine tunings/new software.
Eg. Not enough energy, but local area has plenty, buy another import ship.
Eg. All our stations are running low on bio for the food, build a bio fab.
Then move on to the next company once all that's done.
The result would be dynamic growing companies with their own fleets.
The bit I'm least confident with is getting ships to buy/sell for best price like they would for a human player (minus the actual transactions), interrupting scripts to say "Stop, go to the equipment dock, buy more shields, carry on" and stopping the AI getting a bit too excited in various situations, re. self-replacing ships and similar, that I'd rather have control over.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 3258
- Joined: Fri, 8. Dec 06, 13:45
I like the testing for this but how dynamic can this economy be I mean we still need the player to make money. So we need a world where resources are constantly changing, one day worth of gameplay we may be low on e-cells whereas the next ion disruptors. I like the idea as we may see the more expensive products become more demanding which is really how it should be.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
@Litcube Yeah, is there any way to stop it? 
In other news (:P), I got bored of doing things I couldn't do so I made the company name randomiser. I'm getting Goner companies called "Green Peace" and "Red Light". Although putting a racial modifier phrase in for pirates "Totally Legitimate" was so worth it. "Clan's Totally Legitimate Foodstuffs" was one of the companies...
EDIT:
There should be an even number of each type and race there, but I'm not sure. It was developing too many that sounded similar, but then I had a stroke of genius to put sector names in some of them.

In other news (:P), I got bored of doing things I couldn't do so I made the company name randomiser. I'm getting Goner companies called "Green Peace" and "Red Light". Although putting a racial modifier phrase in for pirates "Totally Legitimate" was so worth it. "Clan's Totally Legitimate Foodstuffs" was one of the companies...

EDIT:
Code: Select all
Black Tempest
Weaver's Tempest Shadow Power
Ocracoke's Storm Weaver
Senator's Badlands Weaver
Ocracoke's Storm Weaver Bio
Crimson Yaki's
Crimson Weaver Weapons
Earth Terra Technologies
Gold United Power
Blue Democratic Power
Green Terra
Red Sol Shielding
Kuiper Belt United
Crimson United Shielding
Red Commander's Shielding
Crimson Force Mining
Black Blockade Bio
null Commander's Consumables
Green Front Mineral
null Force
Yellow Front
Crimson Elysium Shielding
Crimson Hope
Yellow Peace
Blue Truth's Mineral
Harmony of Perpetuity Elysium Energy
Elysium of Light Light
Harmony of Perpetuity Light Shielding
Lost Order Acquisitions Technologies
Mi Ton's Refuge Acquisitions
Bala Gi's Joy Totally Legitimate
Silver Acquisitions
Split Fire Acquisitions Foods
Bala Gi's Joy Flag Power
Nopileos' Memorial Clan's Foods
Profit Center Alpha Profit Energy
Scale Plate Green Company
Yellow Company
Blue Investment
Silver Profit Farming
Ceo's Sprite Profit Consumables
Red Company
Pontifex' Seclusion Xaar's Weapons
Green Dimensional Energy
Blue Dimensional Weapons
Black Dimensional
Gold Holy
Priest Rings Trinity Energy
Yellow Trinity
Family Pride Family Foods
Family Njy Clan
Yellow Clan Power
Red Clan Power
Black Clan
Black Clan
White Patriarch's Bio
Green Sea
Green Queen's Technical
Red Sea
Red Water Bio
Yellow Sea Defence
Yellow Royal
Reservoir of Tranquillity Sea Energy
Legend's Home Federation's
Yellow Alliance
Guiding Star Federation's Mineral
Gold Federation's Bio
Yellow Federal Technologies
Midnight Star Alliance Mining
Red Venture
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 4254
- Joined: Fri, 20. Oct 06, 19:02
EmperorJon wrote:@Litcube Yeah, is there any way to stop it?
Yeah, you can connect every ship to a SECTOR_CHANGE signal script and destroy it *IF* it has a few conditions:
Job ID 0
Has a local variable you assinged, etc...
Remember to have a run script launch from the signal script, or you won't be able to debug. Signal scripts are cached.
So:
Signal sector change -> EJ.Sig.SectorChange would have one line, which is to run: EJ.Sig.SectorChange.Run.
The run script should have all your code.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 2993
- Joined: Sun, 25. Dec 05, 10:42
Or don't use home base, personally i used a local variable to signify home base instead - gave up fighting with the god engine on this one... roflEmperorJon wrote:What, so the only way to stop it is to manually kill off all spawners?
Code: Select all
* [THIS]->set homebase to $HomeBase
* [THIS]->add secondary signal: signal={SIGNAL_KILLED}, script='xtl.lib.signal.clearhomebase', prio=0, name='xtl.lib.clearhomebase.die'
* [THIS]->add secondary signal: signal={SIGNAL_CAPTURED}, script='xtl.lib.signal.clearhomebase', prio=0, name='xtl.lib.clearhomebase.bail'
[THIS]->set local variable: name='xtl.homebase' value=$HomeBase
return null

Last edited by Jack08 on Sat, 5. May 12, 15:39, edited 1 time in total.
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Heh, I was using home base for the entire purpose of there being the nice vanilla owned ships interface... real shame. I'll see what I can do though...
Also, now I'm getting names like
at least for Argon companies... well, the top one's Boron. But some of the other race ones sound really dumb.
Are some of my favourite... less official sounding... ones.
Also, now I'm getting names like
Code: Select all
Combined Water
Ore Belt Venture
Subsidised Federal Farming
Albion Gamma Federal Shielding
Established Federal Farming
Red Venture Bio
Black Corporate Technologies
Free Trade Alliance Shielding
Code: Select all
The Moon Earth's
Elysium of Light Light Energy
Official Fire Power
Family Pride Clan
Family Pride Clan
Family Pride Clan
(all in a row on 1 run through)
LooManckStrat's Legacy Skull Foods
Menelaus' Oasis Water
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 4254
- Joined: Fri, 20. Oct 06, 19:02
"Totally Legitimate Foodstuffs" hahah. That's awesome.
If you still want to see a homebase, you can use my method. I am currently using it to stop all xenon spawn with my Revelation mod. And to stop all god create blockade ships. I have exceptions for laser towers, nav beacons, jump beacons, etc.
If you don't need to "see" the homebase, and just need the logic side of it, use Jack's method.
If you still want to see a homebase, you can use my method. I am currently using it to stop all xenon spawn with my Revelation mod. And to stop all god create blockade ships. I have exceptions for laser towers, nav beacons, jump beacons, etc.
If you don't need to "see" the homebase, and just need the logic side of it, use Jack's method.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Well I also need to be able to quickly get a list of all ships which are homebased to a station...
It's just, deleting all the ships which spawn only for them to spawn again gets messy... especially considering it'll be for EVERY station in the universe.
EDIT: Also trying to use the "arrays in arrays"... I'm aware of the 2D array concept, well... ND arrays. I understand them and have used them in other things, therefore I have a suspicion that I'm either misunderstanding the MSCI forum's explanation or there's a mistake (Would anyone else that sub array 3 element 4 should be yellow, not element 5?). Anyway... I tried putting a value into array[0][0] and taking it out of array[0][0] and I get null of course...
It's just, deleting all the ships which spawn only for them to spawn again gets messy... especially considering it'll be for EVERY station in the universe.
EDIT: Also trying to use the "arrays in arrays"... I'm aware of the 2D array concept, well... ND arrays. I understand them and have used them in other things, therefore I have a suspicion that I'm either misunderstanding the MSCI forum's explanation or there's a mistake (Would anyone else that sub array 3 element 4 should be yellow, not element 5?). Anyway... I tried putting a value into array[0][0] and taking it out of array[0][0] and I get null of course...

______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 2993
- Joined: Sun, 25. Dec 05, 10:42
expanding on my solution, you could use somthing like this:
xtl.lib.sethomebase
Arguments:
Refobj([THIS]): of the ship who is getting the homebase assignment
$HomeBase: The target ship or station to attach as homebase
xtl.lib.sig.clearhomebase
This will add the ship to a local array "OwnedObjects", and will also remove it from the local array "OwnedObjects" when it dies or bails.
xtl.lib.sethomebase
Arguments:
Refobj([THIS]): of the ship who is getting the homebase assignment
$HomeBase: The target ship or station to attach as homebase
Code: Select all
[THIS]->add secondary signal: signal={SIGNAL_KILLED}, script='xtl.lib.sig.clearhomebase', prio=0, name='xtl.lib.clearhomebase.die'
[THIS]->add secondary signal: signal={SIGNAL_CAPTURED}, script='xtl.lib.sig.clearhomebase', prio=0, name='xtl.lib.clearhomebase.bail'
[THIS]->set local variable: name='xtl.homebase' value=$HomeBase
$OwnedObjects = $HomeBase->get local variable: name='xtl.owned.objects'
if not $OwnedObjects
$OwnedObjects = array alloc: size = 0
$HomeBase->set local variable: name='xtl.owned.objects' value=$OwnedObjects
end
append [THIS] to array $OwnedObjects
Code: Select all
$HomeBase = [THIS]->get local variable: name='xtl.homebase'
$OwnedObjects = $HomeBase->get local variable: name='xtl.owned.objects'
$Idx = get index of [THIS] in array $OwnedObjects offset=-1 + 1
if $Idx != -1
remove element from array $OwnedObjects at index $Idx
end
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
-
- Posts: 3258
- Joined: Fri, 8. Dec 06, 13:45
[quote="EmperorJonThere should be an even number of each type and race there, but I'm not sure. It was developing too many that sounded similar, but then I had a stroke of genius to put sector names in some of them.[/quote]
Just to pull you power rangers away from the hard work of modding. Why not just get the community to come up with names like what was done with the early stock exchange mod. Be pretty cool if they all messaged you a list of like 10 for several races.
Just to pull you power rangers away from the hard work of modding. Why not just get the community to come up with names like what was done with the early stock exchange mod. Be pretty cool if they all messaged you a list of like 10 for several races.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
I'll keep all this in mind...
@Litcube
I understand multidimensional arrays, but Mark's description seems to A. only describe how to put things in and out, not actually define them, and B. be slightly wrong, what I said when I linked to it.
@Litcube
I understand multidimensional arrays, but Mark's description seems to A. only describe how to put things in and out, not actually define them, and B. be slightly wrong, what I said when I linked to it.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 2993
- Joined: Sun, 25. Dec 05, 10:42
Create a 2D Array:EmperorJon wrote:I'll keep all this in mind...
@Litcube
I understand multidimensional arrays, but Mark's description seems to A. only describe how to put things in and out, not actually define them, and B. be slightly wrong, what I said when I linked to it.
Code: Select all
$Array = array alloc: size = 1
$Array2 = array alloc: size = 0
$Array[0] = $Array2
Code: Select all
$Array2 = $Array[0]
$Item = 'I Am A String'
append $Item to array $Array2
Code: Select all
$Item = $Array[0][0]
OR
$Array2 = $Array[0]
$Item = $Array2[0]
Remove an item:
Code: Select all
$Array2 = $Array[0]
$Item = $Array2[0]
$Idx = get index of $Item in array $Array2 offset=-1 + 1
if $Idx != -1
remove element from array $Array2 at index $Idx
end
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
So I forced the companies to always have the type on the end (mineral, etc.) and managed to debug it very quickly after spending hours staring at code... turns out I'd replaced a line with something else but forgotten to actually remove the original... so it was saying X = Y, X = Z, when I wanted it to be Y... 

______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Some script butchery went on (great fun!
) and now the script(s)...
Initialises some arrays and stuff.
Finds a handful of randomised locations for each race.
Picks a station.
Makes a new company.
Assigns the station to belong to them.
Finds nearby stations which make the same product, OR are the same area, OR are similar areas, based on a weighted random ratio currently of about 1:3:1.
So in every 5 companies you generally get 3 "Tech" companies, one "Tech, Mining and Weapon" company, and one "Microchips" company, for example.
It's great fun!

Initialises some arrays and stuff.
Finds a handful of randomised locations for each race.
Picks a station.
Makes a new company.
Assigns the station to belong to them.
Finds nearby stations which make the same product, OR are the same area, OR are similar areas, based on a weighted random ratio currently of about 1:3:1.
So in every 5 companies you generally get 3 "Tech" companies, one "Tech, Mining and Weapon" company, and one "Microchips" company, for example.
It's great fun!

______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______