Star Citizen: Delivery Missions

I’ve been obsessing with Star Citizen delivery missions. Video 1 and Video 2.

I thought maybe I could take two of them, and optimize my route. I was assuming that time spent going between planets was the longest. It might be, but just barely.

Upon examining video 2 in more detail (I didn’t have a recording of my own), I logged timestamps and made a pivot chart:

QT = Quantum Travel, TL = Takeoff/landing, WALK = using W key to Activate Limbs that Kick.

So even if a bunch of packages are at the same location, the effort of walking them to the ship may not be that much worse than doing a extra flight. But theoretically, what would the sort be?

  • Well, DESTINATION port MUST come after SOURCE port.
  • Put the same port together if you can (sometimes you have to visit it twice)
  • Group the planets together? One less QT hop

So I tried it – Here’s my work in progress –

From’s and To’ with package numbers, from 2 missions.

However, the game crashed on me, and I lost all the packages. So there’s a good reason to get done with a simple mission first without thinking too hard about it. Oh, and Planetary maps at this link: https://www.reddit.com/r/starcitizen/comments/i3xhxr/3100ptu_sunrisesunset_triangulation_tool_and/

Ok, I might be off to try Mining thanks to Intergalactic Lan Party’s awesome playlist!

Star Citizen, take my money!

I got a hankering to play Star Citizen and decided to jump in with $55. I very quickly upped my pledge to .. i don’t even know where I’m at so far. Probably $80. And its awesome.

Quick Myth: If you destroy your ship you are out real $. Reality: currently everybody has insurance until they release, and when they release, there will be in-game insurance per ship that you can buy. Just like Elite: don’t fly without insurance!

Quick Myth: Need a kick ass computer. Reality: My i7/gtx1070 from 3-4 years ago with 16G ram total, runs it about okay.

Quick Myth: Its full of bugs because its alpha. Reality: yes; but if you call an elevator and you see a black emptiness, DONT STEP IN IT.

What I’ve done so far:

  • Participate in a server-wide event which netted me almost 1/2 of a entry-level ship’s worth of in game money, while doing almost nothing other than fly around not knowing what to do. (The xenothreat thing over labor day weekend)
  • Try to land my ship at a settlement on the dark side of a planet. The light I saw was the door light not a city light, i rammed into the settlement instead. Boom + Tresspassing = Crimestat.
  • Served time in the penitentiary (14 minutes) for my crimestat. I did not try to escape.
  • Almost run out of fuel flying a ship rental to join some action. Luckily I checked before I got past the halfway mark and could jump back to get some gas.
  • Decide to trade in my first pledge ship for a better one (which has cargo space! And a bunk bed!)
  • Trying to take out my first bounty, got there too late and somebody else got him.
  • Trying to take out my first bounty, got jumped by a second bad guy. Ran away.
  • Try to descend upon a bounty target at full speed in an asteroid field. I could not dodge the asteroid that showed up in front of me. Boom.
  • Actually destroy a bounty myself with my gimpy hands.
  • Do my first cargo mission, turns out I picked the one where I visit an abandoned powered off station, float around debris in zero G, somebody destroys my ship while I’m in the station and I have to stash the box and suicide and come back and get it after I respawn.
  • EVA across a space station to get to the correct strut where I could turn in a delivery box to the right place.
  • Do a “pick up recycle waste from 3 stations” mission. Turns out I need to land closer, because I have to hoof it on foot to get into the buildings to pick up the salvage WITH MY BARE HANDS. 2nd and 3rd station, i got a bit closer in my landing.
  • Decide to upgrade my ship, find the websites which guide me to where the components can be bought, and try to go to Area 18 the big industrial complex plant … and could not find the space port. Had to go back up to look for it from afar, it was hidden behind some skyscrapers.
  • Forget to look at trade routes and missed some great trading opportunities.

This game is amazing. Its everything I dreamed Elite could be. And the ship power management and all that stuff.. its like, “super realistic” + “computer control to make it seem more like a game”, but if you want you can switch off the “Coupled” mode and go raw. Just like Elite.

3 play sessions in, cannot wait for the next one. I need to investigate using a joystick and learn more about gimballed weapons and power distribution.

SpiritFarer – Spreadsheet

Loving the game SpritFarer. Resource gathering, with a cute little story line, until you read the back story, and then who cut the onions.

Playing it my way — i got too many people on the boat, restarted, and now I’m separating out “gathering” from “action”. Using a spreadsheet to guide me on what I need to get more of.

View only link to spreadsheet is here – as I satisfy things i cut and move them down. I thought about writing a helper app, but i don’t have that kind of free time.

Speaking of free time.. this is the first evening in i-don’t-know-when that i have had an hour or two to myself, AND i’m not exhausted and just need to veg out. Hence the post.

If i had all kinds of time, i could post about these technical things:

  • Powershell script to automate connecting to cisco vpn
  • Powershell script that runs a query against a database then checks if matching images exist and flags the ones that don’t.
  • Surprise that you can’t connect to a Azure File System from Windows Server 2008R2 because SMB 2.0 vs 3.0. Even more reason to upgrade those servers. The plan is to move those to the cloud.
  • The world of Epicor P21.
  • Fun times working with a company called Heraflux and its chief geek David Klee. That guy knows his stuff, he’s the next level of whatever perfmon skills I used to have.
  • Designing a task-tracking system – we’re separating out “popcorn” from “projects”. Sounds familiar.
  • What happens when a SQL Server doesn’t have enough RAM: the 88G vs 8G typo problem. 🙂
  • Various small problem – small tool/feature wins. But that would reveal too much of the business.

I could also post about these other things:

  • Color Changing Disney Pixar Cars .. the magic temperature is between 60 and 90 degrees, I think.
  • Challenging a grandchild to eat – if you finish one of these three things, you can choose another: 1 pretzel, 3 grapes, 1 pepperoni.
  • Outdoor pools might be simpler than I thought.
  • Awesome channel – Perkins builder brothers, YouTube.
  • I have seen Model Y in person and I still want it.

Be well!

No Mans Sky–Spreadsheet of Desire

Still playing it.   I’m actually finding the number of story missions .. relentless.  Like, stop bugging me, lemme go free play for a bit dangit.   OTOH, its definitely .. hey I have an hour to play .. lets go knock something out .. 5 things later .. oh, I never got around to the one I was going to do.

I do not have a head for remembering detail (anymore).   So, I came up with this – I tried it in Google Sheets first, but they don’t have good visualization of formulas, so Excel wins this round:

image

The plan is that the Calcs stuff (Column I onwards) is a bunch of rows where I can say “if I want 1 metal plate, you gotta have 50 ferrite dust”.   Unfortunately, in Excel, i can’t sort this .. not the way it is.  This would be better done as a quick app.   Anyhoo, I can type in my inventory on things, and then it gives me how much I need of what, and using the visual tree above I can figure out the build order.

If I did it as an app, I could probably also factor in stuff like “how much carbon to run the refiner” and “how much carbon to run the mining laser”, although the latter would need some “how good is your equipment” estimates.   Could probably also try to calculate “how much time would this take” and optimization of which fuels to use “by cost” vs “by time to acquire”.

If I did it as an app, I would load it with a text file which has a one-line language for describing things and what they are dependent on, for example “Warp Cell|Craft|Antimatter Housing:1,Antimatter:1”.  That way the 2nd thing, if it were “Refine”, could then bring in additional costs associated with that.

No Mans Sky

Started playing with the 1.5 update.   Fun so far..   went back because I was feeling lost, and mapped out the starting part of the game. Here it is, probably 85% consistent, till the point where you can leave the surface.   I was trying to do solid line = component, and dashed = influence, but that got a bit tangled.  (Thanks to draw.io for the auto-layout).

NMS Intro Build

Its a pretty large game.  I still need to re-build a base, and then possibly get to hyperdrive.  Haven’t done much archeology yet, nor have I done much stuff in space. 

Don’t know that I’ll play it too much longer, we’ll see.

dotnetmud: spacemud: optimizing network traffic

I spent some time getting the network load produced by the game down.     The rest of this post, I test out the changes to see how much better everything became.  

Methodology

Two ships connected; I’m going to leave their starting locations as random.  I’m going to have them turn in circles and constantly fire.  This will yield some explosions against the planet, and others against each other, but most of the missiles will be flying out into space.

Running against a deployed web server in the cloud

Using WIFI and my home internet connection.

Collecting data via portal.azure.com’s App Service Monitoring graph set to minutes.  (This didn’t work, I had to go with my local wifi connection)

image

https://github.com/sunnywiz/dotnetmud2015/tree/chatty1

This is where we started at.    Sample packet and network load:

imageimage

 

https://github.com/sunnywiz/dotnetmud2015/tree/chatty2

The main change was to give custom JsonProperty names, as well as to reduce the number of decimal places being transmitted.

imageimage

I use Decimal  instead of Double because in double’s, there’s a chance that the underlying representation isn’t quite so digit friendly; decimals are exact for every digit.  However, decimals are harder on the processor for doing math – supposedly.   I haven’t tested that.

The result:  Not too much better.   5.5 MB came down to 3.1MB on the receive side.

 

imageimage  

https://github.com/sunnywiz/dotnetmud2015/tree/chatty4

chatty3, which I’m skipping, changed the method signatures to two-character method names.  Not too much saved there.

chatty4 added “blanking out” data that doesn’t change much.  It does this by keeping track of what it believes the client thinks the state is, and doing a diff:

image image

imageimage

In order to pull this off, I had to go to a dictionary of objects to render, rather than an array.   I also kept a “full” frame every 10 frames, similar to MPEG encoding G vs I frames.

I thought I’d get fancy and send nulls if various values (DX, DY) had not changed (for example, they do not change for bullets) – however, JSON sends a “:null” which can be longer than just sending the value.  The more advanced version of “don’t include the property if it hasn’t changed” is possible, but it got too complicated, so I ignored that for now.   So this version only does the image and name attributes, but that’s enough to get a nice reduction in size:

 

imageimage

The savings:  another 30%.  Its still a lot of data.  Not quite the gains I was hoping for.

At this point, an average entity on the screen is taking 100 bytes or so, instead of the 500 they were before. 

Network Optimization: Where to go from here?

I’m going to call this good enough for now.  The directions to go from here for network optimization:

  • Instead of using the system JSON serialization, write my own serializer.   This could do things like “If It hasn’t changed, don’t send it”.
    • so instead of: {“DR”:0.0,”DX”:17.109,”DY”:299.512,”ID”:0,”IM”:null,”N”:null,”R”:446.7,”RA”:3.0,”X”:37.0,”Y”:1474.8}
    • “dx17.109dy299.512id341r446.7x37y1474.8”   that’s about half the size.   But needs a lot more code to massage it.
    • Could use a binary packing method as well.   Quick search doesn’t find anything that is happy in both C# and Javascript.
  • Put some logic in as to whether something needs to be sent every time or not.  For example,
    • bullets pretty much go in a straight line once fired.  They don’t need to be sent every time.   In fact, if the current X,Y is approximately where the previous update X,Y + DX,DY would put it, then there’s no need to send those values.
    • Planets currently don’t move. (That will change).      This is a broader case of “nothing has changed in this object from what the client expects, so just acknowledge the object still exists, nothing more”.

What’s next?

I think that authorization / identity of clients (and dealing with disconnection better) is in order.  

Then I can do the “single person logged in, multiple clients” code

And then we can launch a spaceship from the text game.

And then we can design an actual playable game.   (oooo!)

dotnetmud: spacegame: Timing Loops 1: Client / Server timing loop

imageI feel stalled in my project.  It might be that I need to write about the important stuff done so far before I continue to redo/optimize the game; setting the stage to understand the need for some of those optimizations.

Reference code for this post (tag): https://github.com/sunnywiz/dotnetmud2015/tree/blog20160302.

The playable game (which might be updated, not frozen to this post) is: http://dotnetmud.azurewebsites.net/Home/SpaceClient

Game state at this time:   Multiplayer, can shoot missiles, missiles hit things, score is kept.

There are 3 interacting timing loops:

Client / Server Update Loop

I made the client “in charge” of this.  Starting in Javascript, the client requests an update from the server:

image

image

Along with the request for game data, the client is also sending the state of controls for the user.  I went with “how many ms has the thrust key been pressed” as my input – there’s a separate set of handlers which watch key-up and key-down events and long how long keys have been pressed for.

This then travels up through Signal/R, and shows up at the server 20-50ms (an eternity) later:

image

The SIgnal/R side of the hub takes the connection, looks up which server-game-object that connection is tied to, and asks that game object (which happens to be a Ship.cs) to craft what it thinks the world looks like.

The Ship has several things it has to do. 

First is to look at the keypresses and turn those into thrust amounts.  I went with a % of thrust:

image

There is similar code for “can I fire another missile yet” (not pictured).

Then, it makes a copy of all the stuff that the client needs to draw the world:

image

It records itself, all the other 2D objects in space, some scores, and what the current “Server Time” is (and rate of change of server time, which is a YAGNIY for when the server gets overloaded and has to go into bullet time).

It packages all that into a return (of type object, which gets JSON-serialized), and SpaceHub happily sends it back to the client:

image

Then, 25-50ms later (another eternity), the client receives the game-update:

image

  • Green – the client updates what it knows about what’s going on on the server.   I tried to keep this in its own “object space”, to indicate that the server is the authority here.
  • Blue – the client updates various things that are of interest to the client
  • Purple – there’s some bulk copying going on that isn’t very sexy and is very network-inefficient.
  • Red – and the client immediately requests another packet.

Places to Improve: Network Traffic.

The server sends ALL the data, ALL the time.   A network packet looks like this (raw, pretty printed):

image image

There is a LOT of stuff in there that is needed once (like image URL’s), and then does not change.   Also, many property names, while nice for humans, is not optimal for network traffic (words like “ClientREquestsPollFromServer”) for example.

“No Big Deal?”  — Doing a test, holding down the fire button and shooting the planet, for a few minutes, in Azure Data:

image

Doing some math:

image

If I have a successful game, and there’s about 1 combat going all the time, we’re looking at $18 per month.

The solution for this is to only send diffs across the network.  That’s on my list for pretty soon.  But it will require some hand-crafting detail.   And some before/after testing.  This will be its own blog post.

Places to Improve: Network Lag

This model is similar to how Kermit used to work – there is a LOT of dead time between updates.   

One way to improve this might be to have the client keep track of the lag between server updates, and then, in its request to the server, ask “please give me additional packets at the following times, until you hear from me again”.    So, the server could send 2 game-updates for every 1 client-inputs-update.     Its on my list, sometime after sending diffs.   Have to be careful and mark the intermediate frames as intermediate, so that only the major frames cause the cycle to continue.

Another direction we could go is completely decouple the client-input from the server-response.   I’m not going to do that, because I like how the client has to constantly remind the server of its existence – if the client goes haywire, I don’t need to write additional server code to detect that and shut down the server sending stuff to the client.   I’m also lazy. Smile 

In Conclusion

So, there’s the ugliest timing loop in the game so far.   The other two are relatively easy, may not get written about soon. 

dotNetMud: Its Alive! (on azure)

The link:  http://dotnetmud.azurewebsites.net/

From there you can either get into the old-fashioned text-and-chat mud:

image

(Valid commands are who, look, shout, say, and east and west)

 

Or you can get into the space-mud side of things:

image

(Valid controls are W for thrust, A and D for rotate)

Neither of these are really interesting until you have more than one client (browser, tab) logged in.  In the case of the latter, perhaps from different computers, with different network speeds.

Corresponding source code:  approximately here (as of these screenshots):  https://github.com/sunnywiz/dotnetmud2015/tree/blog20160220

Where to go from here?

I could try to make the space game more fun – adding missiles and lasers.   More realistic game.   You can’t have a space game without combat.. can you?

I could try to make the space game more single-player interesting – adding gravity, multiple planets. (your mission: try to get into orbit around a planet).  This lends itself to “more realistic server side computational load”.

I could try to make the space game more efficient – optimizing network traffic (right now, VERY large messages).

I could try to make both clients work better – by having “session” be the unifying factor, and the text game launches the space game, both in the context of the same player object, somehow.    This would probably involve hooking up to a database for persistence of user information as well.    This is complicated…  this is probably where I should go if I’m focusing on the “sample game” side of things.

I could try to make space more interesting – by voronoi’ing it, so that it can have 10000 or more objects, but its very easy to find the objects that are within, say, 100000 units of you.   So that I can do hyperdrive between star systems that you can drop out of and be in the middle of nowhere.  Also complicated.. probably comes after multiple planets.

I could try to stress test it – get a bunch of computers attached to it, see how it performs on the azure side.  I have it running on a Free web-node at the moment, and its surprisingly happy – 1.9% CPU.

StoneHearth (Alpha 14)

image

I have been playing a very cute game:  StoneHearth.   I paid $24 for it on Steam, its in Very Early stages, and I don’t regret the purchase.

However, be aware that, as it stands right now, its not very challenging once you learn how to stay alive.

I put together one farmer (prevent starvation) and one footman (prevent death by first attacker), and then mostly left the game alone after that, and … everybody lived.  Overnight.  I’m sure they would have died of cold eventually as the seasons changed, if that were implemented.   But as it is, the game settles into a sustainable state, doesn’t devolve into chaos. 

Comparatively, I left City : Skylines running overnight and it did descend into chaos.  How?  by the one simple rule of “no-auto-bulldoze-condemned.”  It’s the one thing that left unmonitored, will destabilize everything.

Also, if you do silly things like dig tunnels to then fill with water, some algorithms crash (you can see some of that above) and stuff and things generally go haywire and people stop picking up stuff etc.  Performance and Bugs.

The concept, though, is solid.   I love watching the little hearthlings do their little lives.. I guess this is what the Sims was like.

The build tree took a little getting used to.  I couldn’t find a nice graphic on the web, so I tried making one in LucidCharts:

However, LucidCharts (Pro) does not appear to have an auto-re-flow option, and if I started getting the level of detail I wanted .. it would not have worked.

What other options do I have?   A little google searching found:  http://bl.ocks.org/d3noob/5141528, So I downloaded that code, and plugged in my own CSV file.   But ran into cross-origin problems.

So then I went with http://jsfiddle.net/skysigal/k3kdeu9L/ which I forked into my own .. http://jsfiddle.net/roLmyovw/2  :

image

Which is just not quite pretty.  Not as pretty as this kitten, anyway:

image

Which is my Princess Fifi Toupee.  She kept trying to step on the keyboard as I wrote this post.  https://www.instagram.com/p/BB27Zh1Fvko/?taken-by=mollymcmahan

So, I think I’m giving up on this game for now.    I played it for 8-9 hours.    Maybe not the best return, but I suspect I’ll play it again in the future.

dotnetmud: Hitting a wall on clients, hubs, and games

Till now, I’ve had this pretty simple layout:

The browser fires up a signal/R client, which connects to a signal/R server, which talks to a driver, which talks to a game-specific engine.

One signal/R client maps to a user in the game somewhere.

This Situation is not Covered:

You are standing in a spaceport

You see:

a ship

>> board ship

You are inside the ship.  you can ‘launch’ to launch the ship.

>> launch

 

At this point, something happens that tells the client “hey, start this other client up” – possibly in a new tab.    Maybe it leaves the current tab in place. The new client connects up to its own hub, with its own mudlib, and does its own kinds of commands. The user can then fly the ship around in space.  The space stuff doesn’t know that the ship is also a “mudlib” object.

This could also be used with Shop Transactions, or a Game of Uno, or whatever – custom client for custom situation, in the same user’s session.

What this Means

a) I need a different sort of Auth mechanism to bind the user to an Identity.  I think I’ll probably go ahead and use the stock website’s authentication methods to get myself an actual UserIdentity;  I don’t know if that would flow down into any signal/R client or not.

b) Every user can have MULTIPLE clients going on at any point in time.   

This is making my head hurt.  I’ll let it percolate.   For now, no cross-jumping between clients.

HOWEVER, I do want to move the <T> that I currently have on the Driver so that the Driver stands alone, and the Signal/R Hub is the one that knows about the mudlib GameSpecific.