[erlang-questions] Desing of MVC models

Loïc Hoguin essen@REDACTED
Sun Sep 15 22:58:16 CEST 2013


On 09/15/2013 10:30 PM, Ludovic Demblans wrote:
> Loïc, you said :
>
> """You most likely don't need to store all of this in a database."""
>
> Actually, this is a browser game server, the kind of you refresh a few
> times in a day to update things (buildings, productions, skills, ...),
> all the data must be saved often. And as people aren't connected
> continuously, i don't want all my data living in RAM all of the time.
> (BTW i should upgrade my hosting, but for now i am quite limited on
> RAM)

It makes no difference.

When the player gets back online, you create your processes and load the 
state. What happens from that point on depends on the game of course, 
but for example you do not have to worry about saving the state if 
nobody else in the world can see what changed.

Your player state is likely just a few kilobytes of RAM at most. With 
today's hosting that means a lot of players even on the smallest 
servers. (Unless if you use cloud stuff I suppose.)

But this is the less interesting part of what I said. What will make you 
start thinking in Erlang is if you design your game with just processes, 
with no database and no browser. Just processes. Then you can add the 
browser and save the data and anything fancy you wish. But first you 
need to forget MVC ever existed, and start seeing the M in MVC as an 
actual live application you'll be talking to directly.

-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the erlang-questions mailing list