In networking. Connection passing.

How much can I pass the connection from a message pulled from server.messages in for loop?
And why sometimes the connection doesn't send anything at all?

In severUpdate() I'm calling a function called hdl_messages() which is a function in the same file that will loop through server.messages and pass the message to an object called WorldEntity via the trigger function worldEntity.trigger(message), the trigger function will look the message and send the message again to another entity in the worldEntity object.

When the message reaches its destination and tries to use the connection object in the message object that was passed. the connection doesn't work at all. I had traced the execution until the connection.send(object _name='players-data' _value=this.players_data end) but in the client end, I don't receive any message with the name players-data.

before this object is sent, I send to the client his ID in the same manner, the client sends request-id then the same process goes on until the entity that has the ID sends it back to the client.

What I mean the first time I could send the ID, but the second time I couldn't send the players_data which is just a list. both the ID entity and the players-data entity have the same travel distance.

for ID:
serverUpdate() -> hdl_messages() -> worldEntity.trigger(message) -> entity_ID.trigger(message) -> connection.send(object _name='request-id' _value=this.ID end)

for players-data:
serverUpdate() -> hdl_messages() -> worldEntity.trigger(message) -> entity_players.trigger(message) -> connection.send(object _name='players-data' _value=this.players_data end)

Another question how can I link my desktop app with my account here?


As far as I know, when the server gets a message from a client, the message.connection is valid as long as the client is still connected. It should not matter the depth of functions that are present.

I am not clear what you mean by "link my desktop app" to your microStudio account. What kind of desktop app are you speaking of?

I just found out that my Chrome Browser is offering to install microStudio. Is that the desktop app you speak of?

Here's a networking tutorial that I just wrote if it helps.

Networking Tutorial

by desktop app I meant the microstudio engine desktop build, is there a way to link my account here to that program?

The networking issue is really annoying. I have tried threading, ordering, and status-checking, and still not working.
I first did the ordering, so that the ID and the players data are not sent after each other to the server directly, so now the ID request goes first then the server sends the ID, and then the players data request is sent after. but I've never received them at the client's end.
Then I made the threading so that each request is processed in its own thread then status-checking.
It feels like a bug encountered in Lua or it was the language, that you can't make more than five nested for loops. I don't know if it was a bug or you can't make five nested loops, but it was something that took quite a while to make everything work. I don't want to spend to much time on this one too.

Sounds like you are using Lua as the microStudio language. Maybe that's why there's a problem; networking works as expected for me but I am using microScript.

Can you create a minimal program in Lua that demonstrates the issue? That would help. It's very hard to find mysterious bugs deep in layers of code. I usually back up, simplify until it works again, then go forward.

And if it is a bug in microStudio or the Lua extension, creating a small demonstration of the problem is generally required.

I'm actually using microscript, I just made the bug example in Lua, the Lua bug I encountered in love2d, not in micro-studio.

I'll try to do as you say, I'll back up and simplify, and I may find the solution.

I have used love2d myself, and found programming in microscript easy because they have a similar api and such. Classes in microscript are better than the sort-of classes of lua in my humble option. Are you porting an existing project? I didn't know love2d had networking.

Though with love2d I was able to extend the lua with my own C code, that would make networking possible.

No, it's not importing of any sort, it's just a normal new project with networking the same one as you made your tutorial with, it's the basic project that is found in the getting started with networking in the docs of microstudio.
I have just made some complex code that in theory works, but it does not.
there's really something weird in networking, if everything is in the server file it will work perfectly but, if you divide it into complex classes and folder structure that is pleasant to see in the editor as everything is in its domain, the networking won't work, or it won't work as expected.
I will try to debug even more. if anything is new, I will post it here.

Hello, it's me again. I tried to do some debugging, and when I opened dev tools to see what the console may get, I found this error. players-data sending error, this error triggers whenever I send a request of players-data. any ideas of what is this?

Networking relay is working at the moment, I tested it by my running my tutorial as a game which can be done.

Hi, I have accepted your invite. Thanks! I am happy to work on it with you.

I see that while the server logs in the clients, they get their ID, but they don't get the list of other players. Looking into that.

There doesn't seem to be a way for us team members to communicate. I will respond in the DOC section of the project for now.

Post a reply



Validate your e-mail address to participate in the community