Hello
Guest
Home
Forum
Search
Staff List
Members
Donations
AoS Stats
Login
Register
aloha.pk
»
Forum
»
talk story
»
whatevahs
»
voxscript
Print
Pages: [
1
]
Author
Topic: voxscript (Read 1362 times)
0 Members and 1 Guest are viewing this topic.
MuffinTastic
kamaaina
Posts: 307
Joined: Oct 2013
Country:
Total likes: 111
voxscript
«
on:
January 03, 2017, 12:37:47 PM HST »
this is a lot of fun to mess around with, so I thought I'd release it :)
as you all know,
VOXLAP
is a 3D voxel engine made by Ken Silverman.
it's a very nice and easy-to-use engine, once you get it working, but most people either can't compile it or simply don't have the time/patience for doing so, which brings me to voxscript.
voxscript is a small program I made which combines VOXLAP and
AngelScript
. AngelScript has proven to be a very versatile scripting language, and besides, its arrays don't start at 1, so why wouldn't I pick it? :)
I'm looking at you, Lua
how it works:
edit main.as to your liking
launch
voxscript.exe
notice a problem or two
close voxscript & repeat
Spoiler
for
current VOXLAP support
:
green
: supported,
orange
: mostly supported,
red
: not supported
note: whenever you see a *, that's just because I'm not sure how the pointer would transfer over to angelscript. otherwise it should be @
type
lpoint3d
(int-based 3D vector, mainly used for block positions)
type
point3d
(float-based vector)
type
point4d
type
dpoint3d
(double-based vector)
type
kv6voxtype
type
kv6data
(KV6 model storage datatype -- no voxel access support)
• int
leng, xsiz, ysiz, zsiz
• float
xpiv, ypiv, zpiv
• uint
numvoxs
• kv6data@
lowermip
(might add this in, not sure)
• kv6voxtype[]
vox
• uint[]
xlen
• uint16[]
ylen
type
hingetype
type
seqtyp
type
kfatype
type
vx5sprite
(supports KV6 fully, doesn't support KFA)
• point3d
p
• int
flags
• union { point3d
s, x
}
• union { kv6data@
voxnum
, kfatype@
kfaptr
}
• union { point3d
h, y
}
• int
kfatim
• union { point3d
f, z
}
• int
okfatim
type
flstboxtype
type
lightsrctype
type
vspans
type
vx5_struct
(vx5_struct is a special type, only used by VOXLAP in global vx5 for settings, such as fog color / distance)
• double
clipmaxcr
• dpoint3d
cliphit[3]
• int
cliphitnum
• int
minx, miny, minz, maxx, maxy, maxz
• int
flstnum
• flstboxtype
flstcnt[256]
• int
globalmass
• int16
kfaval[1024]
• int
anginc, sideshademode, mipscandist, maxscandist, vxlmipuse, fogcol
• int
kv6mipfactor, kv6col
• int
xplanemin, xplanemax
• int
curcol, currad, curhei
• float
curpow
• int
colfunc
(lpoint3d &in) [callback]
• int
cen, amount, *pic, bpl, xsiz, ysiz, xoru, xorv, picmode
• point3d
fpico, fpicu, fpicv, fpicw
• lpoint3d
pico, picu, picv
• float
daf
• int
lightmode
• lightsrctype
lightsrc[256]
• int
numlights
• int
fallcheck
(untested!)
global vx5_struct
vx5
(might add these, they're currently called by voxscript itself)
int
initvoxlap
()
void
uninitvoxlap
()
int
loadsxl
(const string &in sxlnam, uint8 **vxlnam, uint8 **skynam, uint8 **globst)
uint8@
parspr
(vx5sprite@ spr, uint8 **userst)
void
loadnul
(point3d &out ipos, point3d &out istr, point3d &out ihei, point3d &ifor)
int
loaddta
(const string &in filename, dpoint3d &out ipos, dpoint3d &out istr, dpoint3d &out ihei, dpoint3d &ifor)
int
loadpng
(const string &in filename, dpoint3d &out ipos, dpoint3d &out istr, dpoint3d &out ihei, dpoint3d &ifor)
int
loadbsp
(const string &in filename, dpoint3d &out ipos, dpoint3d &out istr, dpoint3d &out ihei, dpoint3d &ifor)
int
loadvxl
(const string &in filename)
int
savevxl
(const string &in filename)
int
loadsky
(const string &in filename)
void
voxsetframebuffer
(int framebuf, int pitch, int xres, int yres)
void
setsideshades
(uint8 sto, uint8 sbo, uint8 sle, uint8 sri, uint8 sup, uint8 sdo)
void
setcamera
(const point3d &in ipos, const point3d &in istr, const point3d &in ihei, const point3d &in ifor, float, float, float)
void
opticast
()
void
drawpoint2d
(int x, int y, int color)
void
drawpoint3d
(float x, float y, float z, int color)
void
drawline2d
(float x1, float y1, float x2, float y2, int color)
void
drawline3d
(float x1, float y1, float z1, float x2, float y2, float z2, int color)
int
project2d
(float x, float y, float z, float &out px, float &out py, float &out sx)
void
drawspherefill
(float x, float y, float z, float radius, int color)
void
drawpicinquad
(int, int, int, int, int, int, int, int, float, float, float, float, float, float, float, float);
void
drawpolyquad
(int, int, int, int, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float);
void
print4x6
(int x, int y, int foreground, int background, const string &in text)
void
print6x8
(int x, int y, int foreground, int background, const string &in text)
void
drawtile
(int, int, int, int, int, int, int, int, int, int, int, int);
int
screencapture32bit
(const string &in file)
kv6data@
loadkv6
(const string &in file)
kv6data@
getkv6
(const string &in file) (objectively better than loadkv6 but it crashes the program)
kfatype@
getkfa
(const string &in file)
void
freekv6
(kv6data@ kv6)
void
savekv6
(const string &in, kv6data@)
void
getspr
(vx5sprite &out, const string &in)
kv6data@
genmipkv6
(kv6data@) (might add this)
uint8@
getkfilname
(int)
void
animsprite
(vx5sprite &in, int)
void
drawsprite
(vx5sprite &in)
int
meltsphere
(vx5sprite &in, lpoint3d &in, int)
int
meltspans
(vx5sprite &in, vspans@, long, lpoint3d &in)
void
orthonormalize
(point3d &in v0, point3d &in v1, point3d &in v2, point3d &out nv0, point3d &out nv1, point3d &out nv2)
void
dorthonormalize
(dpoint3d &in v0, dpoint3d &in v1, dpoint3d &in v2, dpoint3d &out nv0, dpoint3d &out nv1, dpoint3d &out nv2)
void
orthorotate
(float ox, float oy, float oz, point3d &in ist, point3d &in ihe, point3d &in ifo, point3d &out nist, point3d &out nihe, point3d &out nifo)
void
dorthorotate
(double ox, double oy, double oz, dpoint3d &in ist, dpoint3d &in ihe, dpoint3d &in ifo, dpoint3d &out nist, dpoint3d &out nihe, dpoint3d &out nifo)
void
axisrotate
(point3d &in v, point3d &out nv, point3d &in axis, float rad);
void
slerp
(point3d &in istr, point3d &in ihei, point3d &in ifor, point3d &in istr2, point3d &in ihei2, point3d &in ifor2, point3d &in ist, point3d &in ihe, point3d &in ifo, point3d &out nist, point3d &out nihe, point3d &out nifo, float rad)
int
cansee
(point3d &in p1, point3d &in p2, lpoint3d &out hitp)
void
hitscan
(point3d &in ipos, point3d &in ifor, lpoint3d &out hitp, int &out hitc, int &out hits)
void
dhitscan
(dpoint3d &in ipos, dpoint3d &in ifor, lpoint3d &out hitp, int &out hitc, int &out hits) (use hitscan_get_color with hitc, value is actually a pointer)
int
hitscan_get_color
(int hitc)
void
clipmove
(point3d &in pos, point3d &out npos, point3d &in vel, float rad)
void
dclipmove
(dpoint3d &in pos, dpoint3d &out npos, dpoint3d &in vel, float rad)
void
estnorm
(int x, int y, int z, point3d &out norm)
int
isvoxelsolid
(int x, int y, int z)
int
anyvoxelsolid
(int x, int y, int z0, int z1)
int
anyvoxelempty
(int x, int y, int z0, int z1)
int
getfloorz
(int x, int y, int z)
int
getcube
(int x, int y, int z) (use hitscan_get_color with this, return value is actually a pointer)
void
setcube
(int x, int y, int z, int color)
void
setsphere
(lpoint3d &in pos, int rad, int set) (use vx5.curcol for color)
void
setellipsoid
(lpoint3d &in p0, lpoint3d &in p1, int hitrad, int dacol, int bakit)
void
setcylinder
(lpoint3d &in p0, lpoint3d &in p1, int cr, int dacol, int bakit)
void
setrect
(lpoint3d &in p0, lpoint3d &in p1, int)
void
settri
(point3d &in p0, point3d &in p1, point3d &in p2, int bakit)
void
setsector
(point3d &in p, int &p2, int n, float thick, int dacol, int bakit)
void
setspans
(vspans@ lst, int lstnum, lpoint3d &in offs, int dacol)
void
setheightmap
(const uint8 &in hbuf, int hpitch, int hxdim, int hydim, int x0, int y0, int x1, int y1)
void
setkv6
(vx5sprite &in spr, int dacol) (untested!)
void
sethull3d
(point3d &in p, int nump, int dacol, int bakit)
void
setlathe
(point3d &in p, int numcurs, int dacol, int bakit)
void
setblobs
(point3d &in p, int numcurs, int dacol, int bakit)
void
setfloodfill3d
(int x, int y, int z, int minx, int miny, int minz, int maxx, int maxy, int maxz)
void
sethollowfill
()
void
setkvx
(const string &in filename, int ox, int oy, int oz, int rot, int bakit) (might add this)
void
setflash
(float px, float py, float pz, int flashradius, int numang, int intens)
void
setnormflash
(float px, float py, float pz, int flashradius, int intens)
void
updatebbox
(int x0, int y0, int z0, int x1, int y1, int z, int csgdel)
void
updatevxl
()
void
genmipvxl
(int x0, int y0, int x1, int y1)
void
updatelighting
(int x0, int y0, int z0, int x1, int y1, int z1)
void
evilquit
(const string &in text)
void
checkfloatinbox
(int x0, int y0, int z0, int x1, int y1, int z1)
void
startfalls
()
void
dofall
(int i)
int
meltfall
(vx5sprite &out spr, int fi, int delvxl)
void
finishfalls
()
(callbacks, for vx5.colfunc)
long
curcolfunc
(lpoint3d &in);
long
floorcolfunc
(lpoint3d &in);
long
jitcolfunc
(lpoint3d &in);
long
manycolfunc
(lpoint3d &in);
long
sphcolfunc
(lpoint3d &in);
long
woodcolfunc
(lpoint3d &in);
long
pngcolfunc
(lpoint3d &in);
long
kv6colfunc
(lpoint3d &in);
void
voxbackup
(int x0, int y0, int x1, int y1, int tag)
void
voxdontrestore
()
void
voxrestore
()
void
voxredraw
()
void
kpzload
(const string &in file, int &out pic, int &out pitch, int &out xsiz, int &out ysiz)
void
kpgetdim
(uint8 *buf, int leng, int &out xsiz, int &out ysiz)
int
kprender
(uint8 *buf, int leng, int frameptr, int pitch, int xdim, int ydim, int xoff, int yoff)
int
kzaddstack
(const string &in zipfile)
void
kzuninit
()
int
kzopen
(const string &in file)
int
kzread
(void *mem, int bytes)
int
kzfilelength
()
int
kzseek
(int offset, int whence)
int
kztell
()
int
kzgetc
()
int
kzeof
()
int
kzclose
()
void
kzfindfilestart
(const string &in file)
int
kzfindfile
(uint8 *)
-- sysmain API
type
PALETTEENTRY
type
validmodetype
global const double
dtotclk
(WIN32 related stuffs)
global HWND
ghwnd
global HINSTANCE
ghinst
HDC
startdc
()
void
stopdc
()
void
ddflip2gdi
()
void
setalwaysactive
(int alwaysactive)
void
smartsleep
(int ms)
int
canrender
()
global int
ddrawuseemulation
global int
ddrawdebugmode
void
debugdirectdraw
()
int
peekwindowproc
(HWND, UINT, WPARAM, LPARAM) [callback]
global int
cputype
(should I include this?)
void
setacquire
(int mouse, int keyboard)
global string
prognam
global int
progresiz
void
quitloop
()
global int
xres, yres, colbits, fullscreen
,
maxpages
global PALETTEENTRY
pal[256]
int
startdirectdraw
(int &out frameptr, int &out pitch, int &out xres, int &out yres)
void
stopdirectdraw
()
void
nextpage
()
void
clearscreen
(int color)
void
updatepalette
(int start, int danum)
int
getvalidmodelist
(validmodetype **validmodelist)
int
changeres
(int xres, int yres, int colbits, int fullscreen)
void
playsound
(const string &in file, int volume, float frequency, const point3d &in position, int flags) (flags: 0=normal 1=3D 2=MOVE 4=LOOP 8=LOPASS 16=MEM)
void
playsoundupdate
(void *, void *)
void
setears3d
(const point3d &in ipos, const point3d &in ifor, const point3d &in ihei)
void
setvolume
(int volume)
int
umixerstart
(void mixfunc(void *, long) [callback], int, int, int)
void
umixerkill
(int)
void
umixerbreathe
()
global uint8
keystatus[256]
• uint8
get_keystatus
(int key)
• void
set_keystatus
(int key, uint8 status)
global uint8
ext_keystatus[256]
• uint8
get_ext_keystatus
(int key)
• void
set_ext_keystatus
(int key, uint8 status)
int
readkeyboard
()
int
keyread
()
global uint8
ext_mbstatus[8]
global int
ext_mwheel
global int
mousmoth
global float
mousper
void
readmouse
(float &out mousex, float &out mousey, int &out buttons)
int
ismouseout
(int x, int y)
void
setmouseout
(void mouseout(long, long) [callback], int, int);
void
readklock
(double &out time) (i might add this in, but you can access time by accessing global var dtotclk)
here's the download link:
voxscript
and a bare bones script, ken silverman-style:
basic.as
Edit:
and for the hell of it, a version that supports 1024x1024x256 maps. it can't load AoS maps, though, and I don't know of any program that can edit this size of map..
voxscript1024
«
Last Edit: January 04, 2017, 12:28:29 AM HST by MuffinTastic
»
Logged
(4 people liked this)
Glass
local
Posts: 825
Joined: Mar 2016
Country:
Total likes: 97
Re: voxscript
«
Reply #1 on:
January 03, 2017, 03:37:24 PM HST »
ooo I like this!
great job man! Angel script is a great language
Logged
Spoiler
for
unknown
:
spy: not funny
what is wrong with all of you
omg
juxta: touchy, like his economy
spring: Glass is arguably not my least favorite member of staff at this exact moment
thegreensun
local
Posts: 700
Joined: Jul 2016
Country:
Total likes: 90
Re: voxscript
«
Reply #2 on:
August 28, 2017, 03:44:04 AM HST »
if you go too fast your game turns into space engineers and you are the ship
Logged
Print
Pages: [
1
]
aloha.pk
»
Forum
»
talk story
»
whatevahs
»
voxscript