Comments (11)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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)
- esprima-six module is not reachable anymore HOT 8
- Forcing master branch to render blocks HOT 2
- Large positions cause strange behavior, glitchly camera, falling through blocks, no rendering. HOT 2
- Async loading of chunks HOT 1
- Shading planned
- Do I need a backend server for this usage scenario? HOT 3
- Why not use requestAnimationFrame instead of setInterval ?
- How to regenerate terrain? HOT 1
- How to create a world with voxel that serves multi-player? HOT 1
- How to check whether or not the mouse pointer is locked in game or not. HOT 1
- setBlock() does not update canvas until mouse click HOT 1
- How to use RessourcePack textures in voxel.js ? HOT 1
- Runing the Voxel Engine..
- How to Fix Voxel Bugs
- textures don't work?
- Add TypeScript definitions
- document.getElementById("game") is not a Node HOT 1
- All textures are black
- voxeljs.com is now parked by a domain squatter HOT 2
- Is the website hacked? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from voxel-engine.