s-macke / voxelspace Goto Github PK
View Code? Open in Web Editor NEWTerrain rendering algorithm in less than 20 lines of code
Home Page: https://s-macke.github.io/VoxelSpace/VoxelSpace.html
License: MIT License
Terrain rendering algorithm in less than 20 lines of code
Home Page: https://s-macke.github.io/VoxelSpace/VoxelSpace.html
License: MIT License
Line 497 in 60d7ae1
Expected code may be:
screendata.canvas.width = window.innerWidth<800?800:window.innerWidth;
Why the 800px hard limit?
Do you know how the game/engine rolls the camera? Does the vertical line drawing function draw the line at an angle instead? Or does it render to a buffer and then rotate that? Or does it skew the image for a rough approximation of roll at low angles, like how this demo fakes moving the camera up and down by panning the image?
How can you calculate when to draw sprites (eg. Trees) that have an x and y coordinate on the map and a z offset from the terrain?
Lines 416 to 417 in 9477ff5
These lines should be swapped to implement the "Level of Detail".
When I download the project and execute tools/animations/run.sh, it says:
delete
anim
0
Traceback (most recent call last):
File "anim.py", line 181, in <module>
DrawFrontToBack(Point(670, 500 - i*16), 0, 120, 800, Point(670, 500 - i*16))
File "anim.py", line 161, in DrawFrontToBack
-height, -1./z*240., +100, pmap)
File "anim.py", line 86, in HorlineHidden
xi = math.floor(p1.x) & 1023
TypeError: unsupported operand type(s) for &: 'float' and 'int'
and when I try to fix this it using float(integer) it says:
delete
anim
0
Traceback (most recent call last):
File "anim.py", line 181, in <module>
DrawFrontToBack(Point(670, 500 - i*16), float(0), float(120), float(800), Point(670, 500 - i*16))
File "anim.py", line 161, in DrawFrontToBack
float(-height), -1./z*240., +100, pmap)
File "anim.py", line 86, in HorlineHidden
xi = math.floor(p1.x) & float(1023)
TypeError: unsupported operand type(s) for &: 'float' and 'float'
don't know how to fix this, please help.
Hi! There doesn't seem to be a license for this project. choosealicense.com explains some of your choices.
MIT is a very simple, do-whatever-you-want-but-give-credit license. The GPLv3 ensures that you get back modifications. If you chose the GPL, you might license the maps as CC BY or CC BY-SA 4.0, which are one-way compatible with the GPL (CC --> GPL).
Application loads the initial terrain fine but the second you click anywhere the camera flies into the ground and you can't do anything else.
Delta Force games will benefit greatly from running on a modern voxel engine in terms of higher resolution, widescreen, multi platform incl web, game controller support and even modding. Any plans in that direction?
Since your repo got on the hackernews front page: your draw loop uses window.setTimeout(..., 0)
, but this leads to rather jarring stutter. Replacing window.setTimeout(...)
with window.requestAnimationFrame(Draw)
lets the code run much smoother.
On a secondary note, a setTimeout with 0
as argument doesn't actually run "immediately"; it has 20 years of legacy baggage and depending on the browser you're basically guaranteed a minimum interval of 3 to 5 milliseconds instead (because in the 90s, not every browser could do immediate timeouts, and so the lower bound was capped. Then the spec folks went "we should formalize that behaviour" rather than not doing that...)
Nothing happens when using keyboard to control. Only mouse works.
No errors in the console, either.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.