Jump to content

Denis Kosher

Vintarian
  • Posts

    9
  • Joined

  • Last visited

About Denis Kosher

  • Birthday 12/17/1991

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Denis Kosher's Achievements

Berry Picker

Berry Picker (2/9)

1

Reputation

  1. But the thing is that there are plenty of game servers which are working from the sub-net. Therefore current solution is simply a workaround, and ideally developers need to add a way to manually specify public IP in the server configuration. By doing that - they will resolve an issue of master server knocking on sub-net IP door
  2. RESOLVED: So I've resolved an issue by reserving public IP at my internet services provider Therefore - vintage story server is not able host a server if you are a part of subdomain - to check it, go to your router and verify if your public IP listed there start from 10. (sites like myip and other ones will not help here, since they will show IP of the sub-domain entry point)
  3. @Rhyagelle, yes yes and yes. This issue started to occur only on Monday this week, and prior to that ~12 different players played on this server from different parts of the world. Now - nobody is able to connect.
  4. @Rhyagelle Yup, in server config I have port 42420, port forwarding is enabled for the same port, on the game side - trying to connect to the same port. When I've tried to connect from the same machine where the instance hosted, using 127.0.0.1 - connection was ok, but once I'm trying to connect using my public ip - nothing
  5. Got same error, in addition to that in server console I'm seeing message: Master server response status: bad Could not register to master server, master server says: port not open I've double checked port forwarding on my router and it's set to 42420 all protocols So my suspicion is that master server is using different port for some reason. ---- I've tried to enable Upnp and got this Message: And in router logs I'm seeing message: 2023-09-26 15:24:45 NAT NOTICE [20846] Virtual server created succeeded[ex-port:42420 ip: in-port:42420 protocol:all] So I guess forwarding rule creates ok, but, still not able to connect
  6. I've spent so much time working on that mod and reading game sources But I'm really glad that it's going to be simplified, thank you for awesome news, will be looking forward to see 1.18!
  7. Hi All, I've been working on the mod to add more map icons, and found it really challenging to add them. I've investigated this issue for a while, and was able to resolve them by changing game source code, but since there is no way to create pool request - posting details of investigation and suggested change here. Issue (RCA) Right now game works in the following way: Map layers are loaded as part of vsesssentials mod If player has mini-map loaded - game initializes texturesByIcon list, and once it's defined - it's not re-generated If mini-map is disabled - texturesByIcon list is initialized only when player opens map Therefore if modder wants to create a mod that adds more icons - this mod needs to inject icons between actions 1 and 2, which is not currently achievable. As an alternative you can try to copy logic from WaypintMapLayer.OnMapOpenedClient and try to add texture for your icon, but when I've tried this approach (please see code snipped below) - on the map my maps were shown as 100% transparent texture Code that I've used: public void AddIconTexture(String iconName) { if (_wpManager.texturesByIcon.ContainsKey(iconName)) { continue; } ImageSurface surface = new ImageSurface(Format.Argb32, size, size); Context ctx = new Context(surface); double scale = RuntimeEnv.GUIScale; int size = (int)(27 * scale); ctx.Operator = Operator.Clear; ctx.SetSourceRGBA(0, 0, 0, 0); ctx.Paint(); ctx.Operator = Operator.Over; _capi.Gui.Icons.DrawIcon(ctx, "wp" + iconName.UcFirst(), 1, 1, size - 2, size - 2, new double[] { 0, 0, 0, 1 }); _capi.Gui.Icons.DrawIcon(ctx, "wp" + iconName.UcFirst(), 2, 2, size - 4, size - 4, ColorUtil.WhiteArgbDouble); texturesByIcon[iconName] = new LoadedTexture(_capi, _capi.Gui.LoadCairoTexture(surface, false), (int)(20 * scale), (int)(20 * scale)); ctx.Dispose(); surface.Dispose(); _wpManager.OnMapOpenedClient(); } Solution In order to resolve this issue we need to - update WaypintMapLayer.OnMapOpenedClient so on each reload of the map - it will check if all of the icon textures are loaded, and if no, will generate missing ones (game sources, vsesentials): public override void OnMapOpenedClient() { if (texturesByIcon == null) { texturesByIcon = new Dictionary<string, LoadedTexture>(); } ImageSurface surface = null; Context ctx = null; ICoreClientAPI capi = api as ICoreClientAPI; double scale = RuntimeEnv.GUIScale; int size = (int)(27 * scale); foreach (var val in WaypointIcons) { if (texturesByIcon.ContainsKey(val)) { continue; } if (ctx == null) { surface = new ImageSurface(Format.Argb32, size, size); ctx = new Context(surface); } ctx.Operator = Operator.Clear; ctx.SetSourceRGBA(0, 0, 0, 0); ctx.Paint(); ctx.Operator = Operator.Over; capi.Gui.Icons.DrawIcon(ctx, "wp" + val.UcFirst(), 1, 1, size - 2, size - 2, new double[] { 0, 0, 0, 1 }); capi.Gui.Icons.DrawIcon(ctx, "wp" + val.UcFirst(), 2, 2, size - 4, size - 4, ColorUtil.WhiteArgbDouble); texturesByIcon[val] = new LoadedTexture(capi, capi.Gui.LoadCairoTexture(surface, false), (int)(20 * scale), (int)(20 * scale)); } if (ctx != null) { ctx.Dispose(); surface.Dispose(); } RebuildMapComponents(); } Questions I have two questions to the community: I'm a bit confused why same code in game sources, and copied to my mod gets different result (why when I use it - empty texture is rendered), maybe I'm missing something? Is there any way how we can suggest change above to @Tyron?
  8. Found solution for this problem - right now the only way to synchronize something between client and server (in this specific order) - is to use BlockEntity (there is ItemEntity class with same functionality, but I was not able to find a way how to use it): 1. You'll need to create block entity which will be used as mediator for data synchronization, and add field which will store item for synchronization (either as ItemSlot, either as HashMap of itemId and itemSlot): public class BEMyEntity : BlockEntity { private ItemSlot _itemForSynch; 2. Before UI is opened - populate this field from item, in the BlockEntity (I did it as part of OnHeldInteractStep method, when user clicks on Mediator object): public override bool OnHeldInteractStep(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel) { if (byEntity.World is IClientWorldAccessor) { ... Other logic } else { BEMyEntity bec = byEntity.World.BlockAccessor.GetBlockEntity(blockSel.Position) as BEMyEntity; if (bec != null) { bec.setItemForSynch(slot); } } 3. When text is changed - send packet to the server side copy of BlockEntity if (byEntity.World is IClientWorldAccessor) { GuiDialogBlockEntityTextInput dlg = new GuiDialogBlockEntityTextInput(Lang.Get("message"), bec.Pos, "", bec.Api as ICoreClientAPI, 500); dlg.OnTextChanged = (text) => { int packetId = (int)EnumSignPacketId.SaveText; using (MemoryStream ms = new MemoryStream()) { BinaryWriter writer = new BinaryWriter(ms); writer.Write(text); byte[] data = ms.ToArray(); (bec.Api as ICoreClientAPI).Network.SendBlockEntityPacket(bec.Pos.X, bec.Pos.Y, bec.Pos.Z, packetId, data); } }; dlg.OnCloseCancel = () => { int packetId = (int)EnumSignPacketId.SaveText; (bec.Api as ICoreClientAPI).Network.SendBlockEntityPacket(bec.Pos.X, bec.Pos.Y, bec.Pos.Z, packetId, null); }; dlg.TryOpen(); } 4. Add handler into blockEntity that will synchronize client and server side copy of items on package receive: public override void OnReceivedClientPacket(IPlayer player, int packetid, byte[] data) { string text = ""; if (packetid == (int)EnumSignPacketId.SaveText) { if (data != null) { using (MemoryStream ms = new MemoryStream(data)) { BinaryReader reader = new BinaryReader(ms); text = reader.ReadString(); if (text == null) text = ""; } if (text == null) text = ""; } if (_itemToSynch != null) { _itemToSynch.Itemstack.Attributes.SetString("name", text); } } if (packetid == (int)EnumSignPacketId.CancelEdit) { } }
  9. Hi guys, I'm trying to implement following logic: User puts item into active slot. Right clicks on specific block Pop-up asking for text entry is shown When pop-up content is saved (and only if) - save entered text into item, and block coordinates I've implemented it in the following way: if (!(byEntity.World is IClientWorldAccessor)) { return; } string prevName = _name == null ? "" : _name; BlockPos prevPos = _pos; GuiDialogBlockEntityTextInput dlg = new GuiDialogBlockEntityTextInput("Enter your text", bec.Pos, prevName, bec.Api as ICoreClientAPI, 500); dlg.OnTextChanged = (text) => { _pos = bec.Pos; _name = text; }; dlg.OnCloseCancel = () => { _name = prevName == "" ? null : _name; _pos = _prevPos; }; dlg.TryOpen(); But, this _name property is set only on Client's side, I've tried to use : slot.Itemstack.Attributes.SetString("name", _name); But they are also set only on client's side. So the question is - how can I send information from client's copy of an item to server's copy of an item?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.