Skip to content

Commit

Permalink
update reporting queries for 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ctri-The-Third committed Nov 4, 2023
1 parent 2d808d2 commit 4d8a46d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
50 changes: 40 additions & 10 deletions blog/Version 2.1 (week 17+).md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,28 @@ I've noticed that everything breaking has triggered the "setback effect", which
- ✅ Looking at earning credits, fuel _seems_ like it'll be a large impact, with refuels needing to happen repeatedly.
- ✅ I think we can buy hydrocarbon and sell it to the refinery, which will give us a place to buy fuel that's reliably cheap
- ~~no I'm getting off target. We can just consider jettisonning the things that aren't worth the CPS to sell.~~
- then we'll be able to get a siphoner drone and use that to increase our rate of getting hydrocarbons
- On later reflection I've decided that the value add from a siphoner is less than the value add of a hauler being able to meet the waypoint trade requirements.
- A player on the discord mentioned they were seeing substantial reward from balancing all the need from the markets in the system, so I'm exploring that option as my foudnational strategy.
- then we'll be able to get a siphoner drone and use that to increase our rate of getting hydrocarbons
- On later reflection I've decided that the value add from a siphoner is less than the value add of a hauler being able to meet the waypoint trade requirements.
-A player on the discord mentioned they were seeing substantial reward from balancing all the need from the markets in the system, so I'm exploring that option as my foudnational strategy.
- ✅ then we'll be able to get a hauler and use the command frigate for mining

## Step One - Build the jump gate
## Step One - Scale up mining
- now we have a hauler doing trades around the system, we can use the command frigate to mine.
- buy extraction drones and transfer cargo to the command ship
- command ship should take desirable goods and sell all of them, and jettison the rest.
- conductor should have a "come collect resources" behaviour that will summon a trading ship to collect everything, for if the commander isn't present.
- We should check if asteroids are becoming unstable
- Once an asteroid is unstable, we should send new drones to different asteroids with different material deposits.

## Step Two - Dedicated fuel handling
- We require a second hauler for this stage.
- The second hauler should focus on moving hydrocarbons to the refinery planet, and then take fuel around the different waypoints keeping refuel prices as low as possible.
- If they add a "refuel from cargo" behvaiour we could in theory use unwanted cargo space to let ships take fuel from fuel drones.
- We need some mechanism by which ships are ineligible to be given tasks - we don't want the refuel hauler to start making shallow trades, or the commander to stop mining and go back to stage zero. Same for assigning behaviours if we want to do manual orchestration in the future.



## Step Three - Build the jump gate
- ✅ Our first step is to get the Dispatcher and Conductor working without crashing.
- Secondly we'll want a very rudimentary drone based solution to get credits flowing in.
- ✅ we should target the nearest asteroid, not the first one returned by the DB.
Expand Down Expand Up @@ -60,11 +76,11 @@ Solution: Update the "Sell All" behaviour to only sell cargo the marketplace wil
Presently we're asumming that the best time spend for us is extracting and selling.
However, I think at this early stage of the game with small markets and small cargo bays, we should be using the command ship for trading.

Problem: Trade opportunities definitely exist, but we're not taking them.
Problem: Trade opportunities definitely exist, but we're not taking them.
Solution: ✅ Switch drones to "Extract and go sell" behaviour
Solution: ✅ Switch haulers to free "trade_intrasolar" behaviour
Solution: Switch "Receive and fulfill" behaviour to **take** desirable materials from nearby extractors / refineries - lets conductor send haulers to extractors when they're nearly full.

Solution: ✅ Identify trade routes that are stable and profitable (behaviours)
Solution: ✅ Identify shallow trades that shouldn't be executed repeatedly (tasks)


Problem: Haulers sitting idle at waypoints waiting to receive cargo
Expand All @@ -73,11 +89,25 @@ Solution: Get inventory info into the DB & forcibly extract desirable cargo from

### We started trading but made bad trades

Problem: I woke up this morning with no money, and the command ship isn't able to execute trades anymore because of this.
Problem: I woke up this morning with no money, and the command ship isn't able to execute trades anymore because of this.

Looking at the numbers overnight it seems that the money went to buy surveyors that shouldn't have been bought - a conductor issue.
Additionally, it doesn't actually seem like we made bad trades after all, just that the surveyor purchases undercut the operating capital requirements for the trade.

Solution: When assigning trades, keep track of the assigned ship's cargo capacity & current trading costs, and ensure that there's a minimum operating capital kept in the bank.
Solution: Quick solution - have the buy/sell behaviour check if a trade is still going to be profitable _at all_ before making the trade.
Solution: Proper solution - Dispatcher overhaul, behaviours get termination events, infinite loops after setup, and the dispatcher sets the terination event if the behaviour changes.
Solution: Determine the minimum allowable profit before skipping a trade behaviour.
Solution: ✅ Quick solution - have the buy/sell behaviour check if a trade is still going to be profitable _at all_ before making the trade.


End of week stats

| stat | Experimental | Production | best historical |
| --- | ------------ | ---------- | --------------- |
| total uptime | 75.11h |
| total ships | 16 |
| contracts | 0 |
| earnings | 597,486 |
| requests | 226,515 |
| average delay| 0.33s |
| CPH | 7954.51 |
| CPR | 2.6 |
5 changes: 2 additions & 3 deletions reporting_queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ where fulfilled = true
group by 1 ;

--earnings
select agent_name, sum(total_price)
select agent_name, sum(case when type = 'PURCHASE' THEN total_price * -1 else total_price END )
from transactions t
join ships s on t.ship_Symbol = s.ship_symbol
where type = 'SELL'
group by 1;

--requests (excluding 429 responses)
Expand All @@ -57,7 +56,7 @@ with session_and_agents as (
select distinct l.session_id, s.agent_name
from logging l join ships s on l.ship_symbol = s.ship_symbol
)
select saa.agent_name, count(*), avg(duration_seconds)
select saa.agent_name, count(*), round(avg(duration_seconds),2)
from logging l join session_and_agents saa on l.session_id = saa.session_id
where status_code >= 200 and status_code < 500
and status_code != 429
Expand Down
2 changes: 1 addition & 1 deletion spacetraders_sdk

0 comments on commit 4d8a46d

Please sign in to comment.