hugosaintemarie / magic-maze

Online version of board game "Magic Maze"
https://magicmaze.herokuapp.com
MIT License
20 stars 11 forks source link

having problems launching this #3

Closed godleydemon closed 5 years ago

godleydemon commented 5 years ago

So a friend of mine was talking about this game, she's from the Netherlands and I'd never heard of it before so I started searching online for it so we might be able to play together in the future. I found your code, but attempting to launch the server.js and watch only gets me to this screen magic

to get to this point I've gone into the app folder and ran npm run watch and opened a separate console window and ran node ./server.js in the same directory. Am I missing something ridiculously simple here?

hugosaintemarie commented 5 years ago

Hi @godleydemon!

I'm glad you're interested in this repo. I'm just basically having fun recreating this board game, it's currently a work in progress and there's still a lot for me to do. Your friend would have to connect to your local server for you to play together and I'm not sure how to do that yet.

I can't see the bottom of your screen but an admin panel should pop up at the bottom of the left blue column. Do you have javascript enabled?

godleydemon commented 5 years ago

I tried it both in internet explorer and chrome with my tempermonkey script off that blocks javascript ads. Doesn't seem like the admin panel is popping up. So maybe I'm missing something somewhere. Do you need help on the network code at all? --edit-- as a side note, I CAN get the very top of the admin menu to pop up on my mobile browser

also, tried iexplorer.exe -extoff

hugosaintemarie commented 5 years ago

Well, this seems to be a CSS issue then. Do you think you can try to play around with the #admin div CSS rules? It sounds like your browser window is taller than your screen (but I guess it's not)…

godleydemon commented 5 years ago

Magic Maze SS

When messing with the css is a little, I can get the box to appear, but nothing is populated into it. Let me mess with the code a little to see if I can get everyone who loads the page as an admin real fast just to see if I can populate it.

godleydemon commented 5 years ago

I attempted to change line 25's code block in server.js to this

    // First person, make it admin
    if (people.length === people.length) {
        adminID = socket.id;
        socket.emit('admin');
    }

Just to see if I can get everyone to be admin when logging in, but this still didn't populate that div.

hugosaintemarie commented 5 years ago

Add a console.log to line 21 in server.js to check if socket.io is working at all:

io.sockets.on('connection', socket => {
    // New person entered the room
    people.push({id: socket.id, spectator: undefined});
    console.log(people);
godleydemon commented 5 years ago

ok that's interesting, I didn't get an output. I should have gotten an id in console. Instead I got nothing o.0

OH OH Wait, it just took a second to appear in console getting [ { id: 'rYneadvQrIT_6UpnAAAA', spectator: undefined } ]

hugosaintemarie commented 5 years ago

Add this to line 67 of js/app.js and see what pops up in Chrome's console.

socket.on('admin', () => {
    console.log($admin);
godleydemon commented 5 years ago

ok I tested a bit myself as well to see if admin was being assigned too. It looks like, for whatever reason, only my cellphone is able to trigger the id and the assigning of the admin image

Let me add your line too for posterity sake

hugosaintemarie commented 5 years ago

Do you get socket.io's minified version of the client at http://localhost:3000/socket.io/socket.io.js?

godleydemon commented 5 years ago

yup I can definitely navigate to that, and I checked scripts being loaded and it IS loading socket.io.js even in chrome. Just it's not triggering the new person create, the admin assign and also nothing appeared by putting that console log on line 67 even when going there by mobile

godleydemon commented 5 years ago

loading Here's what I've got script wise, loading up on chrome as I try and load up port 3000 on localhost.

hugosaintemarie commented 5 years ago

nothing appeared by putting that console log on line 67 even when going there by mobile

Yeah, that's because the console.log on line 67 would appear in your mobile's Chrome console, since it is the one receiving the admin event. I'm not sure what's wrong…

Try to change index.html line 12 1 player online to 0 player online.

When your mobile's tab is closed (so it doesn't connect first and get the admin event), refresh the page in your desktop's Chrome. You should get :

godleydemon commented 5 years ago

ok tried out a couple of things to test. The player count is not changing in chrome when players are changed to 0 in index.html and I log in via my mobile browser. I'm also getting nothing in console when all browsers are closed and I restart the server and watch and then try and log into it with chrome. It's as if it's never running the javascript at all.

hugosaintemarie commented 5 years ago

It's as if it's never running the javascript at all.

Add this to line 1 of js/app.js: console.log('hello');

godleydemon commented 5 years ago

no output in chrome or in consoles

godleydemon commented 5 years ago

ok was talking to a friend and he suggested I remove the type="module" out of "" and it was able to print hello in console and it looks like it's kind of working lol image

hugosaintemarie commented 5 years ago

Having a second look at your sources screenshot earlier, js/bundle.js is not loading.

ok was talking to a friend and he suggested I remove the type="module" out of ""

Yeah I had that in mind earlier but it spits out a bunch of errors (as your screenshot shows). I'll try to load it not as a module. Is your Chrome version up to date?

godleydemon commented 5 years ago

I certainly don't see the "update chrome" button anywhere if that's what your asking.

hugosaintemarie commented 5 years ago

Can you try to switch to the dev branch and see if it's working now? (Don't forget to pull the above fix)

godleydemon commented 5 years ago

Can you try to switch to the dev branch and see if it's working now? (Don't forget to pull the above fix)

That looks to have fixed the issue, now I can actually check it out lol XD

hugosaintemarie commented 5 years ago

Great! I'm glad. Closing this issue, feel free to shoot me an email (it's on my profile) if you wanna discuss this further.