[1] https://github.com/poly/stdlib
[2] https://www.portal.reinvent.awsevents.com/connect/sessionDet...
Clojure, Javascript, and Golang would be good languages for this. The environment possibly would let you inject and replace functions live, lending to a Light Table like experience, but while developing a multiplayer game.
The LambdaMOO server has a main event loop which handles user events, then schedules tasks which execute functions ('verbs' in LambdaMOO parlance) to modify the game state. Verbs are not pure per se but can be thought of as a transaction which executes in an atomic, consistent, and isolated manner. Verbs are attached to objects in the game, and can be modified in-game on the fly by players with their programmer bit set. (Programmers can only modify verbs on objects they own.)
The LambdaMOO language is a lot like JavaScript with a Luaesque syntax. It has prototypical inheritance, which meshes well with its concept of objects as physical things. For example, to get a new instance of a duck one would create a Generic Duck named "My Duck" ('Generic' being the conventional prefix for an object specifically intended to be used as a prototype.)
There was a time in the late 1990s when it regularly supported 300 active users at once (with a certan amount of lag); on modern hardware it could probably handle significantly more than that. If you want a modern scalable system then LambdaMOO itself is probably not for you; the server is single-threaded (in fact the whole thing is remarkably similar to NodeJS with async/await support) and state is saved in-memory and checkpointed periodically (hence the Durability missing from the above description of verbs).
However, the basic design (prototypal inheritance, in-database verbs, ACI[D] tasks, etc) is extremely well proven, and would lend itself well to being copied into a modern distributed system like AWS Lambda. As long as you had an ACID datastore to back it up, you could scale the task execution as far as you wanted, and with a bit of clever work you could probably come up with a partitioning scheme to make the database scale as well.
In fact, I've partially implemented this already; what's stopped me has primarily been that I'm more interested in the technical aspects and have no idea what I would actually use it for once I built it. If you have a use case for this sort of thing I'd love to hear about it.
I had a pseudo-roguelike server first implemented in Clojure, then in Go that updated 12 frames a second. It could support 250 simultaneous users. It even had Conway's life as an area attack. I had it posted to Show HN.
However, the basic design (prototypal inheritance, in-database verbs, ACI[D] tasks, etc) is extremely well proven, and would lend itself well to being copied into a modern distributed system like AWS Lambda.
All that's needed is pure functions, soft realtime, and good tooling and APIs. ACID takes some doing, in terms of implementation and will also make scaling complicated, as you mention above. Inheritance? Nice but not necessary. Just let developers inject functions into a game loop, then tell them their load and when their simulation tick rate starts to drop.
If you have a use case for this sort of thing I'd love to hear about it.
Yes. Something like that could be packaged into MMOGAAS -- Massively Multiplayer Online As A Service.
Growing that into a FaaS product would be hard though; Erlang processes all share a trust domain, from the infosec point of view, so containerizing each function/process for invocation lambda-style on otherwise shared infrastructure may prove difficult.
Each of my server processes in Go looks a little like an Erlang actor. There's a switch statement where a queue of input messages is processed, then each instance is run in turn. Instances also have a similar structure and maintain a "space" using an R-Tree. When it comes to efficiency, game loops are still a great way to do concurrency. Game loops per-instance allow you to sidestep many pitfalls of multi processor concurrency, much as per-process GC does with Erlang.
You'd probably want architecture extremely specialized to a game loop, and probably your game loop specifically, if you wanted low-latency, high-availability FaaS for this purpose.
...ok... Did you read my comment?
These functions are all running inside of containers that have been optimized to be "warmed up" extremely quickly, but that warm-up takes time, and the more robust the solution, the longer the warm-up.
Yeah, of course that's not going to work.
I've basically built a specialized "container" system, but instead of using kernel virtualization, it's actually a specific Go "object" residing in an already running server process. These "containers" (really instances) start running in an environment where we already have a virtual server with a process with a server/game loop up and running. I have a cluster of processes that does this, and idempotently spawns an instance of star system in a multiplayer game consisting of 2^87 star systems.
www.emergencevector.com
Such a system can still be built on Docker style containers, it's just that those Docker style containers represent an entire sub-cluster of many server processes that can each host many "instance" containers which are where the functions that transform from tick n to tick n+1 reside.
You'd probably want architecture extremely specialized to a game loop
That is what I said in my comment.
and probably your game loop specifically
I'm saying that the game loop could be customized/built up by a developer by injecting functions into such a system. (Or, possibly, by injecting such functions into a dev version running locally, then exporting them to a server in the cloud.)
pip install zappa
I didn't plan to do the push-to-deploy thing, mostly because that would totally complicate things. The rationale was more that we would use the CI that would automatically build and deploy things to DEV env that would be then promoted around.
Serverless is way much more advanced machinery than this tool. My point was to create a tool, not a whole ecosystem around AWS Lambda.
When it comes to serverless - my main concern (as it was with Lambda without env variables), is with storing configuration data along the code in the repo. Additionally the reason for creating was mostly pipelines.
Also, does it help with dependencies or something like that? Does it manage packaging files?
From what you write I think apex would be better suited for you
I was talking something specifically like Lambda, but where pure functions could be injected into an already running game loop. The name was intentionally ridiculous. Also, you suggested that my proposal would suffer from the latency of lambda requests going over the network, which shows you didn't read my original comment.
with your cloud functions being called on triggers
Yeah, I pretty much covered that this was not what I was proposing, when I wrote "(You'd have to choose a particular architecture for synchronization with the client, of course. Also, before someone makes the mistake of assuming I'm as stupid as they are -- I'm not proposing that a function be transmitted, compiled, then evaluated at each tick over the network! Functions would be installed into virtualized servers.)" As far as I knew (which might be out of date) Photon was developing something that would be suitable for a persistent world MMORPG, but not quite ready with it. What I'm proposing would be suitable for an MMORPG, not just MMO game sessions.
This is great for internal facing REST Api. I don't know about scaling but hypothetically serverless means it should handle public requests fine.
I was using Chalice but seems like Zappas is another one a HNer pointed out. I couldn't get Chalice to work and sort of gave up on the serverless-api-gatway-lambda idea.