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 - linuxgeek96

Pages: 1 ... 5 6 [7] 8
91
TI-Nspire / Re: Minicraft / Terraria clone
« on: April 09, 2012, 01:34:04 pm »
Thanks, I appreciate having community support. It gives me a warm fuzzy feeling!

92
TI-Nspire / Re: Minicraft / Terraria clone
« on: April 09, 2012, 01:31:27 pm »
I hope not... I do have support from a group at school who might help me plan some.

93
Miscellaneous / Re: What is your avatar?
« on: April 09, 2012, 10:17:47 am »
 :D

94
TI-Nspire / GOLua
« on: April 09, 2012, 08:58:48 am »
Hi,

Since some people wanted my GOL code, here it is!
Code: [Select]
function on.paint(gc)
gc:setColorRGB(0,0,64)
gc:fillRect(0,0,318,212)
if j==nil then
j=8
create("bla")
end
if c=="5" then
create("bla")
c=""
elseif c=="u" then
elseif c=="p" then
pause=1
elseif c=="c" then
pause=0
elseif c=="+" then
j=j-1
c="5"
elseif c=="-" then
j=j+1
c="5"
else
for x=1,xlen do
local xs={}
if x==1 then
xs={xlen,1,2}
elseif x==xlen then
xs={xlen-1,xlen,1}
else
xs={x-1,x,x+1}
end
for y=1,ylen do
local ys={}
local n=0
if y==1 then
ys={ylen,1,2}
elseif y==ylen then
ys={ylen-1,ylen,1}
else
ys={y-1,y,y+1}
end
n=color[xs[1]][ys[1]]+color[xs[1]][ys[2]]+color[xs[1]][ys[3]]+color[xs[2]][ys[1]]+color[xs[2]][ys[3]]+color[xs[3]][ys[1]]+color[xs[3]][ys[2]]+color[xs[3]][ys[3]]
if n==3 then
buffer[x][y]=1
elseif n < 2 or n > 3 then
buffer[x][y]=0
end
end
end
end
for x=1,xlen do
for y=1,ylen do
local cell=buffer[x][y]
local lell=cell-color[x][y]
color[x][y]=cell
if lell==1 then
gc:setColorRGB(0,255,0)
elseif cell==1 and lell==0 then
gc:setColorRGB(0,128,0)
elseif lell==-1 then
gc:setColorRGB(96,32,16)
elseif cell==0 and lell==0 then
gc:setColorRGB(0,0,0)
end
gc:fillArc(x*j-0.5*j,y*j-0.5*j,0.75*j,0.75*j,0,360)
end
end
if pause==1 then
c="p"
end
--gc:drawString(debugStr,1,1,"top")
end
function on.charIn(ch)
c=ch
platform.window:invalidate()
end
function on.timer()
platform.window:invalidate()
end
function on.mouseDown(x,y)
--j=math.floor(x/318*11)
--c="5"
changePixel(x,y)
end
function on.mouseMove(x,y)
if pause==1 then
changePixel(x,y)
end
end
function changePixel(x,y)
if math.floor(x/j)>0 and math.floor(y/j)>0 then
if buffer[math.floor(x/j)][math.floor(y/j)]==1 then
buffer[math.floor(x/j)][math.floor(y/j)]=0
else
buffer[math.floor(x/j)][math.floor(y/j)]=1
end
platform.window:invalidate()
end
end
function on.save()
data = {buffer, color, j, data}
return data
end
function on.restore(data)
buffer = data[1]
color = data[2]
j = data[3]
menu = data[4]
timer.start(1)
pause=0
w=316
h=210
xlen=math.floor(w/j)
ylen=math.floor(h/j)
toolpalette.register(menu)
--create("reset")
end
function create(mode)
t=1
timer.start(t)
pause=0
w=316
h=210
xlen=math.floor(w/j)
ylen=math.floor(h/j)
buffer={}
color={}
for x=1,xlen do
buffer[x]={}
color[x]={}
for y=1,ylen do
if mode=="clear" then
color[x][y]=0
buffer[x][y]=0
elseif math.random()>0.5 then
color[x][y]=1
buffer[x][y]=1
else
color[x][y]=0
buffer[x][y]=0
end
end
end
reloadMenu()
debugStr=mode
end
function decTick()
t=t+0.02
timer.stop()
timer.start(t)
reloadMenu()
end
function incTick()
t=t-0.02
timer.stop()
timer.start(t)
reloadMenu()
if t<=1/15 then
t=1/15
end
end
function reset()
create("reset")
end
function reloadMenu()
menu={{"Functions",{"Reset",reset},{"Clear",clear},"-",{"t="..t,clear},{"Increase tick speed",incTick},{"Decrease tick speed",decTick}}}
toolpalette.register(menu)
end
function clear()
create("clear")
end
README:
Press p to pause and draw using mouseover (buggy), after which c will set it in mouse click draw mode, and o will resume. Press + or - to increase or decrease matrix size. Some functions are on the menu. Enjoy!
Questions and comments are welcome!

95
Other / Re: Linux Distro Discussion
« on: April 09, 2012, 07:47:33 am »
Fedora, Gentoo, Arch, Tiny Core, Ubuntu (in order of usage/appreciation by me)

96
TI-Nspire / Re: Minicraft / Terraria clone
« on: April 09, 2012, 07:44:02 am »
Yup CX to start, back-compatibility as soon as I have time.

97
Miscellaneous / Re: What is your avatar?
« on: April 09, 2012, 07:39:47 am »
I'll change that :-) : DIAMONDSDIAMONDSDIAMONDSDIAMONDSDIAMONDSDIAMONDS!

98
TI-Nspire / Re: Minicraft / Terraria clone
« on: April 09, 2012, 07:35:23 am »
perspective,
the GOL uses a fixed matrix, but I'll post it anyways soon.
game of life, post it!
Also is the 3d cube renderer perspective or orthographic?

99
TI-Nspire / Re: Minicraft / Terraria clone
« on: April 09, 2012, 07:34:30 am »
Sorry for the double post, but I see that some people were already working on this. Oops. I did see Tiny craft, was excited for a while and thought about getting involved, but I couldn't put in the time (EXAMS, scourge of the student coder). I believe it has stalled AND it was  for the 84+ series. With the extra memory of the nSpires, this could become much bigger. Right now, this is basically minecraft creative w/o mobs (for now) and w/very few blocks and no redstone, till I have some idea of how redstone works in actual minecraft. BTW, does anyone know the ComputerCraft mod? I think it might be easier to incorporate (at least the computers) then you think. Also, my projected timeline is that I'll post alpha by Sunday. Crossing fingers :-)

100
TI-Nspire / Re: Minicraft / Terraria clone
« on: April 09, 2012, 07:27:38 am »
Wow! Lots of intrest! I'm excoted that you guys care. This is one of my first projects for the CX, but I've been programming with my 84+ for over 4 years now, starting with BASIC, but I dabbled in assembly (Hex codes only tho, I really don't use computers for programming), and when Axe came out I used that. Currently, I've written a small 3d cube renderer in Lua, a classic bouncing ball (DVD screensaver), and a GOL simulator. If anyone wants the source code, I can post them on Tuesday or Thursday. This project grew out of the GOL sim, as I finally got the hang of Lua tables. I currently don't have any gravity or physics implemented (Builderboy, please forgive me :P), and have a fixed world size. However, I do have world slices implemented (ie Terraria mode). Basically, the world is a (sparse) 3-d table. The -1 element (w
  • [y][-1]) of each square (w
  • [y]) is the color shown on the map, as its the top block. My worldgens pretty bad though, as I have no idea how to make the kind of terrain minecraft has. Any help's appreciated. Do you want a minimap view in Terraria mode? Thanks for the support, I'll at least post a block list and some plans in my first post soon, if not beuatiful screenies. Also, I don't know how to animate screenies, but static one's are planned to be released thursday at the earliest, if I get sprites working. Anyone know a good tutorial for making them on-calc?

101
TI-Nspire / Re: Minicraft / Terraria clone
« on: April 08, 2012, 05:44:59 pm »
currently, no sprites, just colored blocks, but ill upload some when i get a chance to use ti nspire connect at school. How have you guys been doing w/ the TI.IMAGE format?

102
TI-Nspire / Minicraft / Terraria clone
« on: April 08, 2012, 05:37:51 pm »
Hi guys,

I recently began work on a minicraft like game in Lua, but I realized it was missing something (I'll give you a hint -- another dimension). I decided to make a minicraft with TERRARIA view! What do y'all think?

EDIT: here are some planning notes.
Blocks
stage1
0/nil → air (maybe vaccum?), rgb(254,254,255)
1 → dirt, rgb(150,100,50)
stage2
2 → stone, rgb(200,200,200)
3 → cobble, rgb(150,150,150)
4 → wood, rgb(150,100,50)
5 → leaf/air, rgb(100,200,100)
stage3
6 → coal (ore)
7 → coal (drop)
8 → iron (ore)
9 → iron (ingot)
10 → crafting table
11 → furnace

Ideas
store last key (instabreak to start)
sparse matrix of fixed size (to start)
UPDATE 2:
Check daily for Updates!!!
Code: [Select]
function create(mode)
t=1/2
timer.start(t)
sprites={image.new("\008\000\000\000\008\000\000\000\000\000\000\000\016\000\000\000\016\000\001\000\000\000\000\000\000\000)\165)\165\000\000\000\000\000\000\000\000\000\000)\165\000\000\000\000)\165\000\000\000\000)\165\000\000\000\000)\165)\165\000\000\000\000)\165\000\000)\165\000\000\000\000\000\000\000\000)\165\000\000\000\000\000\000)\165)\165)\165)\165\000\000\000\000\000\000\000\000\000\000)\165)\165\000\000\000\000\000\000\000\000\000\000)\165\000\000\000\000)\165\000\000\000\000\000\000\000\000)\165\000\000\000\000)\165\000\000\000\000"),image.new("\008\000\000\000\008\000\000\000\000\000\000\000\016\000\000\000\016\000\001\000\000\128\140\177\000\128\140\177\000\128\140\177\000\128\140\177\140\177\000\128\140\177\000\128\140\177\000\128\140\177\000\128\000\128\140\177\000\128\140\177\000\128\140\177\000\128\140\177\140\177\000\128\140\177\000\128\140\177\000\128\140\177\000\128\000\128\140\177\000\128\140\177\000\128\140\177\000\128\140\177\140\177\000\128\140\177\000\128\140\177\000\128\140\177\000\128\000\128\140\177\000\128\140\177\000\128\140\177\000\128\140\177\140\177\000\128\140\177\000\128\140\177\000\128\140\177\000\128")}
inventory={current=0,select=1,{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0}}
i=0
view=0
position={1,1,1}
pause=0
w=316
h=210
xlen=math.floor(w/j)
ylen=math.floor(h/j)
color={}
for x=1,xlen do
color[x]={}
for y=1,xlen do
color[x][y]={}
for z=1,xlen do
color[x][y][z]={visited=false,type=0}
if y==xlen then
color[x][y][z].type=-1
elseif y<=8 then
color[x][y][z].visited=true
elseif mode=="clear" then
elseif math.random()>(y-4)/ylen then
color[x][y][z].type=1
elseif math.random()>1-y/ylen then
if math.random()>1-(y*0.25-8)/ylen then
color[x][y][z].type=4
else
color[x][y][z].type=2
end
end
end
end
end
reloadMenu()
end
function reloadMenu()
menu={{"Functions",{"Reset",reset},{"Clear",clear}}}
toolpalette.register(menu)
end
function clear()
create("clear")
end
function reset()
create("reset")
end
function on.arrowLeft()
c="4"
end
function left()
if (position[1]~=1 and view~=1) then
position[1]=position[1]-1
elseif (position[2]~=1 and view==1) then
position[2]=position[2]-1
end
end
function on.arrowRight()
c="6"
end
function right()
if (position[1]~=xlen and view~=1) then
position[1]=position[1]+1
elseif (position[2]~=xlen and view==1) then
position[2]=position[2]+1
end
end
function on.arrowDown()
c="2"
end
function down()
if (position[3]~=ylen and view~=2) then
position[3]=position[3]+1
elseif (position[2]~=ylen and view==2) then
position[2]=position[2]+1
end
end
function on.arrowUp()
c="8"
end
function up()
if (position[3]~=1 and view~=2) then
position[3]=position[3]-1
elseif (position[2]~=1 and view==2) then
position[2]=position[2]-1
end
end
function pickColor(top,d)
local t = {255,0,0}
if top==0 then
t = {255*d,255*d,255*d}
elseif top==1 then
t = {150*d,100*d,50*d}
elseif top==2 then
t = {150*d,150*d,150*d}
elseif top==3 then
t = {200*d,200*d,200*d}
elseif top==4 then
t ={175*d,100*d,0}
end
return t
end
function calcFog(x,y,z,position)
local d
if not color[x][y][z].visited then
d = math.sqrt((x-position[1])*(x-position[1])+(y-position[2])*(y-position[2])*4+(z-position[3])*(z-position[3]))
d=1-(d/xlen*4)
if d<0 then
d=0
elseif d>1 then
d=1
end
else
d=1
end
return d
end
function on.charIn(ch)
c=ch
end
function on.timer()
platform.window:invalidate()
end
function on.mouseDown(x,y)
local coords={position[1],position[2],position[3]}
if view==0 then
coords[1]=math.ceil(x/j)
coords[3]=math.ceil(y/j)
elseif view==1 then
coords[2]=math.ceil(x/j)
coords[3]=math.ceil(y/j)
elseif view==2 then
coords[1]=math.ceil(x/j)
coords[2]=math.ceil(y/j)
end
if color[coords[1]][coords[2]][coords[3]].type==0 and inventory[inventory.select].number>0 then
color[coords[1]][coords[2]][coords[3]].type=inventory[inventory.select].type
inventory[inventory.select].number=inventory[inventory.select].number-1
end
end
function on.paint(gc)
gc:setColorRGB(0,0,64)
gc:fillRect(0,0,316,210)
if j==nil then
j=8
create("clear")
end
--Keypresses and d-pad
if c=="." then
if view==2 then
view = 0
else
view=view+1
end
elseif c=="1" then
down()
left()
elseif c=="2" then
down()
elseif c=="3" then
down()
right()
elseif c=="4" then
left()
elseif c=="6" then
right()
elseif c=="7" then
up()
left()
elseif c=="8" then
up()
elseif c=="9" then
up()
right()
elseif c=="a" then
inventory.select=1
elseif c=="b" then
inventory.select=2
elseif c=="c" then
inventory.select=3
elseif c=="d" then
inventory.select=4
elseif c=="e" then
inventory.select=5
elseif c=="f" then
inventory.select=6
elseif c=="g" then
inventory.select=7
end
if c then
c=""
end

--Gravity
i=1-i
if i==1 and  color[position[1]][position[2]+1][position[3]] .type==0 then
position[2]=position[2]+1
end

--Lighting / shroud
for x=-1,1 do
for y=-1,1 do
for z=-1,1 do
if not ((x==-1 and position[1]==1) or (y==-1 and position[2]==1) or (z==-1 and position[3]==1) or (x==1 and position[1]==xlen) or (y==1 and position[2]==xlen) or (z==1 and position[3]==xlen)) then
color[position[1]+x][position[2]+y][position[3]+z].visited=true
end
end
end
end

--Inventory/mining
if color[position[1]][position[2]][position[3]].type>0 then
local slot=inventory.current+1
for i=1,inventory.current do
if inventory[i].type==color[position[1]][position[2]][position[3]].type then
slot=i
end
end
if not inventory[slot].type or
inventory[slot].type==0 then
inventory.current=inventory.current+1
inventory[slot].type=color[position[1]][position[2]][position[3]].type
inventory[slot].number=1
else inventory[slot].number=inventory[slot].number+1
end
color[position[1]][position[2]][position[3]].type=0
end

--Draw tiles
if view==0 then
for x=1,xlen do
for z=1,ylen do
local top=1
for y=position[2],xlen do
if top==1 and color[x][y][z].type~=0 then
top=y
end
end
local type=color[x][top][z].type
if type>0 then
local triple=pickColor(type,calcFog(x,top,z,position))
gc:setColorRGB(triple[1],triple[2],triple[3])
gc:fillRect(x*j-j*0.5,z*j-j*0.5,j,j)
elseif type==-1 then
gc:drawImage(sprites[2],x*j-j*0.5,z*j-j*0.5)
end
if x==position[1] and z==position[3] then
gc:drawImage(sprites[1],x*j-j*0.5,z*j-j*0.5)
end
end
end
elseif view==1 then
for y=1,xlen do
for z=1,ylen do
local type=color[position[1]][y][z].type
if type>0 then
local triple = pickColor( color[position[1]][y][z].type, calcFog(position[1],y,z,position))
gc:setColorRGB(triple[1],triple[2],triple[3])
gc:fillRect(y*j-j*0.5,z*j-j*0.5,j,j)
elseif type==-1 then
gc:drawImage(sprites[2],y*j-j*0.5,z*j-j*0.5)
end
if y==position[2] and z==position[3] then
gc:drawImage(sprites[1],y*j-j*0.5,z*j-j*0.5)
end
end
end
elseif view==2 then
for x=1,xlen do
for y=1,ylen do
local type=color[x][y][position[3]].type
if type>0 then
local triple=pickColor(type,calcFog(x,y,position[3],position))
gc:setColorRGB(triple[1],triple[2],triple[3])
gc:fillRect(x*j-0.5*j,y*j-0.5*j,j,j)
elseif type==-1 then
gc:drawImage(sprites[2],x*j-j*0.5,y*j-j*0.5)
end
if x==position[1] and y==position[2] then
gc:drawImage(sprites[1],x*j-j*0.5,y*j-j*0.5)
end
end
end
end
--Inventory overlay
for x=1,7 do
local triple=pickColor(inventory[x].type,1)
gc:setColorRGB(triple[1],triple[2],triple[3])
gc:fillRect(118+x*10,195,10,10)
gc:setColorRGB(0,0,0)
gc:drawString(inventory[x].number,120+x*10,189,"top")
end
gc:setColorRGB(255,255,255)
gc:drawString("("..position[1]..","..position[2]..","..position[3]..")",0,0,"top")
end

103
Miscellaneous / Re: What is your avatar?
« on: April 08, 2012, 05:31:34 pm »
*looks around* OS? What's an OS?

104
Miscellaneous / Re: Heppy Eastur!
« on: April 08, 2012, 05:21:55 pm »
lol, topic name is misspelling of misspelled title

105
Miscellaneous / Re: What is your avatar?
« on: April 08, 2012, 05:16:41 pm »
I'll see what I can do *wink*

Pages: 1 ... 5 6 [7] 8