That looks pretty sweet.
Looks much better IMO
Looks much better IMO
Thanks
Yes, I also like it more that way.
Thanks
Yes, I also like it more that way.
Now that I added water, next thing was to make equipable items. Of course the behaviour of these items is also scripted in JavaScript. First thing I did was Jetpack! 8)
Here is a first demo of me flying the jetpack. It is by design not that easy to control - just like a real one
8W0heFVFiz4
By the way, this is how it is defined in Javascript:
function onInit(item) {
item.setGraphicMesh("Textures/item_placeholder.png");
item.setStackUpTo(1);
var useableItemTrait = new UseableItemTrait();
useableItemTrait.setCheckActiveFunction(isActive);
useableItemTrait.setWhileActiveFunction(whileActive);
useableItemTrait.setOnButtonPressFunction(onButtonPressed);
item.setTrait(useableItemTrait);
}
var active = false;
function isActive(world) {
return active;
}
function whileActive(world) {
var player = world.getPlayer();
if (player.isOnFloor()) {
world.getPlayer().setUseWalkBehaviour(true);
} else {
world.getPlayer().setUseWalkBehaviour(false);
var walkDirection = player.getWalkDirection();
var impulse = new Vector3f(walkDirection.x * 10, walkDirection.y * 20, walkDirection.z * 10);
var impulseXZ = new Vector3f(impulse.x, 0, impulse.z);
var velocity = player.getVelocity();
var velocityXZ = new Vector3f(velocity.x, 0, velocity.z);
//we limit the XZ speed a bit
if (velocityXZ.length() > 5) {
var velocityXZ_N = velocityXZ.normalize();
var a1 = impulseXZ.dot(velocityXZ_N);
var projection = velocityXZ_N.mult(a1);
impulseXZ.subtractLocal(projection);
impulse.set(impulseXZ.x, impulse.y, impulseXZ.z);
}
//the jetpack uses energy
if (impulse.y > 0) {
player.addEnergy(- 0.4);
}
if (player.getEnergy() < 1) {
impulse.y = 0;
}
player.applyImpulse(impulse);
}
}
function onButtonPressed(world) {
active = !active;
if (!active) {
world.getPlayer().setUseWalkBehaviour(true);
}
}
Next up: a personal Teleporter that allows to transport on top of the topmost block at the current position.
Now that I added water, next thing was to make equipable items. Of course the behaviour of these items is also scripted in JavaScript. First thing I did was Jetpack! 8)
Here is a first demo of me flying the jetpack. It is by design not that easy to control - just like a real one
8W0heFVFiz4
By the way, this is how it is defined in Javascript:
function onInit(item) {
item.setGraphicMesh("Textures/item_placeholder.png");
item.setStackUpTo(1);
var useableItemTrait = new UseableItemTrait();
useableItemTrait.setCheckActiveFunction(isActive);
useableItemTrait.setWhileActiveFunction(whileActive);
useableItemTrait.setOnButtonPressFunction(onButtonPressed);
item.setTrait(useableItemTrait);
}
var active = false;
function isActive(world) {
return active;
}
function whileActive(world) {
var player = world.getPlayer();
if (player.isOnFloor()) {
world.getPlayer().setUseWalkBehaviour(true);
} else {
world.getPlayer().setUseWalkBehaviour(false);
var walkDirection = player.getWalkDirection();
var impulse = new Vector3f(walkDirection.x * 10, walkDirection.y * 20, walkDirection.z * 10);
var impulseXZ = new Vector3f(impulse.x, 0, impulse.z);
var velocity = player.getVelocity();
var velocityXZ = new Vector3f(velocity.x, 0, velocity.z);
//we limit the XZ speed a bit
if (velocityXZ.length() > 5) {
var velocityXZ_N = velocityXZ.normalize();
var a1 = impulseXZ.dot(velocityXZ_N);
var projection = velocityXZ_N.mult(a1);
impulseXZ.subtractLocal(projection);
impulse.set(impulseXZ.x, impulse.y, impulseXZ.z);
}
//the jetpack uses energy
if (impulse.y > 0) {
player.addEnergy(- 0.4);
}
if (player.getEnergy() < 1) {
impulse.y = 0;
}
player.applyImpulse(impulse);
}
}
function onButtonPressed(world) {
active = !active;
if (!active) {
world.getPlayer().setUseWalkBehaviour(true);
}
}
Next up: a personal Teleporter that allows to transport on top of the topmost block at the current position.
Over the last couple of weeks I tweaked a lot of code to prepare Xcylin for a nearing alpha release. Though I’m still not completely happy with the optimizations as there are still some small lags from time to time - but I already have plans to counter them.
Recently I perfected the water spreading algorithm so that water now flows quite like it should. It is of course still an approximation of the real behaviour of water. Here you can see it in action:
UDODM_Lb1Gw
While experimenting with the water algorithm I realized that it would also be possible to create some sort of acid that burns through rock. So I made a small test of that and it worked as expected (without any change to the engine itself - yeah!). Only problem is that I didn’t add a level of saturation.
So my first test with a cube of acid just burned all the way down to the bottom of the level. My next thought was to build a pool with a floor that won’t be corroded by the acid and it turned out nicely. Here you can see how that looked like after some time:
http://xcylin.com/screenshots/screenshot041.png
Of course also in this case the acid never would have stoped burning through the rocks
Over the last couple of weeks I tweaked a lot of code to prepare Xcylin for a nearing alpha release. Though I’m still not completely happy with the optimizations as there are still some small lags from time to time - but I already have plans to counter them.
Recently I perfected the water spreading algorithm so that water now flows quite like it should. It is of course still an approximation of the real behaviour of water. Here you can see it in action:
UDODM_Lb1Gw
While experimenting with the water algorithm I realized that it would also be possible to create some sort of acid that burns through rock. So I made a small test of that and it worked as expected (without any change to the engine itself - yeah!). Only problem is that I didn’t add a level of saturation.
So my first test with a cube of acid just burned all the way down to the bottom of the level. My next thought was to build a pool with a floor that won’t be corroded by the acid and it turned out nicely. Here you can see how that looked like after some time:
http://xcylin.com/screenshots/screenshot041.png
Of course also in this case the acid never would have stoped burning through the rocks
Nice video.
Though the “water” seems to be more of a jelly. While watching the video, I would have expected that the bottom layer flows faster than it currently does. The water stacks a block and then goes to the next one. Non-intuitive. Also the water in the container emptied itself vertically before horizontally.
Will You be keeping it like that ?
Your jumping seems really “floaty”. Are you going for a low gravity effect? If you are, it seems good. But if you aren’t that would get old really fast, no offense!
I second the jelly water. Also the stacking. The container emptying thing is I think just an effect of these things though. Change them and I think it’ll be a lot smoother. Still looks very nice though.
Nice video.
Though the “water” seems to be more of a jelly. While watching the video, I would have expected that the bottom layer flows faster than it currently does. The water stacks a block and then goes to the next one. Non-intuitive. Also the water in the container emptied itself vertically before horizontally.
Will You be keeping it like that ?
You are right, I’m not fully happy with the jumping either since I let the physics engine handle it (and yes g is at 9.81m/s^2). On the other hand I want to have physical forces that can be applied to the player. You see, the core problem is that a normal person is not able to jump two meters high - so it feels unrealistic even it is in fact correct.
Maybe I have to fake some faster motion by applying any additional force or completely controlling the velocity by myself (as I already do with x/z-movement). I then would have to add the applied forces myself.
Your jumping seems really “floaty”. Are you going for a low gravity effect? If you are, it seems good. But if you aren’t that would get old really fast, no offense!
The water moves not in real time but with the speed of the physics engine (60FPS at the moment) but this is by design to keep the used CPU cycles at a reasonable level. And you are right, that makes it look a bit like jelly. But you have to understand that the player can place water anywhere(!) in the (currently) 50x50x32x32x128 blocks world and then the simulation has to take care that it behaves in a way like water. It is also important to know that each change in water level makes a retesselation of the given sourroundings necessary, so this is not a simple process. But I agree that it is not 100% accurate - the question is, is it possible to make it more accurate without making it unreasonable complex and slow? If you compare it to Minecraft for example, then you see that water is also not simulated in any completely accurate way, just because it would most likely not be feasible.
And to explain why the water moves vertically first is simply because gravity is the bigger force here. I implemented it to first check if a block is below the water and if so the water should flow down, then if there is still water in the current block it would flow in the x/z-directions. You can check the javscript code below that I currently use - any suggestions are very welcome
The water javascript code: http://pastebin.java-gaming.org/5c2af2e3581
The onChange() function is called every time when a block is changed that is a neighbor of this block or the block at the position of this block has been changed.
You get four parameters:
- world - the world to access all world relevant stuff (like terrain, player, npc …)
- blockInstance - the instance of this class that is adjacent to the change
- blockInstanceBefore - the instance of a block before it was changed
- blockInstanceNow - the instance of a block after it has been changed
Soon when we release the alpha version, you can play around with the block definitions for yourself to optimize these things if you like
I second the jelly water. Also the stacking. The container emptying thing is I think just an effect of these things though. Change them and I think it’ll be a lot smoother. Still looks very nice though.
Water should simultaneously flow to the bottom and right, now the vertical flows faster then horizontal, maybe you could speed one up or slow the other down.
To overcome the tessellation problem, you could create a flowing (opaque) effect, so you have less updates when water changes place.
You are right, I’m not fully happy with the jumping either since I let the physics engine handle it (and yes g is at 9.81m/s^2). On the other hand I want to have physical forces that can be applied to the player. You see, the core problem is that a normal person is not able to jump two meters high - so it feels unrealistic even it is in fact correct.
Maybe I have to fake some faster motion by applying any additional force or completely controlling the velocity by myself (as I already do with x/z-movement). I then would have to add the applied forces myself.
Looks good but unfortunately the voxel design is getting beaten half to death Lol.
Fortunately for you must of them don’t make it but this one actually seems more unique than shitecraft