Giter VIP home page Giter VIP logo

Comments (11)

shama avatar shama commented on July 25, 2024

You could write a generator that calculates using modular arithmetic. See this section of the docs: https://github.com/maxogden/voxel-engine#generating-voxel-worlds

Something like var partX = Math.floor(x % boundary); although to handle negative numbers, I recommend a library like this: https://github.com/hughsk/mod-loop

from voxel-engine.

greenlion avatar greenlion commented on July 25, 2024

I'm actually using SRTM data, so a simple generator function won't do. The data is mapped into tiles which make up the globe. I can coordinate positions using latitude and longitude so I basically need to see the other side of Greenwich when you approach the prime meridian.

Which means it is easy to just stream the area I need and it will just work, and I'm a dummy :)

Thanks :)

Is the mindflayer bot still the best example for streaming input?

from voxel-engine.

rachel-carvalho avatar rachel-carvalho commented on July 25, 2024

I'm actually trying to implement the exact same thing in voxel-mars (except with MOLA data). I also have tiles with chunks of world data (I've generated PNGs from raw .img files) and what I'm doing is using game.voxels.on('missingChunk') to generate each chunk based on pixel data from those images. And then I load each PNG tile as needed.

I have just started working (on a local branch) on world wrapping and what I'm doing is translate x -1, for instance, to the same latitude/longitude values as x MAX. I had started actually writing code to teleport the player to the correct x when he stepped into this zone, but it had a major impact on performance, so I'm considering just have the world repeat itself as many times as needed and not having only one X,Z coords mapped to one latitude/longitude. I wonder if that's going to be a problem for me in the future when I have multiple players and world interaction.

from voxel-engine.

shama avatar shama commented on July 25, 2024

Wow that is impressive @rachel-carvalho!

I was also building a voxel-mars but never finished it based on the MOLA data: https://gist.github.com/shama/92c94b257518dd9a5f63

It uses https://github.com/shama/voxel-tile to load the color/heightmap tiles. It tries to load the tiles at different Z based on how high up the player is. The goal being to render the entire planet when you're far enough away. Here is a screenshot: https://twitter.com/shamakry/status/348290172644892672 and https://twitter.com/shamakry/status/348283103908880384

Not sure if any of that code would be any use to you. Glad to see someone making a way more awesome voxel-mars! :D

from voxel-engine.

shama avatar shama commented on July 25, 2024

Oh and here is the part that infinitely repeats chunks, just a simple modulo: https://github.com/shama/voxel-tile/blob/master/index.js#L83

from voxel-engine.

rachel-carvalho avatar rachel-carvalho commented on July 25, 2024

It's a shame I didn't find it before, I'll definitely take a look at it and see what I learn from it.

I guess I'll just keep infinitely repeating the world and when I have multiple players and world interaction, I'll probably just work with those absolute coords, because each player will potentially have their own local offset from the starting point.

from voxel-engine.

greenlion avatar greenlion commented on July 25, 2024

I guess you could keep two sets of coordinates, one relative to each meridian. All you have to keep track of is which hemisphere the user is standing in. As they approach a meridian, you can determine if the chunk is on the other side and grab it appropriately. Then all you do is switch the hemisphere flag when you cross the meridian. All players then use game coordinates.

from voxel-engine.

rachel-carvalho avatar rachel-carvalho commented on July 25, 2024

Yeah, that's basically what I'm going to do, except I'll be able to use the modulo approach @shama mentioned, since my in-game coords are never negative (my 0,0 is at the top left of the map, instead of in the middle like latitude and longitude).

from voxel-engine.

kumavis avatar kumavis commented on July 25, 2024

Great discussion! - As mentioned above, I feel like this is an issue for implementation and not for the engine. Maybe we could start a Implementation FAQ on the wiki and add this to it.

from voxel-engine.

greenlion avatar greenlion commented on July 25, 2024

Hi,

I think an implementation FAQ is a good idea on working toward getting the
API document. It should be easy to look up exactly what options can be
passed into the game.

Also, would it make sense to document the core modules with JSDoc? If
someone did that (it would be a good way to learn the API) would people
mind keeping the JSDocs up to date when they make changes?

On Mon, Dec 30, 2013 at 11:19 AM, aaron [email protected] wrote:

Great discussion! - As mentioned above, I feel like this is an issue for
implementation and not for the engine. Maybe we could start a
Implementation FAQ on the wiki and add this to it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/91#issuecomment-31362773
.

from voxel-engine.

shama avatar shama commented on July 25, 2024

Oh yeah, btw @rachel-carvalho and @greenlion, feel free to jump into #voxel.js on irc.freenode.net. Where a lot of the voxel chat happens :)

from voxel-engine.

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.