Coder Social home page Coder Social logo

Crash at startup about truecraft HOT 12 CLOSED

WhyNotHugo avatar WhyNotHugo commented on September 28, 2024 1
Crash at startup

from truecraft.

Comments (12)

ddevault avatar ddevault commented on September 28, 2024

Does this happen consistently? Can you describe reproduction steps in more detail?

from truecraft.

WhyNotHugo avatar WhyNotHugo commented on September 28, 2024

I can reproduce this consistently: it happens every single time. Steps are (sorry if this is stupidly verbose, but I just in case):

  • Open game.
  • "Play offline".
  • "Singleplayer".
  • "New world".
  • Enter some random name.
  • Click that world, create.
  • Select that world, play.
  • The launcher says "Generating world..." for a bit, then "Simulating world..."
  • The launcher hides, screen flashes (like something draws for a single frame or something)
  • The launcher reappears.

Selecting a pre-existing world has the same result.

I believe these dependencies are relevant:

  • mono: 5.0.0.100
  • gtk2: 2.24.31
  • gtk-sharp-2: 2.12.42
  • sdl_mixer: 1.2.12
  • webkitgtk2: 2.4.11-6

I also tried deleting ~/.config/truecraft.

from truecraft.

ddevault avatar ddevault commented on September 28, 2024

I can reproduce. Will look into it.

from truecraft.

BearzRobotics avatar BearzRobotics commented on September 28, 2024

I've been getting the same error as well. When I try to just run the client I got this as an output.

Unhandled Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at TrueCraft.Client.Program.Main (System.String[] args) [0x0001c] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at TrueCraft.Client.Program.Main (System.String[] args) [0x0001c] in :0

from truecraft.

tugh avatar tugh commented on September 28, 2024

I'm having the same issue with @hobarrera

from truecraft.

erherhh4herh avatar erherhh4herh commented on September 28, 2024

same issue with @BearzRobotics
i think this game is dead. too bad prob no fix.

from truecraft.

ddevault avatar ddevault commented on September 28, 2024

Send me a patch and I'll merge it.

from truecraft.

flibitijibibo avatar flibitijibibo commented on September 28, 2024

Ended up figuring this out by accident. The fast path for HandleChunkData seems to assume the chunk size when it may, for example, only have block IDs without metadata, light, or sky light. This fixes the crash for me, but I'm guessing the packet is supposed to have all of these things...?

diff --git a/TrueCraft.Client/Handlers/ChunkHandlers.cs b/TrueCraft.Client/Handlers/ChunkHandlers.cs
index 254299f..ede145a 100644
--- a/TrueCraft.Client/Handlers/ChunkHandlers.cs
+++ b/TrueCraft.Client/Handlers/ChunkHandlers.cs
@@ -52,16 +52,31 @@ namespace TrueCraft.Client.Handlers
                 && packet.Height == Chunk.Height
                 && packet.Depth == Chunk.Depth) // Fast path
             {
+                // Chunk data offsets
+                int metadataOffset = chunk.Data.Length;
+                int lightOffset = metadataOffset + chunk.Metadata.Length;
+                int skylightOffset = lightOffset + chunk.BlockLight.Length;
+
                 // Block IDs
                 Buffer.BlockCopy(data, 0, chunk.Data, 0, chunk.Data.Length);
                 // Block metadata
-                Buffer.BlockCopy(data, chunk.Data.Length, chunk.Metadata.Data, 0, chunk.Metadata.Data.Length);
+                if (metadataOffset < data.Length)
+                {
+                    Buffer.BlockCopy(data, metadataOffset,
+                        chunk.Metadata.Data, 0, chunk.Metadata.Data.Length);
+                }
                 // Block light
-                Buffer.BlockCopy(data, chunk.Data.Length + chunk.Metadata.Data.Length,
-                    chunk.BlockLight.Data, 0, chunk.BlockLight.Data.Length);
+                if (lightOffset < data.Length)
+                {
+                    Buffer.BlockCopy(data, lightOffset,
+                        chunk.BlockLight.Data, 0, chunk.BlockLight.Data.Length);
+                }
                 // Sky light
-                Buffer.BlockCopy(data, chunk.Data.Length + chunk.Metadata.Data.Length + chunk.BlockLight.Data.Length,
-                    chunk.SkyLight.Data, 0, chunk.SkyLight.Data.Length);
+                if (skylightOffset < data.Length)
+                {
+                    Buffer.BlockCopy(data, skylightOffset,
+                        chunk.SkyLight.Data, 0, chunk.SkyLight.Data.Length);
+                }
             }
             else // Slow path
             {

from truecraft.

ddevault avatar ddevault commented on September 28, 2024

Can you send this as a pull request instead of a diff thrown into a commit? You can email me a patch if you want, too.

from truecraft.

flibitijibibo avatar flibitijibibo commented on September 28, 2024

Done: #282

from truecraft.

erherhh4herh avatar erherhh4herh commented on September 28, 2024

Using latest commit still warrants the same effect. However, I want to note that this happens regardless of offline, or online mode and whether or not I load an already generated world. I am also compiling on VS 2017. Does the same with the precompiled binaries available on the website, with no errors.

from truecraft.

lanodan avatar lanodan commented on September 28, 2024

Weird, on my side it runs fine.

  • Gentoo Linux
  • Mono 5.2.0.196

Do you actually have the same error?

from truecraft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.