You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to assign manipulations to players in one game based upon the results of players' decisions in another game, possibly in which the games are happening simultaneously. (Essentially because I'm abusing Empirica as a survey platform and I want to do adaptive surveys, but I can see the use case extending to actual multiparty games).
In order to do so, I either want to have some code that runs at the server level that can decide top-down which manipulations to give, or a way of sharing information between games (even just writing to a file on the server, or a new table in the DB). @npaton, is there something of that nature already built into Empirica, or a place where I could insert a lever to stick one in?
Thanks!
James
The text was updated successfully, but these errors were encountered:
JamesPHoughton
changed the title
Resource/Logic shared between games
Resource/Logic shared dynamically between games
Aug 28, 2020
Hey James. Sorry took me a while to answer! Yeah, no, there's nothing Empirica specific right now. 🤷
The good news is that it should be pretty easy to store stuff in the DB. You can just create and use a new table like this (from the example found here):
// When you create a collection on the server:Todos=newMongo.Collection('todos');// You are creating a collection within MongoDB, and an interface to that// collection to be used on the server. It’s a fairly straightforward layer on// top of the underlying Node MongoDB driver, but with a synchronous API:// This line won't complete until the insert is doneTodos.insert({_id: 'my-todo',stuff: "things"});// So this line will return somethingconsttodo=Todos.findOne({_id: 'my-todo'});// Look ma, no callbacks!console.log(todo);
That will work easily on the server-side. Just declare the Mongo.Collection outside any callbacks, and pass the name of the table in the DB, and you should be good.
There are a couple caveats:
This will not be exported by the Empirica export function in the admin UI
Concurrency can be a problem: if you're trying to write and read from this table at the same time from 2 games, you might have some data corruption, depending on what you're trying to do.
Then, if you need a new collection on the client side, in the browser, that will be a bit more work. Let me know and I can try to help you get that going.
I'd like to assign manipulations to players in one game based upon the results of players' decisions in another game, possibly in which the games are happening simultaneously. (Essentially because I'm abusing Empirica as a survey platform and I want to do adaptive surveys, but I can see the use case extending to actual multiparty games).
In order to do so, I either want to have some code that runs at the server level that can decide top-down which manipulations to give, or a way of sharing information between games (even just writing to a file on the server, or a new table in the DB). @npaton, is there something of that nature already built into Empirica, or a place where I could insert a lever to stick one in?
Thanks!
James
The text was updated successfully, but these errors were encountered: