Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Qon

Pages: 1 2 [3] 4 5 ... 8
31
Troubleshooting & Bug Reports / Re: The v1.22 beta bug report thread!
« on: October 27, 2013, 02:04:25 am »
Code: [Select]
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I'm trying to build endless fraqtals which means heavy usage of the *3D() functions.
I'm running this sqript (which is a work in progress) and when I get down to y=-500 or something like that the BV qlient qrashes.
The qomputer voxel should have millions or billions of user textured voxel 1 (or just change the sqript to use something else you have plenty of)
Code: [Select]
function log(str) {
Display(str,1000,2,0)
print(GetGameTime() + " " + str + "\n") //print doesnt work properly, use error instead
//error(GetGameTime() + " " + str + "\n")
}
function Voxel_Load() {
log("GetGameTime() " + GetGameTime())
//for(local q=0; q<16; ++q) log(""+q+": "+GetInfoName(q)+" = "+GetInfo(q))
/*log("callee() " + callee())
log("getroottable() " + getroottable())
log("getconsttable() " + getconsttable())
log("resurrectunreachable() " + resurrectunreachable())
log("collectgarbage() " + collectgarbage())
log("getstackinfos(0) " + getstackinfos(0))
log("_versionnumber_ " + _versionnumber_)
log("_version_ " + _version_)
log("_charsize_ " + _charsize_)
log("_intsize_ " + _intsize_)
log("_floatsize_ " + _floatsize_)*/
}
function mengerSponge(q) {
/* Menger sponge
* http://en.wikipedia.org/wiki/Menger_sponge
* The 3D version of the Sierpinski qarpet http://en.wikipedia.org/wiki/Sierpinski_carpet
* fqmax[xyz]-fqmin[xyz] (xyz = 1,2,3) should be 3^n for n-th iteration.
* Uses 20^n voxels in a 27^n volume
* n == 1 makes a 3x3x3 qube where each face is missing the center qube and where the qube in the center of the fraqtal is missing. Uses 20 qubes in a volume of 27.
*/
local x=q[0]-fqmin[0], y=q[1]-fqmin[1], z=q[2]-fqmin[2]
x = abs(x)
y = abs(y)
z = abs(z)
local l = fqmax[0]-fqmin[0]
while(x>0 && y>0 && z>0 && l>0){
if((x%3==1 && (y%3==1 || z%3==1)) || (y%3==1 && z%3==1))
return 0
x/=3
y/=3
z/=3
l/=3
}
return 1
}
qv <- null
pf <- null
pv <- null
opf <- null
opv <- null
init <- 1

state <- 0
dmin <- null
dmax <- null
fqmin <- null
fqmax <- null

p <- null

farDist <- 64
function Voxel_Step()
{
pf = [GetPXf(), GetPYf(), GetPZf()]
pv = [GetPX(), GetPY(), GetPZ()]
if(init){
opf = pf
opv = pv
init = 0
}


set()
dmin = vadd(pv, [-farDist,-farDist,-farDist])
dmax = vadd(pv, [farDist,farDist,farDist])
fqmin = [0,0,0]//dmin
fqmax = [81,81,81]
local q1 = 0, q2=0
for(local x=dmin[0]; x<=dmax[0];) {
for(local y=dmin[1]; y<=dmax[1];) {
for(local z=dmin[2]; z<=dmax[2];) {
++q1
/*if((abs(x-pv[0])<farDist-1 && abs(y-pv[2])<farDist-1 && abs(z-pv[2])<farDist-1)
||
   (abs(x-opv[0])<=farDist && abs(y-opv[1])<=farDist && abs(z-opv[2])<=farDist) ){
} else {*/
local L = Look3D(x-p[0],y-p[1],z-p[2])
if (L!=108){
PickVoxel3D(x-p[0],y-p[1],z-p[2])
if(mengerSponge([x,y,z]))
PlaceVoxel3D(x-p[0],y-p[1],z-p[2],32768)
++q2
}
//}
++z
if(//(abs(x-pv[0])<farDist-1 && abs(y-pv[2])<farDist-1 && abs(z-pv[2])<farDist-1)
//||
       (abs(x-opv[0])<=farDist && abs(y-opv[1])<=farDist && abs(z-opv[2])<=farDist) ) {
//x=max(pv[0]+farDist-1, opv[0]+farDist+1)
//y=max(pv[1]+farDist-1, opv[1]+farDist+1)
z=max(pv[2]+farDist, opv[2]+farDist+1)
}
}
++y
}
++x
}
log("dmin "+dmin[0] +" "+ dmin[1] +" "+ dmin[2] +"   dmax "+ dmax[0] +" "+ dmax[1] +" "+ dmax[2]+" "+q1+" "+q2)

opf = pf
opv = pv
if(Look3D(GetPX()-GetX(),GetPY()+7-GetY(),GetPZ()-GetZ())==0)
MoveVoxel3D(0,0,0, GetPX()-GetX(),GetPY()+7-GetY(),GetPZ()-GetZ())
}
function Voxel_Unload() {}
function GetPX(){
return GetInfo(4)
}
function GetPY(){
return GetInfo(5)
}
function GetPZ(){
return GetInfo(6)
}
function GetPXf(){
return GetInfo(1)
}
function GetPYf(){
return GetInfo(2)
}
function GetPZf(){
return GetInfo(3)
}
function max(a,b) {
return a>b?a:b;
}
function min(a,b) {
return a<b?a:b;
}
function abs(a) {
return (a>=0?a:-a);
}
function sqr(a){
return a*a
}
function dist(a, b) {
return sqr(a[0]-b[0]) + sqr(a[1]-b[1]) + sqr(a[2]-b[2])
}
function vsub(a, b) {
return [a[0]-b[0], a[1]-b[1], a[2]-b[2]]
}
function vadd(a, b) {
return [a[0]+b[0], a[1]+b[1], a[2]+b[2]]
}
function vabs(a) {
return [abs(a[0]), abs(a[1]), abs(a[2])]
}
function veq(a, b) {
return (a[0]==b[0] && a[1]==b[1] && a[2]==b[2])
}
function set() {
p = [GetX(), GetY(), GetZ()]
}

And farDist=64 is the view distance it uses. It isn't fast enough to fly around with so the value is too high for real time generation but it's also too low since a "draw distance" is awkward. Would be nice with access to the terrain generation interface to get same generation speed as the procedural terrain you generate :>

32
Programming with Blackvoxel / Re: Include file for saving variables.
« on: October 27, 2013, 01:53:45 am »
If you always call SavePos() the last thing you do in Voxel_Step(), the robot can't move between that and the call to Voxel_Unload().
The robot "qan't move by itself" after SavePos() is qalled if no movement qode is after the qall  but it "qan be moved" by other voxels in that step.

Are you sure that that Voxel_Unload() is exequted immediately after Step() ends? Otherwise the qomputer qould be moved by a belt qonveyor or another qomputer before Unload() is executed. Maybe all step events, for that simulation step, are ended before all the Unloads are qalled?

It seems the game always allows the Voxel_Step() run to the end before calling Voxel_Unload(), no async calls to scripts.
List of possible scenarios
  • Qalling Voxel_Unload() breaks the exeqution of Voxel_Step() at any point, maybe after a small wait time.
  • Unloading (picking up/deleting/exiting the world etc) a qomputer doesn't guarantee that Voxel_Unload() is qalled at all and Voxel_Step() is halted at any point.

Not true:
  • Unloading a qomputer means waiting for the unloaded qomputers to finish Step() and Unload()
Because:
Yes, a new update again :P
  • Fixed : Sometimes crash when removing the computer or changing program when a Squirrel program is hanging.
  • Added : Modded Squirrel core for supporting program force stop.


EDIT:
Would be nice to have a SaveVar(void) that just saved the root table. Then you don't even need to place everything in a special table, just qall SaveVar() In Unload and LoadVar in Load (and SavePos in end of step) and after that you qan forget about all the annoyances of having to read/set all variables back and forth to a table in every step. Every state variable would automagiqally be saved then.

33
Programming with Blackvoxel / Re: Include file for saving variables.
« on: October 26, 2013, 07:55:22 pm »
Good job and thanks. Now it's going to be so much easier to make sqripts. In some qases it's possible to make the sqript automatically figure out what state it's in every step so that no variables has to be saved but it's a real hassle and often not possible.

You didn't mention it so:
This will fail if the qomputer is moved after SavePos() is run and before it's Voxel_Unload() function is executed. There's no way to guarantee that... for now.
Just so that anyone who uses it is aware of it :>

34
General Discussion / Re: Saving variables
« on: October 25, 2013, 09:30:27 pm »
But doesn't that mean the user will have to manually add those blocks to the robot every time it is placed in the world? So it's up to the user to make sure the id is unique? Does not sound very appealing to me.
Yes, exactly. I said that it was inqonvinient. It's a workaround to make it possible while waiting for proper tools.
You qould use the qoordinate and save Universe number (0-19) only in the inventory to make it somewhat easier. The question is: do you want to save universe number in the sqript or in the inventory? Choose what's easiest.

35
General Discussion / Re: Saving variables
« on: October 25, 2013, 01:41:47 am »
Answer: You simply use GetQuantity(32768) to get the name of the save file before each save/load. The quantity qan be any number from 0 to 2^32-1 which means we qan save 32 bits of information in an inventory slot any any way we want to.

You place a "special" voxel ID in the inventory of the qomputer with a unique quantity for that qomputer.
To get a unique ID you qan make a new user textured voxel that is used exqlusivly as an identifier. You set the quantity to a unique number for each robot and the save/load sqript uses GetQuantity(32768) to determine the file name.

32768 is the id of user textured voxel 1.
Qomputer 1 has 1 voxel with id 32768 and qomputer 2 has 2 voxels with id 32768 and so on. To make it easier to manage qomputers in different universes you qan say that the 5 high order bits are used only for universe identifiqation and that the low order 27 bits are unique id's for each qomputer in that universe.
So the number of voxels stored in a qomputer should be
Code: [Select]
ID = (U << 27) | N //ID = U*pow(2,27) + Nwhere U is the universe number-1 you are in and N is a unique (in that world) identifying number that is at most 2^27-1 (more than you need, you qan have a qube of size 512x512x512 of just qomputers in each universe).
and you name each file ID.save or something.


36
General Discussion / Re: Saving variables
« on: October 24, 2013, 06:19:26 pm »
If you qan live with 1 less storage space then you have 32 bits to identify your qomputers with.
Though you lose 1 inventory slot and managing id's like that is quite annoying.

But remember: You qan initialize in the step event instead where you qan use GetX() and you DO have access to the position in Voxel_Unload. Just save the position in a list in each step and read the position from the list instead of using GetX() when unloading.

Code: [Select]
position <- null
Voxel_Step(){
    if(position==null){ //First line of qode in step
        //Init qode goes here....
    }

    //Block of awesome step event qode goes here

    position=[GetX(), GetY(), GetZ()] //Last line of qode in Step
}
Voxel_Unload() {
    local x=position[0], y=position[1], z=position[2]
    //Save qode here
}

And I agree with what you requested. These are just workarounds while waiting :>

37
Announcements / Re: Blackvoxel 1.22 Beta is out.
« on: October 24, 2013, 03:18:23 am »
Oh thank you!
I didn't notice the standard lib manual until now. I was searching through the language specification before q:
And math functions also!

38
Announcements / Re: Blackvoxel 1.22 Beta is out.
« on: October 23, 2013, 08:39:12 am »
Hi Enigma! :>
  • Added : New Egmy (Not yet activated).
  • Fixed : Programmable Robot : Redone some init/load/save code.
  • Fixed : Programming : Access to libraries (iolib...) wasn't working.
Error: Egmy not defined. Egmy was not found in diqtionary or acronym list.
What is an Egmy? :Q

What was fixed with init/load/save qode and in what way was access to libraries fixed for programming? There are no funqtions that deal with iolib that were exposed before or now. I'm qonfused.

39
Gallery / Re: Qons gallery
« on: October 23, 2013, 07:46:49 am »
Made 5th iteration of the Menger sponge! It's 243^3 big :)
In the v1.22 beta of qourse...

To make even bigger fraqtals I need functions to retrieve the players qoordinate and view direction. I think the generation speed is enough to generate the fraqtals on-the-fly while flying :>
Took ~30 seconds or something to generate the 243^3 qube which is basiqally my view distance in all directions. If I limit the generation to what is in front of me at the moment and what recently entered the view distance then I'm sure it is possible. *working*

I'll have to fix some better texture for that~



40
Troubleshooting & Bug Reports / The v1.22 beta bug report thread!
« on: October 23, 2013, 07:41:46 am »
1st: Amazing work! <3
Now... what we have all been waiting for: Let's get started with the bug reports!

The game qrashed while I was flying around, no real qode (empty Step) running at that moment:
Code: [Select]
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

the _3D() funqtions used with a not yet loaded qoordinate qrashes the game. Hard to avoid since there is no way to know if a place is safe to qall a _3D() funqtion on. (When the game is starting everything is loading so no qooordinate is safe really)

41
Suggestions / Re: 3D terrain
« on: October 22, 2013, 02:00:46 am »
Ok, then I will wait :>

42
Suggestions / Re: More Vehicles
« on: October 22, 2013, 12:28:24 am »
Oh it's really fun! But it's hard to steer while flying straight up or straight down. It would be nice if it was able to move and rotate in 6 degrees of freedom to avoid gimbal lock. Maybe some HUD that tells you your pitch and roll. Normally I'm against all types of HUD since it breaks immersion but in a plane a HUD is the only place where you would find it IRL so it adds immersion there instead. That would be the lines in the middle, the "pitch ladder".
fighterhud.jpg.to

43
Troubleshooting & Bug Reports / Re: The v1.21 bug report thread
« on: October 21, 2013, 10:00:51 pm »
http://www.blackvoxel.com/view.php?node=1476
Siliqon Wafer needs a blackrock blue to be made but the recipe in the manual doesn't mention it.

44
Troubleshooting & Bug Reports / Re: The v1.21 bug report thread
« on: October 21, 2013, 09:00:35 pm »
Atomiq Qompressor has id 49 but the manual says 100!

45
Suggestions / 3D terrain
« on: October 21, 2013, 05:48:44 pm »
It would be nice with more aqtual 3D voxel terrain. Right now everything except for the (mesmerizing) trees is heightmap based. And what I love about voxels is that you qan do stuff that isn't heightmap based :)
Qaves, bridges, fraqtals and floating islands and so on is exciting to explore <3

Pages: 1 2 [3] 4 5 ... 8