Git Product home page Git Product logo

Comments (7)

jleahey avatar jleahey commented on July 24, 2024

Well documented. It's strange that it only happens at certain times of day, perhaps those are the times it's noticeable. It could have something to do with (float) --> (int) pixel conversions in world.draw(...).

from minicraft.

perimosocordiae avatar perimosocordiae commented on July 24, 2024

Where is this documented, for my future reference?

from minicraft.

jleahey avatar jleahey commented on July 24, 2024

I was saying you documented the bug well... Minicraft is woefully lacking in documentation mostly due to the way in which it was conceived.

Perhaps it wouldn't be a bad idea to document the genearl flow of the game for things like this...

from minicraft.

jleahey avatar jleahey commented on July 24, 2024

A quick check shows that casting is the issue

Changing:

        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                int posX = (int) ((i - cameraX) * tileSize);
                int posY = (int) ((j - cameraY) * tileSize);

To:

        int cameraPosX = (int) (cameraX * tileSize);
        int cameraPosY = (int) (cameraY * tileSize);
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                int posX = i * tileSize - cameraPosX;
                int posY = j * tileSize - cameraPosY;

Pushes the gapped tiles together, but also causes many other problems, because everything it being drawn using the one transition function from StockMethods.computeDrawLocationInPlace(...) so other things end up being "off by a pixel". This will require further review.

from minicraft.

jleahey avatar jleahey commented on July 24, 2024

I switched drawing to all floats and stumbled across this, kind of a cool style!:
Screen Shot 2012-12-31 at 5 46 40 PM

from minicraft.

perimosocordiae avatar perimosocordiae commented on July 24, 2024

Heh, nice! Maybe using doubles would fix it?

from minicraft.

jleahey avatar jleahey commented on July 24, 2024

Draw calls now simply have a round in them instead of an effective floor by the (int) call. This might slow things down a bit since it happens so often but for now it fixes this issue.

from minicraft.

Related Issues (17)

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.