DotNetMud: Client Server Poll Loops

The original muds didn’t need this because telnet, but with the spaceship game in mind, I need some way to sync game-data back and forth between server and client.

Without any hard work, the poll looks like this:

  • C:  “Server, hit me.  I got you some inputs: I1”
  • S: “Hit!  H1”
  • C: “Server, hit me, inputs I2”
  • S: “Hit!  H2”

So if you have a 200msec lag time, you get a hit every 400msec.  That’s assuming upload and download lag are similar.

If you go a little crazier you can work with intermediate frames

  • Setup: Real Time clock R = 0, corresponds to CT=1000 and ST=2000.   Neither server nor client can know R.   Upload lag 200ms, download lag 50ms
  • R=0, Client sends “hit me, CT=1000”
  • R=200, Server receives hit request at ST=2200.   maybe it takes 15 msec to put together the response. 
  • R=215, server sends H1 CT1=1000 ST1=2200 ST2=2215
  • R=265, client receivesH1 CT1=1000 ST1=2200 ST2=2215 at CT2=1265
  • Client now knows that round trip time is about 265 msec.   Maybe it takes 20msec to put everything where it goes
  • R=285, client sends “hit me H2 CT=1285  Intermediate frame: 133ms”
  • R=485, server receives the above request.
  • R=500, server sends H2
  • R=550, client receives H2
  • R=633, server sends H2.1 as requested
  • R=683, client receives H2.1

I haven’t coded it yet, but the client is in charge of throttling, and there’s going to be some interesting “what did I try before” “what shall I try now” logic. 

There’s also a limit.   If the client requested too many intermediate frames, the actual network transport might start bundling the frames together and/or delivering them out of order.     

Note that upload and download lag are different – so it might be completely plausible to have 2 or 3 intermediate frames before the client can actually send back its next update.

A more advanced algorithm would have the server asking the client for intermediate frames, but I don’t live in a reality where that needs to be solved.

There’s also some work in the above protocol to figure out server to client time offset.  Its not an easy question to handle.  And there are also drifting lag speeds – as I write this attached to a 3G Karma Go device.  which keeps going from 2 to 3 circles and back.

Dialing it back

I don’t need to solve it all now.  For starters – all I need is a simple loop.  When I get to space ships floating around and changing direction based on user input, then I’ll need the intermediate frame update stuff.     Just need to know it is solvable.



DotNetMud: Start?

I have had some wonderful things happen. 

The first is, I married my wife.  This happened 8 years ago (I asked her), and its been a fun trip so far.   But the best thing is, we keep growing.  In this case, I decided that I trusted her to a new level, and I asked her a question:    Would she be willing to design a schedule for me?

I struggle with scheduling.    More specifically, I struggle with “how much should I be available for others” and life balance. 

I also told her of the desire within me to work on this game.   Its been an omnipresent inside push since 1991.   And there’s so much of it, in the past, when I open up the gates, it floods over and drowns out everything, and burns me out quickly.    And.. I don’t know if she understands, but she’s accepting of me, and nurturing of me. 

So,  I gave her the guidelines of what I had to fit into my life, and she drew me up a plausible schedule.  It includes:

  • Time for Us to Go to the Gym Together. (DATE!)
  • TIme for Us to Watch TV (DATE!)
  • TIme for Us to Eat Dinner (DATE!)

AND,  it also includes:

  • WORKING! like, to get income and pay mortgage and stuff. 
  • DAILY NAPS!  (omg)  (concession: I get home later in the evening)
  • PLAYTIME! (go work on my project or my latest game or whatever)

As it is wife-suggested, I believe it has a high WAF.  (Wife Approval Factor).

So with this established, I can now relax, and let this project flow.  It may flow slow, or it may go very fast, but its accounted for.

Managing the Flow

“Honey, what are you doing?”


As I sit there, leaned back, eyes closed.   That is how much stuff is shifting through my brain.   Its going very fast.   Its like a probe algorithm trying to sort things out.    How the heck do I capture this?

Well, in the end, its what gets committed to github:

But its also going to be blog posts here.   I run into a quandry.  Do I:

  • First do something, then write about it?  (and not change it ever again)
  • Think about it, and say “I think its going to be something like this” (and then run the risk of never doing it)
  • Write something, write the equivalent of documentation here, but put a caveat on it of “this might change in the future”

The 2nd and 3rd options seem to be the way to go.   In general, everything is “here’s what is intended at this time, things may change in the future”, kinda like pre-documenatation.

I’m going to tag them here with the tag “dotnetmud”.

Overall Project Desires: Intended

I want to write:

  • A very basic server engine.  This deals with client connections, disconnects, reconnections, some level of polling things, etc.
  • A very simple mud library: 
    • users logging in (no save choose your nickname)
    • in a room
    • can see other players in the room and on the global players list
    • can move from room to room
    • emote and say
    • shout
    • tell
    • using a custom web client
    • This is a “sample documentation” game to illustrate the various parts of the client/server communication, such as events and polling.
  • Using the above two things, a very simple space game:
    • users log in to a ship floating in space
    • can fly around in space (thrust, rotate)
    • can see other players’ ships as well
    • maybe will have some missiles to make it fun
    • using HTML5 canvas web client

Then, the fun stuff can happen, where I start making a more advanced game of sort, building on the above.  While trying to keep the above nicely packaged.   This is where my space game really happens, and/or my 2D mud game.

Topics Considered So Far

These could all be individual blog posts.   Either before, or after, code.  All of these have been handled already by industry, I want to expose them for my use with my game(s)

  • Using signal/R – how chatty is it actually, how fast can you poll?
  • server and client time sync –  when you’re dealing with “at server time ST, ship is at X,Y going at DX,DY velocity” => go render intermediate frames till next server update, you need to get very specific about Servertime ST vs client time CT.  There’s a lot of work around here.
  • server and client poll loops (next post, it got too long in here)
  • how generic or hard-coded to make events and polling – I keep waffling.  I start to write something generic, and then realize how much plumbing I’m putting off to the game, and then go back to hard coded.   It’s the difference between:
    • client->server: UpdatePlayerListRequest;   server->client: UpdatePlayerListResponse
    • client->server: Event(“UpdatePlayerListRequest”), server->client: Event(“UpdatePlayerListResponse”)
    • The former puts some game-specific code at the server level; the second avoids that problem but makes for a lot more argument marshalling and passing.  I keep going back to the first one.
  • In Space, dealing with unlimited-space addressing
    • enumerate the things within distance 10 from me from closest to furthest.
      • answer: its similar to voronoi indexing, but more like i-nodes in the original unix file system.

So, yeah, my brain is alive with the sound of code self-organizing.    Easy there big boy .. need to do the long haul, not the short burnout.

And I love my wife.  She is awesome.

Elite Dangerous: Sunny Goes Mining

I tried mining.  I’m enjoying it.   it is somewhat lucrative.. it is more variable (never know what the next asteroid will bring).. it has some interesting parameters.

In order to mine with ease, you need: 

  • A Prospecting Limpet Controller
  • A Collection Limpet Controller
  • A Refinery.

They made it so that both the Refinery and the Collection controllers want a larger-sized bay – this is where they make you choose.    You can go with a smaller collector, you’ll just have to slow down the mining so the collectors can catch up. 

They also made it so that the limpets (ammo) for prospecting and collecting take up cargo space  – 1 ton per limpet.   So you have to choose your balance of how many limpets to take vs the amount of ore you bring back.

The build I’m going with for now:

[Type-6 Transporter]
S: 1D/F Mining Laser
S: 1D/F Mining Laser
5: 5E Cargo Rack (Capacity: 32)
5: 5E Cargo Rack (Capacity: 32)
4: 4B Refinery  (9 Bins) 
4: 3A Collector Limpet Controller (2 Collectors, 1300 seconds or something ridiculous like that)
3: 3B Shield Generator
2: 1A Prospector Limpet Controller (1)
2: 1E Standard Docking Computer
Cargo : 64 T

I chose to keep a Shield Generator and Docking Computer this time. I tried without them on my Cobra, and it can get scary when you bump into the asteroid.

How it works out:

  • Playing for 45 minutes or so?   Some of it was outfitting and travelling.
  • I used 2 collector drones  … they last me for 2 asteroids.
  • I used 2 prospector drones .. one for each asteroid.
  • I netted 33 tons of ore: 2 Bertrandite, 10 Gallite, 7 Gold, 9 Osmium, 4 Silver.

Given my 64 tons of cargo space, means I could probably go through 4 asteroids or so and then return home with a full hold.   If so I would need to leave with 8 limpets, maybe 10 limpets total to have a little bit extra.

I had a bit of trouble trying to flush out useless materials – the collectors kept grabbing it and bringing it back.  I think I need to fly away, disable the collector in the modules panel, dump them, fly back, re-enable the collector. 

It seems like asteroid sizes and yields are fairly consistent, so far.  All about the same size, all about the same yield.  Might change in the future.

I suspect in the future with a bigger ship and a bigger prospector controller, I could control several limpets – so I could sample several asteroids before going back to a previous one.

The Chart of Money


  • One of the mining tutorial videos I watched named “Bertie” as being worthless.     I think for me my line starts at Coltan or so.
  • This was generated using data from, sucked over to Excel.   Prices differ from station to station.
  • Some of them – the 3 P’s, and Osmyium, can be used to fulfill missions, and thus can be upwards of $100k / ton.

Where to go Mining

There’s a wiki page listing pristine metallic reserves.  I galactic mapped each of them till I found one near my home system (near Lembava).

Well done, Frontier.    Enjoyed this so far.

Resistance to starting a semi-large project for fun

I have 2 projects floating around in my head, and 1 deployed but incomplete.

I’m on NYE break.. another 5 days or so of vacation.    This would be a perfect time to work on these projects.   If that is what I want to do.

Yet, I find I am reluctant to start.  I get more enjoyment out of thinking what I could do, rather than actually doing it?

Its probably similar to the idea of not-running while on vacation.   If I’m going to do it, it needs to be part of normal-life, I think, not trying to beat it into submission with the vacation-card.

Idea #1 – “Burndown”

I’ve had this for several years.  It’s a cross between smartsheet, and Rally, and “always remembering historical scope and left” to generate burndown graphs for any node in the tree.   Its meant to be a multi-person hierarchical task-for-a-project list.    In advanced mode, with templates and stuff.

The trick to make this one work is to have the UX be as easy to get things done as possible.

Idea #2 – “Muddy Sky”

Except, I want it so that I could write a multiplayer version of Endless Sky or even Elite, but with Mud-like conventions on the server side ..  your spaceship is “floating” within a “room”, and interacts with the other objects in that room, and all the client/server stuff is handled over Signal/R, probably using javascript fro the client. 

The solution in my head currently consists of:

  • javascript Canvas on the client side, with translation for rotating ship graphics
  • signal/r for payload transfer from server to client
  • property transfer dictionary of object / key / value for transfering game state from server to client
    • the “player” object on the server side remembers what was sent before.
    • the player object on the server gets called to collect what it thinks its client is interested in
    • some code to compare that against what was sent before so that only changed values get sent down in a client update
  • different kinds of messaging
    • “the world has changed” server->client (described above) to provide client with the latest that it needs for rendering
    • “event” server->client – this would be stuff like “something blew up”, or “somebody said something”.
      • on the server side, would broadcast to a room or to a particular player object
    • “command” client->server – this is stuff like thrust, turn left, turn right, etc. 
      • I can already tell that will likely need to do “thrust for 1 sec” etc because I’m not sure how time sync would work.


  • latency – I don’t know that signal/r will be fast enough to get the latest updates from server down to client.  I’m also not sure that the code for reducing payload size is worth it.  And I haven’t written any code yet!!!!
  • time tracking – client has to deal with different FPS, server has to deal with different tick-per-sec.  
    • I was thinking that all commands / events etc are stuff like “at tick XXXXX, thrust at 50% for 3 ticks”
    • server deals with things in desired-tick order, possibly one tick at a time (or set server interval.  100ms?)
    • start off with fixed time intervals, and then auto-tune from there
      • auto-tune: how fast can the client update its screen – no need to get updates from the server any faster than that.  Let the server know that.
      • auto-tune: how much has changed, does the server need to send an update to this client yet?    Note that stuff that changes, can stay in the buffer to be sent, doesn’t have to be re-detected. 

Gameplay challenges:

  • I want it to be like endless sky… 
    • It’s a 2D world
    • things overlap each other, (mostly) no collision
    • basic operations are thrust, rotate
    • there are ship computers for dealing with more complicated things
  • except that, kindof in order:
    • no speed limit.   thrust one way, thrust the other way 
      • this is why you want an AI to guide you to someplace
    • don’t fly over a star, you’ll overheat and explode
    • there COULD gravity
      • I’ll suspend belief, and have the planets/sun/etc not do the gravity simulation bit, but I want the ships and torpedos to be affected by gravity.
      • However, then there’s a discrepancy .. so maybe planets do orbit via gravity.  
      • There would have to be something like “I want a planet of mass M=x to orbit that star with a Aphelion,Perihilion=y,z” and it calculates the starting x,y and velocity or something.    And then just calculate where the planet will be at a given time T and what its velocity will be. 
    • If we go with Gravity, then there will be bigger distances between planets
    • HYPERSPACE is a different space that your ship can enter
      • masses exert anti-gravity.  Ie, you get pushed away from planets, suns, etc.   r^3 instead of r^2?
      • this will probably cause some interesting “focus” points where everything gets pushed towards.
        • I wonder how those focus points would move as things orbit each other in normal space?
      • I want velocity in hyperspace to be exponential, like it is in FSD in Elite.   Ie, you control your acceleration up/down.    You can then get to insane levels of acceleration .. in a certain direction. 
        • You will really need a computer to guide you in this world.
      • “Interdiction” ala Elite would be done by firing interdiction missiles through hyperspace at your target.. possibly homing?

See, there are so many places I want this to go.  Hence, I want a nice development system, in C#, similar to how we used to run LP-Mud’s.. where I can play with these different mechanics (server side).. and provide all the hooks that others might need to make the game interesting.

Based on the amount I’ve typed, I know that the game is the one I want to work on the most.

But I also know that vacation time is not enough to get this to where I want it to be.  Sure I might get some stuff knocked out, but it won’t be the juicy stuff.    So, I’m loathe to start.

Maybe I’ll go mine some more asteroids in Elite.

Or maybe I’ll set up mini-simulations of what the game play would be like, and just do that rather than build the game.

Maybe I need to start visiting the game-development groups in Louisville on a more regular basis.

Elite Dangerous Revisited

My blog post from Dec 6th, I was just getting into ED.   I was going to do so many things…

Well, I joined a Power Play faction.     LYR, to be specific.  I wanted their fancy doodad drunk missile launcher.

And the game went from fun to a time-sucking soul-less grind.

Here’s the problem:

  • I am not particularly good at combat.  Even worse when I don’t have my HOTAS, just mouse and keyboard.
  • As a member of a faction, there’s these NPC’s who spawn specifically to kill you.  
    • Thanks to _AlliN_, I got clued in that these NPC’s are.. pretty hard.
    • I don’t have a good cargo+fighting ship – haven’t earned enough yet. 
  • Every hour became “I could do this other thing, or I could grab my next allotment and deliver it”. 
  • I calculated I’d have to play for minimum 2.5 hours a day to make my goal, doing nothing other than grinding.
    • 750 merits => 400 per week to maintain; assume 60 merits per day
    • with a 40t hold, that’s GET wait 30 GET deliver return wait 8 GET wait 30 GET deliver return.

After getting blown up in my T6, loosing about 33% of my assets.. in my power’s home system, no loess..  things became sober, and somber.   I tried making a go of it with a Cobra MK3, but with only 40T of cargo space, my favorite way of making cash was handicapped.   If I let go of shielding and a docking computer, I could get 60T..

I made a decision 2 days ago to quit my faction after grinding it out with them for two weeks.   I’ve already recovered an additional million (because now I can use a T6).. I intend to get up to about 25 million, then get an ASP (fully kitted out), and then MAYBE join a faction again.

Listening to Lave Radio (Podcast) episode 92, they talk about the grindyness of Power Play.    Glad I was not the only one.

Things I’m interested in next:

  • Looks like folks are reporting being able to play Horizons with low settings on graphics cards on laptops.   This is good; I might get Horizons – then I’ll have more places to land.
  • There was a new mining guide released, I’ll have to try that in my Type 6.   I found some pristine metal-rich rings.
  • I have 2 ships now.  I might try to do some smuggling in my Cobra – something small, that I could afford to fail.

I am, however, going on Christmas/Winter break (I’m on it now!) and this involves Florida and no HOTAS .. so, yeah.   Don’t know for sure what might happen.   Definitely won’t involve combat.

Elite Dangerous

In 1989 or so, my friend Xeno was showing me some of his favorite computer games.  He showed me Elite.  My eyes went wide.   One day, I thought, I will play that game.   2014: an upgraded version is released.

I have been thoroughly enjoying this game the last few weeks.  However, I seem to have come to a crossroads – now that I know how to survive, and make money, what next?

I could try to collect one of each of the ships. 
I could work my way up to one of the bigger stellar exploration ships and go explore the Milky Way galaxy.

I could try to perfect my mining technique.

I could try to get a better outfitted ship so that pirates who interdict me (pull me out of hyperspace) are in for a surprise treat.

I’m not sure.  I think when I get to the spot in a game where I write a blog post about the game, I’m usually about done with playing the game.  That might be the case here.    So, without further ado, lets get on with this post so that I can get back to living a normal life.

Sunny’s Tips for Playing Elite Dangerous

Keyboard Bindings are Tough.

Bindings become very much a personal preference thing.    There is a default set of keyboard/mouse bindings – I didn’t like them very much.  But they do work – with a little modification I was able to spend an hour or two at starbucks making 250k credits doing trading runs.  I wouldn’t use them in combat, but that’s just me.

The “Training” missions help a bit, but really, to play the game, you’ll need to spend a bit of time on the bindings screen and put various things where you think they make sense to you.   The list that I needed to know when I first started playing – no combat – was:

  • Strafe Up, Down – for taking off from a platform.   (R F?)
  • Strafe Left, Right, Forward Back – for landing on a platform. (Q E, and forward/back were unbound. )   (I rebound R F to forward and back when I got a joystick with a hat)
  • Landing gear retract  (L or Insert .. they seem to switch back and forth on these)
  • Weapons Deploy / Retract ( U )
  • Roll, Pitch (Mouse) (I added ‘ and /)
  • Yaw (A D)
  • Throttle (W, S, X where X = stop)

Very confusing:  Arrow keys did weird things.  They divert power to weapons, shields, and systems. WTF?  Turns out, when you’re in combat, you need these to be prominent and easily accessible, that’s why they’re on the arrow keys.  But confusing to a newbie.

Also confusing: Getting to the left and right monitors.   Shift A, Shift D.  Shift = “engage in-cockpit UI” and A/D.  Once those UI’s were engaged, then WASD to move around, QE for tabs, and space for select.

I also turned on this relative mouse thing .. worked better for me.  Accidentally jiggling the mouse was not a death sentence anymore.

They also overuse “J” for jump to hyperdrive, AND jump to supercruise.  Which is annoying when a pirate is trying to kill you and you just need to get to supercruise fast.  I added “K” for supercruise.

Death is Cheap

When you’re in the starter ship, death = free.   So..  go get blown up by pirates.  No problem.  Just don’t upgrade anything.   Once you upgrade, then beware your minimums.  Right now death costs me about $100k.   I can net about $200k per hour if I focus.

Meaningful Missions were Hard to Find

Most other games, there’s a ton of missions to choose from aimed at a newbie.   Elite, there are a lot of missions, but you don’t qualify for most of them.     I was able to find a Blackbox retrieval mission that got me some $, and I was lucky that a pirate attacked me and then the Feds showed up and shot up the pirate but I got the killing blow in landing me a $48k bounty right off the bat.    However, for my first batch of money, I did trading.

Trading was complicated

The in-game model is, “I know they export this shit to that system, so I should be able to make a profit.”  Yeah, a 10 credit per ton profit.  That didn’t even pay for the fuel.  Turns out there’s, and, which you can google, that show you where the profits can be made.     At first I thought it was cheating, but turns out, there’s an API which can be called, which tells you what’s at the system you are docked at, and pilots volunteer their data to the market, which drives the above websites.   So, yeah, I downloaded EDMC and started contributing as soon as I understood what to do.

Trading is now simple.

After understanding how to change a sidewinder to carry 10 cargo, in an hour or two I had enough for a hauler.

Changing the Hauler to carry 26 cargo, in an hour or so I had enough for a Cobra MK III.

How to expand cargo space?   Your ship has several swappable systems.. that’s where the shield generator, discovery scanner, etc, are mounted.  They can be swapped for cargo spots.  Depending on $, you can get 2,4,8, or 16 tons of cargo into a class-4 bay. 

Upgrading Frame Shift Drive changes a) how far you can jump at a time, and b) how much fuel it uses when you jump.   The difference from class-E to class-A was something like 4LY vs 18LY, expanding trade range a lot, expanding differential, expanding profits, yielding more gold pressed latinum for me.

Getting To Planets without Overshooting Was Hard

The trick was a video that showed “full speed till 0:10 seconds left, then 75% power” yielded very predictable results.   And approaching things at an arc, from above, you can see where the station is relative to the planet and not get slowed down by the planetary gravity well.

Pirates Sucked till I learned to Run Away

I kept getting stopped.  I watched a video on what players had to do to interdict another player.. Ah, makes sense.  Turns out, 90% of the time when a pirate stops me, just divert all to engines, full speed, boost.. your FSD will recharge, and you jump back into hyperspace.  The pirate probably follows you.. one pirate when I had $800k of gold on me stopped me 3 times, and followed me to the station, where the Feds blew him up.

Combat Sucked till I learned to Powerslide, and got Gimbals

The default weapons are not gimballed, so you have to aim pretty good.  I miss most of the time.    And I could not get the bastards in my sights.  Turns out doing strafing while turning helps with angles and makes you more effective than the AI pilots.    Then, upgrading to Gimballed weapons means the computer does most of the aiming, although with less damage per shot (but more shots hit).  On my MK3, I put one turret so that even when they’re not lined up, I’m still whittling away at their shields.

There are some other tactics I want to try as well.  One of them involves just going in reverse in the “sweet spot” for agility, and maybe use torpedos if they get too close (less reaction time for them to evade)?  

Bountys pay well, but beware your repuation.  Enter the Kill Warrant Scanner.

Hanging out at a Nav Beacon at the local Fed star, lots of folks to fight and get bounties on, but apparently your repution suffers?   Going to an independent or anarchy system, everybody was Lawless – and if I blew them up, no bounty.  Until I got a Kill Warrant Scanner.  But you have to get close to scan them with that.  

Bounty hunting can now net 200-300k per hour in my MK3.  More fun than trading.   Although.. I did die once for –100k that time.. more risk, more reward.

Mining was Tedious, but there might be hope.

But that’s because I wasn’t using prospecting limpets to tell me what I was going to get, and I wasn’t using retrieval drones to retrieve them, and I wasn’t in a pristine metal belt.    I might need to revisit this and see how much fun a top dollar mining operation would be like.  

Docking was hard, then got boring, then became an earworm.

At first it was “don’t die”.  Then it was “meh, this is getting old”.  Then, with a larger ship, yes I want a docking computer.  Now the Blue Danube Waltz is stuck in my head every day.    When doing trade runs, I set up the galaxy route for the next leg while my ship is docking itself.

Awesome Game

As you get into the game, several other interesting things start to emerge:

  • Progression in the ranks of combat, trading, and exploration, and how that affects missions.
  • Meta-story of Federation vs Empire vs Alliance and where you end up on that spectrum
  • Per-system story of local factions
  • Constantly upgrading your ship to be that 10% better
  • Outfitting your ship between Trading, Combat, Exploration, and Mining roles
  • The decision to trade in the whole ship and get a completely different ship and all the sounds that the new ship makes.
  • Open play – the rare moment when you see another human
  • The beauty of the star systems.. and the immense scale of how amazingly mind bogglingly big space is.   (digital watches are a pretty neat idea).
  • How much of “legal” vs “illegal” is entirely up to the person who judges things as so.
  • “Silent” running, running without shields, managing heat, etc
  • Ship power systems, power priority orders, etc.

There’s a bunch of in-game things I haven’t investigated .. like “Power Play”, and pretty much all the “illegal” things.  I don’t think I’ll be going after those, and I know I suck at combat (I only win by running away and by having superior weapons, its NOT piloting skill for me).  

I would love to see more variety in their orbitals.    Or, perhaps even cooler would be getting out of your ship and walking through the orbital.. just think if that could be seed-generated as well.

I’m looking forward to their planetary landing stuff (next release).   

End of post.  Have I gotten the obsession for the game out of my head?  I don’t know yet.  It’s a work-week, so I can’t play again till Friday, unless I know I can stay up late that night.