Closed Assambra closed 10 months ago
@Assambra could you give me your settings.xml file?
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.tvd12.com/schema/ezyfox/settings ezy-settings-1.0.0.xsd" xmlns="http://www.tvd12.com/schema/ezyfox/settings">
<node-name>gs.assambra.com</node-name>
<max-sessions>30000</max-sessions>
<thread-pool-size>
<statistics>1</statistics>
<stream-handler>8</stream-handler>
<socket-data-receiver>8</socket-data-receiver>
<system-request-handler>8</system-request-handler>
<extension-request-handler>8</extension-request-handler>
<socket-disconnection-handler>2</socket-disconnection-handler>
<socket-user-removal-handler>3</socket-user-removal-handler>
</thread-pool-size>
<streaming>
<enable>true</enable>
</streaming>
<socket>
<port>3005</port>
<address>178.63.237.228</address>
<active>true</active>
<ssl-active>false</ssl-active>
<ssl-type>CUSTOMIZATION</ssl-type>
<ssl-handshake-timeout>300</ssl-handshake-timeout>
<tcp-no-delay>true</tcp-no-delay>
<max-request-size>4096</max-request-size>
<writer-thread-pool-size>8</writer-thread-pool-size>
<codec-creator>com.tvd12.ezyfox.codec.MsgPackCodecCreator</codec-creator>
</socket>
<udp>
<port>2611</port>
<address>178.63.237.228</address>
<active>true</active>
<max-request-size>1024</max-request-size>
<channel-pool-size>8</channel-pool-size>
<handler-thread-pool-size>5</handler-thread-pool-size>
</udp>
<administrators>
<administrator>
<username>admin</username>
<password>admin</password>
<access-token>admin</access-token>
</administrator>
</administrators>
<session-management>
<session-max-idle-time>60</session-max-idle-time>
<session-max-waiting-time>30</session-max-waiting-time>
<session-max-request-per-second>
<value>200</value>
<action>DISCONNECT_SESSION</action>
</session-max-request-per-second>
</session-management>
<zones>
<zone>
<name>free-game-server</name>
<config-file>free-game-server-zone-settings.xml</config-file>
<active>true</active>
</zone>
<zone>
<name>free-account-server</name>
<config-file>free-account-server-zone-settings.xml</config-file>
<active>true</active>
</zone>
</zones>
<!-- http://localhost:8080/schema/ezyfox/settings/ -->
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.tvd12.com/schema/ezyfox/settings ezy-zone-settings-1.0.0.xsd" xmlns="http://www.tvd12.com/schema/ezyfox/settings">
<max-users>10000</max-users>
<streaming>
<enable>true</enable>
</streaming>
<user-management>
<allow-guest-login>true</allow-guest-login>
<guest-name-prefix>Guest#</guest-name-prefix>
<user-max-idle-time>30</user-max-idle-time>
<max-session-per-user>15</max-session-per-user>
<user-name-pattern>^[a-zA-Z0-9_.#]{3,64}$</user-name-pattern>
</user-management>
<applications>
<application>
<name>free-game-server</name>
<folder>free-game-server-app-entry</folder>
<entry-loader>com.assambra.game.app.AppEntryLoader</entry-loader>
<config-file>config/config.properties</config-file>
</application>
</applications>
<plugins>
<plugin>
<name>free-game-server</name>
<folder>free-game-server-plugin</folder>
<priority>-1</priority>
<entry-loader>com.assambra.game.plugin.PluginEntryLoader</entry-loader>
<config-file>config/config.properties</config-file>
<listen-events>
<event>USER_LOGIN</event>
<event>USER_ADDED</event>
<event>USER_REMOVED</event>
</listen-events>
</plugin>
</plugins>
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.tvd12.com/schema/ezyfox/settings ezy-zone-settings-1.0.0.xsd" xmlns="http://www.tvd12.com/schema/ezyfox/settings">
<max-users>10000</max-users>
<streaming>
<enable>true</enable>
</streaming>
<user-management>
<allow-guest-login>true</allow-guest-login>
<guest-name-prefix>Guest#</guest-name-prefix>
<user-max-idle-time>30</user-max-idle-time>
<max-session-per-user>15</max-session-per-user>
<user-name-pattern>^[a-zA-Z0-9_.#]{3,64}$</user-name-pattern>
</user-management>
<applications>
<application>
<name>free-account-server</name>
<folder>free-account-server-app-entry</folder>
<entry-loader>com.assambra.account.app.AppEntryLoader</entry-loader>
<config-file>config/config.properties</config-file>
</application>
</applications>
<plugins>
<plugin>
<name>free-account-server</name>
<folder>free-account-server-plugin</folder>
<priority>-1</priority>
<entry-loader>com.assambra.account.plugin.PluginEntryLoader</entry-loader>
<config-file>config/config.properties</config-file>
<listen-events>
<event>USER_LOGIN</event>
<event>USER_ADDED</event>
<event>USER_REMOVED</event>
</listen-events>
</plugin>
</plugins>
<address>178.63.237.228</address>
is a loopback address why don't you want use <address>0.0.0.0</address>
?
I see you have the repo: https://github.com/Assambra/Free-MMORPG are you asking for it?
Yes it is for this repo, i insert the ip only for testing it accours with 0.0.0.0 too.
@Assambra I haven't seen you create MMORoom
and add MMOPlayer
to MMORoom
, could you show me?
RoomService.java
public MMOPlayer addUserToRoom(EzyUser user, Long roomId)
{
MMOPlayer player = new MMOPlayer(user.getName());
globalPlayerManager.addPlayer(player);
MMORoom room = (MMORoom)globalRoomManager.getRoom(roomId);
room.addPlayer(player);
player.setCurrentRoomId(roomId);
return player;
}
The room are created in /config/WorldConfig.java
@Assambra could you change to this one:
// class RoomService
public void setPlayerPosition(MMOPlayer player, Vec3 nextPosition) {
MMOGridRoom currentRoom = (MMOGridRoom) getCurrentRoom(player);
currentRoom.setPlayerPosition(player, nextPosition);
logger.info("near by players: {}", player.getNearbyPlayerNames());
}
And run and check logs? If you want to add more log, you can clone game-box and add more logs
it means roomService.setPlayerPosition
wasn't called, may be client not send playerInput
and play
command could you check it?
Play command should work it sends spawn command back to the user and inform all nearby clients to instantiate the characters/prefabs/Player model there wouldn't be visible without, and yesterday i enable a logger on Command it reseives input data. But in short i need more time to investigate, but its wired behaviour only on the live server not local...
Can you run the client and insert in both socket config variables Assets/Free-Client/Data/Network the ip: 178.63.237.228:3005 instead of 127.0.0.1 only to test if it happends not only here on my side? I didn't have a normal DSL cable internet it works over cable/tv wire maybe
I run free-game-server-startup/ClientTest
connect to ClientTest
but I got 2023-10-20 17:56:54.625 [main] INFO c.t.e.c.h.EzyDisconnectionHandler handle disconnection, reason: UNAUTHORIZED
maybe you need to give me an account
Account: Musmacher 123456 or/and Account Assambra 123456 but you are able to create a new account on login screen "Need account?"
How can I create my account? I'm not seeing on the README: https://github.com/Assambra/Free-MMORPG/tree/main
I mean what's web url?
I've just called play but nothing happen could you check log?
package com.assambra.game.test;
import com.assambra.game.ApplicationStartup;
import com.assambra.game.app.constant.Commands;
import com.tvd12.ezyfox.core.constant.EzyResponseCommands;
import com.tvd12.ezyfox.entity.EzyArray;
import com.tvd12.ezyfox.entity.EzyData;
import com.tvd12.ezyfox.entity.EzyObject;
import com.tvd12.ezyfox.factory.EzyEntityFactory;
import com.tvd12.ezyfoxserver.client.EzyClient;
import com.tvd12.ezyfoxserver.client.EzyClients;
import com.tvd12.ezyfoxserver.client.EzyTcpClient;
import com.tvd12.ezyfoxserver.client.config.EzyClientConfig;
import com.tvd12.ezyfoxserver.client.constant.EzyCommand;
import com.tvd12.ezyfoxserver.client.entity.EzyApp;
import com.tvd12.ezyfoxserver.client.handler.EzyAppAccessHandler;
import com.tvd12.ezyfoxserver.client.handler.EzyHandshakeHandler;
import com.tvd12.ezyfoxserver.client.handler.EzyLoginSuccessHandler;
import com.tvd12.ezyfoxserver.client.request.EzyAppAccessRequest;
import com.tvd12.ezyfoxserver.client.request.EzyLoginRequest;
import com.tvd12.ezyfoxserver.client.request.EzyRequest;
import com.tvd12.ezyfoxserver.client.setup.EzyAppSetup;
import com.tvd12.ezyfoxserver.client.setup.EzySetup;
import com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop;
public class ClientTest {
public static void main(String[] args) {
EzyClientConfig config = EzyClientConfig.builder()
.zoneName(ApplicationStartup.ZONE_APP_NAME)
.build();
EzyClient client = new EzyTcpClient(config);
setupClient(client);
EzyClients.getInstance().addClient(client);
client.connect("178.63.237.228", 3005);
EzyMainEventsLoop mainEventsLoop = new EzyMainEventsLoop();
mainEventsLoop.start(5);
}
public static void setupClient(EzyClient client) {
EzySetup setup = client.setup();
setup.addDataHandler(EzyCommand.HANDSHAKE, new EzyHandshakeHandler() {
@Override
protected EzyRequest getLoginRequest() {
return new EzyLoginRequest(
ApplicationStartup.ZONE_APP_NAME,
"Assambra",
"123456"
);
}
});
setup.addDataHandler(EzyCommand.LOGIN, new EzyLoginSuccessHandler() {
@Override
protected void handleLoginSuccess(EzyData responseData) {
client.send(new EzyAppAccessRequest(ApplicationStartup.ZONE_APP_NAME));
}
});
setup.addDataHandler(EzyCommand.APP_ACCESS, new EzyAppAccessHandler() {
@Override
protected void postHandle(EzyApp app, EzyArray data) {
app.send(Commands.HELLO, EzyEntityFactory.EMPTY_OBJECT);
app.send(Commands.HELLO, EzyEntityFactory.newObjectBuilder()
.append("nickName", "Dzung")
.build());
app.send(Commands.GO, EzyEntityFactory.EMPTY_OBJECT);
app.send(Commands.GO, EzyEntityFactory.newObjectBuilder()
.append("nickName", "Dzung")
.build());
app.send(
"createCharacter",
EzyEntityFactory.newObjectBuilder()
.append("name", "Dung")
.append("sex", "male")
.append("race", "test")
.append("model", "test")
.build()
);
}
});
EzyAppSetup appSetup = setup.setupApp(ApplicationStartup.ZONE_APP_NAME);
appSetup.addDataHandler(EzyResponseCommands.ERROR, (app, data) -> {
System.out.println("error: " + data);
});
appSetup.addDataHandler(Commands.HELLO, (app, data) -> {
System.out.println("hello: " + data);
});
appSetup.addDataHandler(Commands.GO, (app, data) -> {
System.out.println("hello: " + data);
});
appSetup.addDataHandler("characterList", (app, data) -> {
System.out.println("characterList: " + data);
});
appSetup.addDataHandler("createCharacter", (app, data) -> {
System.out.println("createCharacter: " + data);
EzyObject objData = (EzyObject) data;
app.send(
"play",
EzyEntityFactory
.newObjectBuilder()
.append("characterId", objData.get("characterId", Integer.class))
.build()
);
});
}
}
2023-10-20 11:13:22.374 [ezyfox-extension-request-handler-20-3] INFO c.a.g.app.controller.GameController User Assambra try to cheat. You can not play a characterId that the account not owns.
The Idea is if someone logged in and send a CharacterId with the Play command that the account dosen`t owns, he can play other accounts characters. It have to be at least a character that is connected in the database with the Ezy user/ accountID
now you raise exceptions
@Assambra for command play, if user has already played, I think you should return something like gameId
to help user reconnect, my source code:
package com.assambra.game.test;
import com.assambra.game.ApplicationStartup;
import com.assambra.game.app.constant.Commands;
import com.tvd12.ezyfox.core.constant.EzyResponseCommands;
import com.tvd12.ezyfox.entity.EzyArray;
import com.tvd12.ezyfox.entity.EzyData;
import com.tvd12.ezyfox.entity.EzyObject;
import com.tvd12.ezyfox.factory.EzyEntityFactory;
import com.tvd12.ezyfoxserver.client.EzyClient;
import com.tvd12.ezyfoxserver.client.EzyClients;
import com.tvd12.ezyfoxserver.client.EzyTcpClient;
import com.tvd12.ezyfoxserver.client.config.EzyClientConfig;
import com.tvd12.ezyfoxserver.client.constant.EzyCommand;
import com.tvd12.ezyfoxserver.client.entity.EzyApp;
import com.tvd12.ezyfoxserver.client.handler.EzyAppAccessHandler;
import com.tvd12.ezyfoxserver.client.handler.EzyHandshakeHandler;
import com.tvd12.ezyfoxserver.client.handler.EzyLoginSuccessHandler;
import com.tvd12.ezyfoxserver.client.request.EzyAppAccessRequest;
import com.tvd12.ezyfoxserver.client.request.EzyLoginRequest;
import com.tvd12.ezyfoxserver.client.request.EzyRequest;
import com.tvd12.ezyfoxserver.client.setup.EzyAppSetup;
import com.tvd12.ezyfoxserver.client.setup.EzySetup;
import com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop;
public class ClientTest {
public static void main(String[] args) {
EzyClientConfig config = EzyClientConfig.builder()
.zoneName(ApplicationStartup.ZONE_APP_NAME)
.build();
EzyClient client = new EzyTcpClient(config);
setupClient(client);
EzyClients.getInstance().addClient(client);
client.connect("178.63.237.228", 3005);
EzyMainEventsLoop mainEventsLoop = new EzyMainEventsLoop();
mainEventsLoop.start(5);
}
public static void setupClient(EzyClient client) {
EzySetup setup = client.setup();
setup.addDataHandler(EzyCommand.HANDSHAKE, new EzyHandshakeHandler() {
@Override
protected EzyRequest getLoginRequest() {
return new EzyLoginRequest(
ApplicationStartup.ZONE_APP_NAME,
"Assambra",
"123456"
);
}
});
setup.addDataHandler(EzyCommand.LOGIN, new EzyLoginSuccessHandler() {
@Override
protected void handleLoginSuccess(EzyData responseData) {
client.send(new EzyAppAccessRequest(ApplicationStartup.ZONE_APP_NAME));
}
});
setup.addDataHandler(EzyCommand.APP_ACCESS, new EzyAppAccessHandler() {
@Override
protected void postHandle(EzyApp app, EzyArray data) {
app.send(Commands.HELLO, EzyEntityFactory.EMPTY_OBJECT);
app.send(Commands.HELLO, EzyEntityFactory.newObjectBuilder()
.append("nickName", "Dzung")
.build());
app.send(Commands.GO, EzyEntityFactory.EMPTY_OBJECT);
app.send(Commands.GO, EzyEntityFactory.newObjectBuilder()
.append("nickName", "Dzung")
.build());
app.send(
"createCharacter",
EzyEntityFactory.newObjectBuilder()
.append("name", "Dung")
.append("sex", "male")
.append("race", "test")
.append("model", "test")
.build()
);
}
});
EzyAppSetup appSetup = setup.setupApp(ApplicationStartup.ZONE_APP_NAME);
appSetup.addDataHandler(EzyResponseCommands.ERROR, (app, data) -> {
System.out.println("error: " + data);
});
appSetup.addDataHandler(Commands.HELLO, (app, data) -> {
System.out.println("hello: " + data);
});
appSetup.addDataHandler(Commands.GO, (app, data) -> {
System.out.println("hello: " + data);
});
appSetup.addDataHandler("characterList", (app, data) -> {
// System.out.println("characterList: " + data);
EzyArray characterList = (EzyArray) data;
if (characterList.size() > 0) {
System.out.println("start to play");
app.send(
"play",
EzyEntityFactory
.newObjectBuilder()
.append(
"characterId",
characterList
.get(0, EzyArray.class)
.get(0, Integer.class))
.build()
);
}
});
appSetup.addDataHandler("createCharacter", (app, data) -> {
System.out.println("createCharacter: " + data);
EzyObject objData = (EzyObject) data;
String result = objData.get("result");
if ("name_already_in_use".equals(result)) {
app.send("characterList");
} else {
app.send(
"play",
EzyEntityFactory
.newObjectBuilder()
.append("characterId", objData.get("characterId", Integer.class))
.build()
);
}
});
appSetup.addDataHandler("play", (app, data) -> {
System.out.println("play: " + data);
});
}
}
"I mean what's web url?" do you mean websocket if yes it isnt enabled else it should be gs.assambra.com
"for command play, if user has already played, I think you should return something like gameId"
like a unique session token ? Maybe i dont understand what need to be happend under the hood with reconnecting it was on the list for later to investigate the reconnect problem :)
I have another problem on the NetworkManagerAccount it happends one time on start: NetworkManagerAccount.Update () (at Assets/Free-Client/Scripts/Managers/NetworkManagerAccount.cs:40)
38 private void Update()
39 {
40 EzyClients.getInstance()
41 .getClient(socketConfigVariable.Value.ZoneName)
42 .processEvents();
43 }
InvalidCastException: Specified cast is not valid. (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
com.tvd12.ezyfoxserver.client.support.EzySocketProxy+<>c__DisplayClass52_0`1[T].
@Assambra Could you resolve by yourself or need my help?
this is another error in need help with. The main issue i still there too i try now to get information and log every step and hope to find the issue.
@Assambra could you change https://github.com/Assambra/Free-MMORPG/blob/main/Free-Client/Assets/Free-Client/Scripts/Managers/NetworkManagerGame.cs#L65-L67 to:
OnLoginSuccess<Object>(OnLoginSucess);
OnLoginError<Object>(OnLoginError);
OnAppAccessed<EzyArray>(OnAppAccessed);
The error log report error here cause by casting: https://github.com/youngmonkeys/ezyfox-server-csharp-client/blob/master/support/EzySocketProxy.cs#L271 could you place a breakpoint?
Excuse me, is the logger disabled by default or some value in settings? On the deploy the server local and remote no logger.info() are shown. only in IDE Server it works. Thats the reason from earlyer i dont get any logs as you ask for.
@Assambra are you running by free-game-server-startup or you download ezyfox-server and run?
Ah you have settings.xml
so I guess you're running by ezyfox-server
could you give me your logback.xml
file?
@tvd12 do you mean the main issue or now with the logger?
Logger issue: it works only on IDE IntellJ with startup but not in the downloaded deployed servers local and remote.
Main issue: Both of them i descriped in the main issue on top, it works on the local server with the downloaded and deployed server also in the IDE with startup, but not on the uploaded remote server it stops client to send positions data after amount of time.
logback.xml
<configuration>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} %msg%n
</pattern>
</encoder>
</appender>
<appender name="fileRolling" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/ezyfox-server.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/ezyfox-server.log.%d{yyyy-MM-dd}</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} %msg%n
</pattern>
</encoder>
</appender>
<appender name="file" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="fileRolling" />
</appender>
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</root>
</configuration>
@Assambra I mean logger. Are you running on ubuntu by rung ./console.sh
or ./start-service.sh ; tail -f logs/ezyfox-server.log
?
I'm thinking to support you directly by using https://anydesk.com/en by try to use github issue first
Excuse me i dont wanted to messy up your git hub issues :(
yes, ./console.sh and on windows batch file console.bat
do you have some alias to invite you?
@Assambra do you have a facebook account? If you have could you chat via page https://www.facebook.com/youngmonkeys.org?
Ok i found now a solution that dont breaks position updates after time but i dont happy with it because i want use udp for position updates because its faster and smaller messages.
I dont now why it happends only if i have enabled useUdp.
Let us continue via discord
Some update about the problem, my internet provider use ipv6 only to reach the internet maybe they translate it to ipv4 under the hood and this cause problems. So needed to order a extra option vodafone call it "dual stack" so now that i have or can use internet over ipv4 direct to reach the internet. It wasn't a problem from the server, ezyfox or something else. I wrote it here that if someone else get some wird behaviour. @tvd12 Thank you to help me and you can close the issue.
Describe the bug I have strange behavior when I deploy the server and load it onto an external server and let it run. After about 10-15 seconds, the client will not receive any position data, but the server will continue to receive input data. I use the game box and can't log whether the error is that the messages are not being sent correctly or it's the server, e.g. due to packet drop/loss, firewall. No error message is output on the server and or client. The error does not occur when the server is tested in the IDE or on a local deployed Server on my PC.
To Reproduce Steps to reproduce the behavior: I don't know how to reproduce it, or what additional information will help to reproduce this behaviour
Expected behavior The client should allways reseive position updates from the Server.
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Server (please complete the following information):
Additional context Of course, it cannot be ruled out that it is the server or a setting from the host, for example. Firewall, incorrectly set route or something else. But I'm really confused as to where I can look for the error or how I can debug it.