These are chat archives for PrismarineJS/prismarine-server

24th
Apr 2015
Will Franzen
@wtfaremyinitials
Apr 24 2015 02:18
@roblabla If you have an hour or two I’d love to work through the Prismarine APIs with you
demipixel
@demipixel
Apr 24 2015 02:38
I feel like gitter is a more public chat, but there should be a spot for people who want to talk a lot without it being completely private
Will Franzen
@wtfaremyinitials
Apr 24 2015 02:39
so like private chat?
demipixel
@demipixel
Apr 24 2015 02:39
No, because what if I want to see your and @roblabla 's convo?
Will Franzen
@wtfaremyinitials
Apr 24 2015 02:40
well then it would be public :stuck_out_tongue:
why the switch to this channel btw?
demipixel
@demipixel
Apr 24 2015 02:40
You mentioneed "talking to @roblabla for an hour or two about the apis". I figured that would be, like... really spammy for gitter, yet I would still love to peak at the conversation
Will Franzen
@wtfaremyinitials
Apr 24 2015 02:41
true
I don’t really know ¯\(ツ)
Robin Lambertz
@roblabla
Apr 24 2015 12:39
well
We could go to an IRC chatroom for this, and only let voiced user talk
Romain Beaumont
@rom1504
Apr 24 2015 12:43
what's the problem with talking here ?
Robin Lambertz
@roblabla
Apr 24 2015 12:44
idk
Robin Lambertz
@roblabla
Apr 24 2015 12:52
BTW @wtfaremyinitials just tell me when you're available and we can talk :D
demipixel
@demipixel
Apr 24 2015 20:20
OKAY GUYS
Someone explain prismarine-chunk to me
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:22
I can explain in a few
Once I'm home
demipixel
@demipixel
Apr 24 2015 20:22
I have two more classes in a few minutes :S
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:26
Shoot me a PM once you're out of class :stuck_out_tongue:
Robin Lambertz
@roblabla
Apr 24 2015 20:51
@wtfaremyinitials wanna talk API ?
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:51
le’ts do it
so….
I guess the first thing is how it would run
Robin Lambertz
@roblabla
Apr 24 2015 20:51
Alright, so first of all, let's see how prismarine-server works :
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:52
My current thoughts are prismarine-server (or maybe just ‘prismarine’) would expose a .createServer()
as well as having a bin script that would run the create server and a couple other things
Robin Lambertz
@roblabla
Apr 24 2015 20:53
Agreed
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:53
okay cool
Robin Lambertz
@roblabla
Apr 24 2015 20:53
You'd probably pass createServer a config file (JSON/YML/etc...)
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:53
yeah
Robin Lambertz
@roblabla
Apr 24 2015 20:53
The config file would,for instance, tell it which worlds to load by default
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:53
well, a json config object
leave config parsing to other modules :stuck_out_tongue:
Robin Lambertz
@roblabla
Apr 24 2015 20:54
The thing is, the way I envision it, lots of things are configured world-level
For instance, world-provider is something that can be set for each world
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:55
{
    "motd": "A prismarine server",
    "slots": 20,
    "whitelist": true,
    "pvp": false,
    "worlds": [
        {
            "name": "overworld",
            "generator": {
                "name": "prismarine-generator-flatland",
                "options": {
                    "levels": [7, 3, 3, 3, 2]
                }
            },
            "provider": "prismarine-provider-anvil",
            "type": 0
        },
        {
            "name": "nether",
            "generator": "prismarine-generator-nether",
            "provider": "prismarine-provider-anvil",
            "type": 1
        }
    ],
    "modules": {
        "prismarine-minecraft-protocol": { "port": 25565 },
        "prismarine-minecraft-physics": {}
    },
    "implementations": {
        "some-other-chunk": {}
    }
}
I got bored earlier and drafted what a server.json could look like
Robin Lambertz
@roblabla
Apr 24 2015 20:56
"modules" and "implementations"
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:56
that’s a bit complex
Robin Lambertz
@roblabla
Apr 24 2015 20:56
Those need to be merged
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:56
I’m not sure it’s possible :/
Robin Lambertz
@roblabla
Apr 24 2015 20:56
So this touches one of the interesting aspects of prismarine
there is effectively two kinds of plugins
there are plugins that replace a default implementation of prismarine
and there are plugins that extend functionality
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:57
yeah
here’s the way I figured it would work
Robin Lambertz
@roblabla
Apr 24 2015 20:57
To make a bridge with the java world :
first kind of plugin is Forge
second kinf of plugin is Bukkit
sort of
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:58
in the main module (prismarine/prismarine-server) has a file that can be accessed by require(‘prismarine/implementations’)
If you want to create a Chunk using the server’s perfered implementation of Chunk
Robin Lambertz
@roblabla
Apr 24 2015 20:59
I had a better idea
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:59
you do const Chunk = require(‘prismarine/implementations’)
Robin Lambertz
@roblabla
Apr 24 2015 20:59
give me a minute
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:59
go
Robin Lambertz
@roblabla
Apr 24 2015 20:59
trying to spin up a code collab site so we can work on the json as we speak here
Will Franzen
@wtfaremyinitials
Apr 24 2015 20:59
coolio
module.exports = {
    Chunk:  require('prismarine-chunk'),
    World:  require('prismarine-world')
};
(what the implementations.js file would look like. the requires are defaults)
if you wanted to relpace something, require(‘prismarine/implementations’).Chunk = MyChunk;
Robin Lambertz
@roblabla
Apr 24 2015 21:02
http://codebunk.com/b/39031944/ ooh this one is pwetty
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:03
you set it to read only
can’t chat either :stuck_out_tongue:
Robin Lambertz
@roblabla
Apr 24 2015 21:05
meh
let me find another one
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:05
I liked this one :3
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:09
do you have a c9 account?
Robin Lambertz
@roblabla
Apr 24 2015 21:09
yup
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:09
@roblabla?
Robin Lambertz
@roblabla
Apr 24 2015 21:09
yuup
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:09
awesome
Robin Lambertz
@roblabla
Apr 24 2015 21:09
LOOOL
I have a shitbunch of old stuff on their website
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:10
Hahahaha
Robin Lambertz
@roblabla
Apr 24 2015 21:10
I love how inconsistent their design is now
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:10
lol
chat through comments or gitter?
Robin Lambertz
@roblabla
Apr 24 2015 21:17
here
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:17
yup
Robin Lambertz
@roblabla
Apr 24 2015 21:17
so we keep transcript
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:17
nah itll be out of order
Robin Lambertz
@roblabla
Apr 24 2015 21:18
let's not worried about what we talked 'till now
it's ok
:P
so what are server-level impls...
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:18
Chunk, World, Entity
Robin Lambertz
@roblabla
Apr 24 2015 21:18
chunk is world-level
entity is world-level too
you might want entities to behave differently based on world
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:19
right
Robin Lambertz
@roblabla
Apr 24 2015 21:19
(not to mention, entity AI is probably a plugin)
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:19
it definitely is
Robin Lambertz
@roblabla
Apr 24 2015 21:19
I actually have a hard time comming up with server-level modules
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:19
same
I don’t think there are many
Robin Lambertz
@roblabla
Apr 24 2015 21:20
So let's skip it for now
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:20
wait
undo that
I figured modules placed in the root of the config apply to all worlds
Robin Lambertz
@roblabla
Apr 24 2015 21:20
Ah, I see
makes sense
ok now as for the module syntax
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:21
huh?
Robin Lambertz
@roblabla
Apr 24 2015 21:21
if you want a different world-provider
you modify the "name"
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:22
you define what world provider you want for a world in the world object
Robin Lambertz
@roblabla
Apr 24 2015 21:22
nah
that's a module
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:22
no?
Robin Lambertz
@roblabla
Apr 24 2015 21:22
that's def a module
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:22
kay
what are the keys for the “modules” object?
Robin Lambertz
@roblabla
Apr 24 2015 21:24
well, we don't have them all yet
but a few I can think of
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:24
what if a module doesn’t need to go in a ‘slot'
Robin Lambertz
@roblabla
Apr 24 2015 21:24
world-provider
world-generator
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:25
and it just hooks events
Robin Lambertz
@roblabla
Apr 24 2015 21:25
then it's a plugin
not a module
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:25
-.-
Robin Lambertz
@roblabla
Apr 24 2015 21:25
a module changes built-in behavior
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:25
alright
Robin Lambertz
@roblabla
Apr 24 2015 21:25
think of it like this : if there can only be one of it, it's a module
there can only be one worldgen
(per world, but that's not the problem)
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:25
lol so what I meant by “implementation” you meant "module"
Robin Lambertz
@roblabla
Apr 24 2015 21:25
I guess ? probably :P
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:25
and my “module” was your “plugin"
Robin Lambertz
@roblabla
Apr 24 2015 21:26
hmm, your wording is probably better
I'd keep plugin though
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:26
module is too node
Robin Lambertz
@roblabla
Apr 24 2015 21:26
as that's what people are used too
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:26
mhm
Robin Lambertz
@roblabla
Apr 24 2015 21:26
so plugin and implementation
sounds good ?
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:26
sure
are world generators implementations or plugins?
Robin Lambertz
@roblabla
Apr 24 2015 21:28
impl
there needs to be one
otherwise world cannot load
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:28
alright
Robin Lambertz
@roblabla
Apr 24 2015 21:28
implementations are like there needs to be one, but there cannot be more than one.
Ah, chat
this one is going to be hard to classify
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:29
damn
Robin Lambertz
@roblabla
Apr 24 2015 21:29
as it can either be global or world-specific
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:29
well that’s fine
it’s up to the person configuring the server
if you want it to be the whole world, toss it in root
Robin Lambertz
@roblabla
Apr 24 2015 21:29
I like your optimism
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:30
hahaha
Robin Lambertz
@roblabla
Apr 24 2015 21:30
brb 5 sec
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:30
someone’s gonnna have to make a web based server.json generator
because this file is super complicated
for people who cant code
Robin Lambertz
@roblabla
Apr 24 2015 21:36
well, when prismarine-server bin starts, it generates a default one
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:37
that works oo
thought of another implementation
command parser
Robin Lambertz
@roblabla
Apr 24 2015 21:39
isn't that just chat ?
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:39
I don’t think so
wait is chat a plugin or an implementation
Robin Lambertz
@roblabla
Apr 24 2015 21:40
Well, I have a hard time classifying it :|
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:40
hmm
HMMMM
Robin Lambertz
@roblabla
Apr 24 2015 21:40
HMMMMMM
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:40
I want to say implementation
but I think command parsing should be separate
Robin Lambertz
@roblabla
Apr 24 2015 21:41
server.on('raw_chat_message', function(msg, player) {
    server.players.forEach(Player.prototype.sendMessage);
});
Protocol feeds the raw_chat_message to server
obv
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:41
> using forEach instead of map
Robin Lambertz
@roblabla
Apr 24 2015 21:42
well, yeah ?
map is to create a new array
forEach is to apply a side-effect
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:42
map is for either
Robin Lambertz
@roblabla
Apr 24 2015 21:42
No
I mean, yes
but if you take perf in mind, no
;_; think of the poor mem
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:43
I assume v8 optimizes that out
but idk
Robin Lambertz
@roblabla
Apr 24 2015 21:43
no, it doesn't
already bench'd it
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:43
anyway
api stuff?
Robin Lambertz
@roblabla
Apr 24 2015 21:43
give me a small min
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:44
kk
Robin Lambertz
@roblabla
Apr 24 2015 21:44
We need to define the funcs and events of Server
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:44
right
Robin Lambertz
@roblabla
Apr 24 2015 21:46
back
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:46
scroll down
This message was deleted
This message was deleted
do we need a raw_chat event?
if it’s only being passed to the chat implementation
Robin Lambertz
@roblabla
Apr 24 2015 21:48
Weeell
Ah, maybe
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:51
Are we going to have Block objects?
Robin Lambertz
@roblabla
Apr 24 2015 21:51
Let's put it there for now
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:51
okay
Robin Lambertz
@roblabla
Apr 24 2015 21:51
We'll filter what goes where later
;)
Why am I so uncreative
Time to look at bukkit's event list
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:54
how so?
hahaha
Robin Lambertz
@roblabla
Apr 24 2015 21:55
I have a hard time coming up with events for some reason :|
@/all you can participate btw
Will Franzen
@wtfaremyinitials
Apr 24 2015 21:57
how are we going to handle event prioritization?
(code collab link https://ide.c9.io/wtfaremyinitials/prismarine-prototype, ping me for an edit invite)
Robin Lambertz
@roblabla
Apr 24 2015 21:59
Weeelll
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:00
hm?
Robin Lambertz
@roblabla
Apr 24 2015 22:00
I'm one of those guys who never ever ever used priorities
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:00
I feel like they might be necessary
but I don’t know
Robin Lambertz
@roblabla
Apr 24 2015 22:01
There is actually a way to make sure you run after everyone if you use a custom eventemitter
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:01
we’re probably gonna do that
Robin Lambertz
@roblabla
Apr 24 2015 22:01
on("stuff", function(next, params) {
    next();
     // do your edits now
});
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:01
interesting
Robin Lambertz
@roblabla
Apr 24 2015 22:02
this also makes it easy to cancel events
just don't call next :D
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:02
^-^
Robin Lambertz
@roblabla
Apr 24 2015 22:02
there is one thing I'm OK with having : "MONITOR" priority
it's a priority where you must NOT make ANY edits to the values of the event
and you aren't allowed to cancel either
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:03
how do we enforce that?
Robin Lambertz
@roblabla
Apr 24 2015 22:03
we don't, shit blows up if you do, that's all
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:03
alright
Robin Lambertz
@roblabla
Apr 24 2015 22:03
it just allows you to get the final values of events
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:03
mhm
Robin Lambertz
@roblabla
Apr 24 2015 22:04
We need to set which events are cancellable though now :)
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:05
aren’t they all?
Robin Lambertz
@roblabla
Apr 24 2015 22:07
can't cancel player_leave
I mean, unless you find a way to force players to stay on your server :P
in hindsight, we should've specified those that are NOT cancellable though
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:09
yeah not cancellable is better
should events be strings, or Symbols in a file that can be required?
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:22
rob?
Robin Lambertz
@roblabla
Apr 24 2015 22:24
ok back
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:25
hi
Robin Lambertz
@roblabla
Apr 24 2015 22:25
I guess we'll do symbols, since we're going the ES6 way
what's entity_explode ? isn't it just EXPLOSION ?
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:25
bukkit calls it entity explode
both work
Robin Lambertz
@roblabla
Apr 24 2015 22:26
also, motd... this is a module
actually, the whole ping thing should be a module
so motd, slot, etc...
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:26
they are
but server is what stores the values that they use
Robin Lambertz
@roblabla
Apr 24 2015 22:26
no, it's not
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:26
okay
Robin Lambertz
@roblabla
Apr 24 2015 22:27
what if I dont have a slot
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:27
?
Robin Lambertz
@roblabla
Apr 24 2015 22:27
what if my module doesn't support slot
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:27
then ignore it?
Robin Lambertz
@roblabla
Apr 24 2015 22:27
I think it's just bad design to have it there
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:27
slot == maxPlayers
Robin Lambertz
@roblabla
Apr 24 2015 22:27
it doesn't belong to server
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:28
how does it not belong to server?
Robin Lambertz
@roblabla
Apr 24 2015 22:28
Yes, but that's a separate thing ;)
MOTD, at the very least, doesn't belong to server because it belongs to the module in charge of it
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:28
meh
alright
Robin Lambertz
@roblabla
Apr 24 2015 22:28
concerning getX
we should define getters instead
pwettier this way
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:28
how what
theres an es6 feature I haven’t seen yet
getter and setter is actually an es5 method in the form of Object.defineProperty
es6 adds some suggar for it ;)
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:30
oh so with the get/set thing
you access players with just Server.players?
as opposed to Server.getPlayers()
Robin Lambertz
@roblabla
Apr 24 2015 22:30
yup
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:31
coool
Robin Lambertz
@roblabla
Apr 24 2015 22:31
functions should be only stuff that actually have a side-effect
if your function just returns stuff, then it would be better to make it a property ;)
also, just want to say that players() should return an IMMUTABLE array
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:32
how can we do that?
Robin Lambertz
@roblabla
Apr 24 2015 22:32
facebook comes to the rescue :)
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:32
works for me
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:33
i’ve heard of immutablejs before :stuck_out_tongue:
wasn’t sure if you wanted to use it
Robin Lambertz
@roblabla
Apr 24 2015 22:33
the only problem is that it isn't actually an array
which makes me a sad panda
:(
oh well
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:34
so people can’t do immutableList[3]?
Robin Lambertz
@roblabla
Apr 24 2015 22:34
nope
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:34
aw
Robin Lambertz
@roblabla
Apr 24 2015 22:34
but I think there's no way to actually make an immutable list
that works that way
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:34
probably not
Robin Lambertz
@roblabla
Apr 24 2015 22:35
only thing that could work is returning a copy
Oooh
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:35
that would break things I think
Robin Lambertz
@roblabla
Apr 24 2015 22:35
we could return a Set hehehe
then nobody can complain about the lack of []
:P
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:35
I guess we could
Robin Lambertz
@roblabla
Apr 24 2015 22:35
Since we don't need to care about order and all that
anyway, I g2g
;(
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:36
nooooooooooooo
:(
Robin Lambertz
@roblabla
Apr 24 2015 22:36
I'll be back 2morow, we can flesh it out then
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:36
alright
cya
Robin Lambertz
@roblabla
Apr 24 2015 22:36
I think it might be a good idea to start impl what we talked about in our current prismarine-server
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:36
how so?
like specifically
Robin Lambertz
@roblabla
Apr 24 2015 22:37
config file
:P
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:37
what’s there to implement
Robin Lambertz
@roblabla
Apr 24 2015 22:37
like, make it auto-generate the file if it doesn't exist
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:37
right
kk
Robin Lambertz
@roblabla
Apr 24 2015 22:37
and like the chunk loading
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:37
Mhm
Robin Lambertz
@roblabla
Apr 24 2015 22:37
make it require based on the file
or worldgen
anyway, cya
Will Franzen
@wtfaremyinitials
Apr 24 2015 22:38
cya