Multiplayer Backend
09 October 2016 05:51
I just watched this video with Kirill Petryaev
It opens a lot of possibilities. I am currently using Blend4web to produce a weekly updated 3D model acquired by drone photography for a large industrial site.
This 'mulitplayer' concept opens the possibility of a persistent 3D space with realtime equipment positions and inventory locations. The 'players' in this model would be mobile devices inside moving equipment running the client.
I have been doing this on a small scale for two years now. An app running in a loader counts what it moves by using GPS and uploads to a web app running on Google App Engine. Then a spreadsheet automatically loads the table of data from the site online. So the user just opens their inventory spreadsheet and the data is magically there.
If anybody would like to collaborate with me on this I would be happy to share with the community. Developing a good tool-chain like this could work out very will for Blend4web gaming and commercial applications.
I am hoping to get further information to help me replicate the work of Kirill Petryaev. In the meantime, I am studying up on AJAX and NodeJS, either of which might work for this.
It opens a lot of possibilities. I am currently using Blend4web to produce a weekly updated 3D model acquired by drone photography for a large industrial site.
This 'mulitplayer' concept opens the possibility of a persistent 3D space with realtime equipment positions and inventory locations. The 'players' in this model would be mobile devices inside moving equipment running the client.
I have been doing this on a small scale for two years now. An app running in a loader counts what it moves by using GPS and uploads to a web app running on Google App Engine. Then a spreadsheet automatically loads the table of data from the site online. So the user just opens their inventory spreadsheet and the data is magically there.
If anybody would like to collaborate with me on this I would be happy to share with the community. Developing a good tool-chain like this could work out very will for Blend4web gaming and commercial applications.
I am hoping to get further information to help me replicate the work of Kirill Petryaev. In the meantime, I am studying up on AJAX and NodeJS, either of which might work for this.
10 October 2016 14:43
Greetings. If I understand you correctly, you want to visualize the data from the physical devices in real time. Using the GPS position data and display a 3D scene.
I can help you develop a server. And an app for android / iOS / Windows on the framework Cordova, and test scene on b4w.
I can throw in an example of the archive. And I can get up and running on the machine.
I can help you develop a server. And an app for android / iOS / Windows on the framework Cordova, and test scene on b4w.
I can throw in an example of the archive. And I can get up and running on the machine.
10 October 2016 23:06
Thanks for your reply.
I think this could be a fun project.
It looks like setting up a Node.js server is not very hard.
I was thinking of setting up a simple scene that multiple people can interact with. In the beginning I am not worried about login authentication.
Your page here: http://naviris.ru/b4w1/dubina/dubina.html
How can multiple people load the same page and all be able to interact with it? Like a chessboard. The position of each chess piece could be logged by the server and anybody who loads the page could see current positions and change them.
Question about Cordova: Do you think that would be better then a web app running in the mobile browser? Could a Blend4web app pull geolocataion?
I think this could be a fun project.
It looks like setting up a Node.js server is not very hard.
I was thinking of setting up a simple scene that multiple people can interact with. In the beginning I am not worried about login authentication.
Your page here: http://naviris.ru/b4w1/dubina/dubina.html
How can multiple people load the same page and all be able to interact with it? Like a chessboard. The position of each chess piece could be logged by the server and anybody who loads the page could see current positions and change them.
Question about Cordova: Do you think that would be better then a web app running in the mobile browser? Could a Blend4web app pull geolocataion?
12 October 2016 14:38
Reply to post of user Will WelkerHello Will, Kirill is currently having his university diploma exams. He'll answer you soon afterwards.
Thanks for your reply.
I think this could be a fun project.
It looks like setting up a Node.js server is not very hard.
I was thinking of setting up a simple scene that multiple people can interact with. In the beginning I am not worried about login authentication.
Your page here: http://naviris.ru/b4w1/dubina/dubina.html
How can multiple people load the same page and all be able to interact with it? Like a chessboard. The position of each chess piece could be logged by the server and anybody who loads the page could see current positions and change them.
Question about Cordova: Do you think that would be better then a web app running in the mobile browser? Could a Blend4web app pull geolocataion?
Manager and 3D Generalist at Blend4Web
No pain, no gain.
mikhail@blend4web.com
No pain, no gain.
mikhail@blend4web.com
12 October 2016 16:39
Okay. No reason to hurry. I am learning Node.js now and I don't learn very fast
I have Ubuntu server up and running and I am starting to play with the code. Godaddy.com has pretty good deals on Node.js servers so I am trying it out. I am sure there are many other web service companies that can provide a server but I already use Godaddy.
I have Ubuntu server up and running and I am starting to play with the code. Godaddy.com has pretty good deals on Node.js servers so I am trying it out. I am sure there are many other web service companies that can provide a server but I already use Godaddy.
18 October 2016 07:29
I have a chess app I have been putting together. The code is mostly from the Cartoon Interior project.
http://williamwelker.com/b4w/nodejs/
JS File
Blend file
Currently if you hit F12 to see the browser console log, you can see the position data is getting logged when you move pieces. The plan is to run this through a node.js server and database so multiple people can view and interact with the app. So when we get the back-end running, it should position the pieces according to the data on the node.js server. My next step will be to work on the server-side code then interface it with the client running in the browser. User login, security and authentication can come later.
Also, I am not trying to put in any chess logic. Like a real chessboard, everything can just be moved around.
Server question for anybody who can answer: This app is served from a normal web server. I have node.js running on another public server (Ubuntu). Will this app be able to open a socket on a separate server like that?
Kirill's client code:
http://williamwelker.com/b4w/nodejs/
JS File
Blend file
Currently if you hit F12 to see the browser console log, you can see the position data is getting logged when you move pieces. The plan is to run this through a node.js server and database so multiple people can view and interact with the app. So when we get the back-end running, it should position the pieces according to the data on the node.js server. My next step will be to work on the server-side code then interface it with the client running in the browser. User login, security and authentication can come later.
Also, I am not trying to put in any chess logic. Like a real chessboard, everything can just be moved around.
Server question for anybody who can answer: This app is served from a normal web server. I have node.js running on another public server (Ubuntu). Will this app be able to open a socket on a separate server like that?
Kirill's client code:
function init_set(){
var socket = io.connect('http://95.215.108.215:8080/');
socket.on('connect', function () {
socket.emit('type_client', 'vis');
socket.on('new_quat', function (quat) {
m_trans.set_rotation(_obj, quat[1],quat[2],quat[3],quat[0])
console.log({quat:quat});
});
});
}
06 November 2016 00:35
Hello Will, nice chess app!
I attached files. Server and Clients my demo apps. Unfortunately the server code is lost, but I wrote it again.
Instruction:
1. To rewrite in JS files of clients, server IP addresses
2. To launch the server the "node dubina_server.js" command. If gave an error message, to set Socket.io the "npm install socket.io" command from the same directory.
3. We launch client_upr.html in the browser on the mobile device. In a window of the server data shall appear.
4. We launch dubina.html, we wait for loading, we twist the mobile device, we see result!
I will try to find time to make your chess multi-user
I attached files. Server and Clients my demo apps. Unfortunately the server code is lost, but I wrote it again.
Instruction:
1. To rewrite in JS files of clients, server IP addresses
2. To launch the server the "node dubina_server.js" command. If gave an error message, to set Socket.io the "npm install socket.io" command from the same directory.
3. We launch client_upr.html in the browser on the mobile device. In a window of the server data shall appear.
4. We launch dubina.html, we wait for loading, we twist the mobile device, we see result!
I will try to find time to make your chess multi-user
06 November 2016 04:14
Hope the exams went well
I have been poking away at this when I get time. Here is my server side code so far. Basically I have made an object to hold the beginning positions and copied it to another object to store the current changing positions.
I have Node.js running on an Ubuntu server here: http://bambinobot.com/
Currently it is just serving up the static chess app. It is showing the moving chess piece positions in the browser console.
My current to-do list:
Project on Github
I am not a pro coder so any help and advice is much appreciated!
I have been poking away at this when I get time. Here is my server side code so far. Basically I have made an object to hold the beginning positions and copied it to another object to store the current changing positions.
var express = require('express');
var app = express();
var serv = require('http').Server(app);
var objectAssign = require('object-assign');
var io = require('socket.io')(serv,{});
app.get('/',function(req, res) {
res.sendFile(__dirname + '/public/index.html');
});
app.use(express.static('public'));
serv.listen(2000);
console.log("Server started v101");
var SOCKET_LIST = {};
var PLAYER_LIST = {};
//Object with all set up positions
var RESET_POS = {
bkr: [-7,0,-7], //black
bkk: [-5,0,-7],
bkb: [-3,0,-7],
bk: [-1,0,-7],
bq: [1,0,-7],
bqb: [3,0,-7],
bqk: [5,0,-7],
bqr: [7,0,-7],
bkrp: [-7,0,-5], //pawns
bkkp: [-5,0,-5],
bkbp: [-3,0,-5],
bkp: [-1,0,-5],
bqp: [1,0,-5],
bqbp: [3,0,-5],
bqkp: [5,0,-5],
bqrp: [7,0,-5],
wkr: [-7,0,7], //white
wkk: [-5,0,7],
wkb: [-3,0,7],
wk: [-1,0,7],
wq: [1,0,7],
wqb: [3,0,7],
wqk: [5,0,7],
wqr: [7,0,7],
wkrp: [-7,0,5], //pawns
wkkp: [-5,0,5],
wkbp: [-3,0,5],
wkp: [-1,0,5],
wqp: [1,0,5],
wqbp: [3,0,5],
wqkp: [5,0,5],
wqrp: [7,0,5]
};
// Copy the RESET_POS values to a new object to store the changing positions
var CURRENT_POSITIONS = objectAssign({},RESET_POS);
console.log(CURRENT_POSITIONS);
setInterval(function(){
// loop here
},1000/25);
I have Node.js running on an Ubuntu server here: http://bambinobot.com/
Currently it is just serving up the static chess app. It is showing the moving chess piece positions in the browser console.
My current to-do list:
- Scale the chessboard size so positions are whole numbers.
Client should load CURRENT_POSITIONS from the server when logging in
Put socket.emit position into the main_canvas_move() function in the client code.
As the server chess piece position is updated, it should send update to the clients.
When the client is moving its piece, should disable receiving updated position from the server so they aren't fighting.
Periodically the server should loop through all the pieces to correct client positions in case of error.
Project on Github
I am not a pro coder so any help and advice is much appreciated!
06 November 2016 17:14
Live demo
It turned out to make! I attach .the exported project from the project manager and the server in the form of one JS file
Yes, there are bugs sometimes. But a spreadsheet because of too simple server. It is possible to finish logic.
It turned out to make! I attach .the exported project from the project manager and the server in the form of one JS file
Yes, there are bugs sometimes. But a spreadsheet because of too simple server. It is possible to finish logic.
Reply to post of user Will WelkerExaminations are still ended. But meanwhile I am free.
Hope the exams went well