Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Is a Craft texture pack possible?

edited May 30 in Codea Craft Posts: 1,166
One of the initial announcements of Craft mentioned being able to create and share texture packs:

https://codea.io/talk/discussion/7076/what-is-codea-craft

...did this happen? This is literally the only link that came up when I searched “craft skin textures”, so it seems like not.

I may be wrong but it’s my impression that craft has not resulted in a flurry of voxel-based projects, and if there’s no room for texture packs, I would strongly suspect that has a lot to do with it.

Texture packs and environment shaders for Minecraft are one of **the** loci of intense fan activity in the Minecraft community and if that can’t be done, it’s lost a huge chunk of fun.

I mean, the reason I searched for it myself is that I thought it would be fun to try to pinch some cool fan-made textures and try to give the Craft voxel blocks a makeover, because personally—no offense to anyone—the included ones read to me as, as the kids say, basic.

Anyway I hope there’s a way to make texture packs for these things because it would be super fun and I’m certainly not the only one who’d think so.

And yes @dave1707 I know I could try doing it on my own, but it’s not clear that would even work, and more importantly the block documentation suggests that modifying the default blocks will probably affect performance, possibly by a lot.
«1

Comments

  • edited May 30 Posts: 2,219
    @UberGoober - if you look at the recent image carousel thread @dave1707 and I have been building textures for cubes. You can do the same quite easily and build your own Minecraft style blocks.

    Also the characters, within Codea, have textures which you can import into a paint package and over paint with you own graphics. When I get chance I'll give it a try and post something.
  • Posts: 1,166
    @Bri_G please no, I don’t need a demonstration of how textures work.

    I think you might not understand what @John was talking about when he said Craft would support texture packs.

    https://minecraft.fandom.com/wiki/Texture_Pack
  • Posts: 2,219

    @Ubergoober - I know what texture packs are in Minecraft. Should be easy to set up Minecraft style blocks from a texture image containing multiple block textures. Why do you need someone else to build that facility. Part of playing with Codea to get what you need.

  • Posts: 1,166

    @Bri_G, first off, having texture packs was specifically mentioned by @John as upcoming feature. There's nothing lazy about looking forward to a feature and being disappointed when it doesn't materialize, and having fun making & browsing texture packs is completely different from spending a huge amount of time reproducing the ability to do it.

    Second, it seems to me, the Craft voxel system has kind of run aground. Is anyone making original games with voxel blocks? Forget original, has anyone built a game using Codea's built-in voxel environment? Forget games, has anyone used Codea's built-in voxel environment to make anything you can walk around in? Forget walking around even, has anyone even stacked voxel blocks into anything cool, like a house or a bridge or a face or, for goodness's sake, a wall? Voxel blocks are the whole thing Craft was advertised with. It was literally made for them. Why aren't the forums full of voxel-block projects?

    For me, art matters. I don't like how it looks. If I don't like how it looks, why on Earth would I build something with it? And if I have to hand-write a whole texture pack system before I get to the fun part, thank you no. I'll still enjoy Codea, I still think it's great, that's just not what I want to spend time on. And honestly I kind of suspect no one does.

  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober And you thought I was the one going to say something.

    And yes @dave1707 I know I could try doing it on my own

  • Posts: 2,219
    @UberGoober - I think I get the general gist of that - misunderstood your initial question.
  • edited May 30 Posts: 1,166

    @Bri_G , @dave1707 I think I got off on a bad ranty state there and I apologize,

    I hope I didn’t make anyone feel bad.

    I am legitimately curious about the questions I was asking though.

    Has anyone made a game with voxel cubes? Has anyone made something you can walk around in? Has anyone made anything cool out of the cubes themselves?

    Maybe I’m using the wrong search terms, but when I search the forums about these things nothing obvious comes up.

  • dave1707dave1707 Mod
    edited May 31 Posts: 9,243

    @UberGoober I don’t know if this is cool enough, but it does use Voxel blocks.

    viewer.mode=FULLSCREEN
    
    function setup()
         ss=81          -- cube size, powers of 3 only (3, 9, 27, 81, 243)
         --ss=243      -- doesn't draw correctly    
    
        fill(255)
        assert(OrbitViewer, "Please include Cameras as a dependency")
        scene = craft.scene() 
        v=scene.camera:add(OrbitViewer,vec3(ss,ss,ss), ss*3, 0, 6000)    
        v.rx=-10
        v.ry=-30
    
        scene.voxels.blocks:addAssetPack("Blocks")
        tab = scene.voxels.blocks:new("Table")
        tab.setTexture(ALL, "Blocks:Table") 
        scene.voxels:fill("Table")
    
        scene.voxels.visibleRadius=90
        scene.voxels:resize(vec3(60,1,60))          
        scene.voxels.coordinates = vec3(ss,ss,ss) 
        count=0
        cube(0,0,0,ss)
    end
    
    function update(dt)
        scene:update(dt)
    end
    
    function draw()
        update(DeltaTime)
        scene:draw()
        text("Cube size "..ss.."x"..ss.."x"..ss.." = "..(ss^3).." cubes",WIDTH/2,HEIGHT-25)
        text("Number of cubes drawn "..count,WIDTH/2,HEIGHT-50)
    end
    
    function cube(x,y,z,size)
        local s=size/3
        for x1=-s,s,s do
            for y1=-s,s,s do
                for z1=-s,s,s do
                    if (y1~=0 or z1~=0) and (x1~=0 or z1~=0) and (x1~=0 or y1~=0) then
                        if size~=3 then
                            cube(x1+x,y1+y,z1+z,s)
                        else
                            count=count+1
                            scene.voxels:block((x1+x+ss),(y1+y+ss),(z1+z+ss))
                        end
                    end
                end
            end
        end
    end
    
  • edited May 31 Posts: 1,166

    @dave1707 it crashes my iPhone 8. I’ll have to try it on my iPad later.

    Later:
    I mean, it’s not not cool. I like it. Got anything else?

  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober Try reducing the number of cubes per side. Reduce the value of ss to 3. Then try 9, then 27.

  • Posts: 1,166

    @dave1707 I like it. I tried to make it cycle but I couldn’t get the positioning to work. Also I added an icon because me. :)

  • Posts: 1,166

    @dave1707 the code in the above:


    viewer.mode=FULLSCREEN function setup() ss=81 -- cube size, powers of 3 only (3, 9, 27, 81, 243) --ss=243 fill(255) assert(OrbitViewer, "Please include Cameras as a dependency") scene = craft.scene() v=scene.camera:add(OrbitViewer,vec3(ss,ss,ss), ss*3, 0, 6000) v.rx=-10 v.ry=-30 scene.voxels.blocks:addAssetPack("Blocks") tab = scene.voxels.blocks:new("Table") tab.setTexture(ALL, "Blocks:Table") scene.voxels:fill("Table") cube(0,0,0,ss) parameter.action("cycleSideSize", function() ss = ss * 3 if ss > 81 then ss = 3 end cube(0,0,0,ss) end) end function update(dt) scene:update(dt) end function draw() update(DeltaTime) scene:draw() text("Cube size "..ss.."x"..ss.."x"..ss.." = "..(ss^3).." cubes",WIDTH/2,HEIGHT-25) text("Number of cubes drawn "..count, WIDTH/2,HEIGHT-50) end function cube(x,y,z,size) print(size) scene.voxels.visibleRadius=90 scene.voxels:resize(vec3(60,1,60)) scene.voxels.coordinates = vec3(size, size, size) count=0 local s=size/3 local offset = vec3(1, 1, 1) * s for x1=-s,s,s do for y1=-s,s,s do for z1=-s,s,s do if (y1~=0 or z1~=0) and (x1~=0 or z1~=0) and (x1~=0 or y1~=0) then if size~=3 then cube(x1+x,y1+y,z1+z,s) else count=count+1 local base = vec3((x1+x),(y1+y),(z1+z)) scene.voxels:block(base + offset) end end end end end end
  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober Not sure what you’re trying to do, but the cube isn’t working right.

  • Posts: 1,166

    @dave1707 thats what I said.

    I’m trying to make it so you can press the button and it switches between different sizes.

    I can’t get the positioning right.

  • Posts: 1,166

    @dave1707 maybe my subtle hinting was too bashful.

    You suggested trying out running the project with different side sizes, and I thought that was cool, so I wanted to make it possible to do that right while the code was running.

    I really spent a good deal of time trying to get it to work, and I did kind of, but I couldn’t figure out two things that seemed basic:

    • I couldn’t figure out how to clear blocks so that the new blocks would draw in a blank space
    • I couldn’t figure out how to get the generated shapes of different sizes to all display in the middle of the screen

    I got frustrated because these seemed like simple things but I couldn’t figure them out. Can you help?

  • edited June 2 Posts: 2,219

    @dave1707 - your initial demo in this thread wouldn’t run after demanding camera dependencies. It crashed on ss=81. I reduced size to 3 and it ran, 24 and above (in multiples of 3) it fired up multiple errors. 21 it crashed. Note these were run consecutively.

  • dave1707dave1707 Mod
    Posts: 9,243

    @Bri_G ss has to be a power of 3. That is 3, 9, 27, 81, 243. The value of 243 doesn’t work right. I think it has to do with Voxel limits, but I don’t know that much about voxels to figure it out.

  • Posts: 1,166

    @dave1707 but how do I get it centered based on size? The thing that was stymying me was that you use the side size to center the cubes when you're only running one at a time, but when I try to use the side size when I'm "live-swapping" the cubes it always puts them off-center.

  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober You not only have to move the camera, but the Voxel coordinates too.

  • Posts: 1,166

    @dave1707 I know, I just couldn't get it right. The voxels always got clipped off of one side of the designated block or something. I know the math must be pretty simple but I just couldn't do it. I didn't move the camera at all actually.

  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober You can only draw voxels that are positive. If a block has negative values it gets clipped. That’s why I’m adding the ss value to keep all the values positive.

  • Posts: 1,166

    @dave1707 that’s good to know, and still, having spent so much time trying every combination I could think of to get things in the right place, I kinda give up. I tried adjusting these variables and those variables and the other variables and every time I ran it I got results that made no sense to me. I could never predict what it would do or where things would be drawn.

    I’m sure it’s really simple, I guess its just too simple for me. Or vice versa, more like.

    I’m okay with mine being broken. Your example is good and stands on its own.

  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober Try this.

    viewer.mode=FULLSCREEN
    
    function setup()
        --  3, 9, 27, 81
        ss=3     
        assert(OrbitViewer, "Please include Cameras as a dependency")
        scene1 = craft.scene() 
        v=scene1.camera:add(OrbitViewer,vec3(50,50,50), ss*3, 0, 1000)
    
        scene1.voxels.blocks:addAssetPack("Blocks")
        tab = scene1.voxels.blocks:new("Table")
        tab.setTexture(ALL, "Blocks:Table")
    
        scene1.voxels:fill("Table")    
        scene1.voxels.visibleRadius=200
        scene1.voxels:resize(vec3(60,1,60))          
        scene1.voxels.coordinates = vec3(50,50,50) 
    
        cube(0,0,0,ss)
    end
    
    function update(dt)
        scene1:update(dt)
    end
    
    function draw()
        update(DeltaTime)
        scene1:draw()  
    end
    
    function cube(x,y,z,size)
        local s=size/3
        for x1=-s,s,s do
            for y1=-s,s,s do
                for z1=-s,s,s do
                    if (y1~=0 or z1~=0) and (x1~=0 or z1~=0) and (x1~=0 or y1~=0) then
                        if size~=3 then
                            cube(x1+x,y1+y,z1+z,s)
                        else
                            scene1.voxels:block((x1+x+50),(y1+y+50),(z1+z+50))
                        end
                    end
                end            
            end
        end
    end   
    
  • edited June 2 Posts: 2,219

    @dave1707 - sorry, I used multiples of 3 not powers, makes sense now it’s power as it needs to be to ensure each dimension of the cube is correct.

    But, that still doesn’t explain why the code crashes Codea.

    @UberGoober - ran your code seemed OK until I tried to make a project icon and Codea crashed.

    @John @Simeon - seems like there is an issue here probably an untraced error in Craft.

  • Posts: 1,166

    @dave1707 thanks! That really helped.

    Can you help me delete blocks? The documentation is really frustrating and unhelpful, to me at least.

    This is what I was trying, from the documentation alone I had absolutely no idea what to do, but I found something like this in the cave-generating code:


    function clearBlocks() scene.voxels:iterateBounds(vec3(0,0,0), vec3(ss, ss, ss), function(i,j,k,id) scene.voxels:set(vec3(i,j,k), "id", 0) end) end

    ...doesn’t work though.

  • dave1707dave1707 Mod
    edited June 2 Posts: 9,243

    @UberGoober Here’s an update, not perfect. Not too sure how to remove blocks. Things I tried didn’t work all the time and I’m not very familiar with the Voxel stuff.

    Updated version below
    
  • edited June 2 Posts: 1,166

    @dave1707 I like your update, the colors are cool.

    Here’s the adjustment I made to your previous update, it’s very similar to what you did. I can’t decide if I like it better with or without colors.


    viewer.mode=FULLSCREEN function setup() -- 3, 9, 27, 81 ss=3 assert(OrbitViewer, "Please include Cameras as a dependency") scene1 = craft.scene() v=scene1.camera:add(OrbitViewer,vec3(50,50,50), ss*3, 0, 1000) scene1.voxels.blocks:addAssetPack("Blocks") tab = scene1.voxels.blocks:new("Table") tab.setTexture(ALL, "Blocks:Table") scene1.voxels:fill("Table") scene1.voxels.visibleRadius=200 scene1.voxels:resize(vec3(60,1,60)) scene1.voxels.coordinates = vec3(50,50,50) cube(0,0,0,ss) parameter.action("cycleSideSize", function() ss = ss * 3 if ss > 81 then ss = 3 end cube(0,0,0,ss) end) end function update(dt) scene1:update(dt) end function draw() update(DeltaTime) scene1:draw() end function cube(x,y,z,size) local s=size/3 for x1=-s,s,s do for y1=-s,s,s do for z1=-s,s,s do if (y1~=0 or z1~=0) and (x1~=0 or z1~=0) and (x1~=0 or y1~=0) then if size~=3 then cube(x1+x,y1+y,z1+z,s) else scene1.voxels:block((x1+x+50),(y1+y+50),(z1+z+50)) end end end end end v.zoom = size * 2 end

    @John, @Simeon: if neither dave1707 nor I can easily figure out how to delete voxels maybe that means it needs clearer documentation?

  • Posts: 2,219

    @dave1707 - your lates demo crashes if the parameter variable size gets above 3. @Simeon - had a crash with this, didn’t send report but will reproduce and forward report.

  • Posts: 1,166

    @dave1707 , @Bri_G it must be a device thing, because it didn’t crash for me.

  • edited June 2 Posts: 2,219

    @dave1707 @UberGoober @Simeon - it seems to be getting progressively worse. Now crashing when I load the project.

    What’s the safe way of re-installing without losing projects? Installing an older version?

    Reverted to 279 but still crashing.

  • dave1707dave1707 Mod
    Posts: 9,243

    @Bri_G You can load older versions of the beta code by going into TestFlight and selecting Previous builds for Codea. It does nothing to the projects when loading other versions.

  • Posts: 2,219

    @dave1707 - just as I suspected, thanks. I don’t find the need often so just checking. Already switched to 279 and have the same problem with crashing on changing the size.

  • dave1707dave1707 Mod
    Posts: 9,243

    @Bri_G What device are you using and memory size

  • Posts: 2,219
    @dave1707 - iPad pro 11" 256 meg.
  • dave1707dave1707 Mod
    Posts: 9,243

    @Bri_G The above code ran OK on my 12.9” iPad Pro 1 with 128gb.

  • dave1707dave1707 Mod
    edited June 2 Posts: 9,243

    Here’s an updated version.

    viewer.mode=STANDARD
    
    function setup()
        tab1={3,9,27,81}
        parameter.action("next",nxt)    
        colr={color(255,0,0),color(0,255,0),
                color(0,255,255),color(255,255,0)}
        assert(OrbitViewer, "Please include Cameras as a dependency")
        scene = craft.scene() 
        v=scene.camera:add(OrbitViewer,vec3(50,50,50), 8, 0, 1000)
        v.rx=30
        v.ry=30
        count=-1
        entity = scene:entity()
        volume = entity:add(craft.volume, 300, 300, 300)
        ss=3
        val=1
        cube(0,0,0,3)  
    end
    
    function update(dt)
        scene:update(dt)
    end
    
    function draw()
        update(DeltaTime)
        scene:draw()  
    end
    
    function nxt()   
        clr=true
        cube(0,0,0,ss)
        val=val+1
        if val>4 then
            val=1
            v.zoom=3
        end
        ss=tab1[val]
        clr=false
        cube(0,0,0,ss)
        v.zoom=v.zoom*2.8
    end
    
    function cube(x,y,z,size)
        local s=size//3
        for x1=-s,s,s do
            for y1=-s,s,s do
                for z1=-s,s,s do
                    if (y1~=0 or z1~=0) and (x1~=0 or z1~=0) and (x1~=0 or y1~=0) then
                        if size~=3 then
                            cube(x1+x,y1+y,z1+z,s)
                        else
                            if clr then
                                volume:set((x1+x+50), (y1+y+50), (z1+z+50), 'name', 'empty')
                            else
                                volume:set((x1+x+50), (y1+y+50), (z1+z+50), 'name', 'solid', 'color', colr[val])
                            end
                        end
                    end
                end            
            end
        end
    end   
    
  • Posts: 1,166
    @dave1707 that’s super fun, and I like how you’re placing the camera. The one thing I miss is how, at the biggest size, you used to be able to see it build itself piece by piece. That was cool.
  • Posts: 1,166

    @dave1707 it seems like for some reason your latest one skips past the final iteration.

    I see it for a second and then it goes back to the single block, not sure why.

    Also it looks like this is how you are clearing blocks:

    volume:set((x1+x+50), (y1+y+50), (z1+z+50), 'name', 'empty')

    How did you figure that out?

  • edited June 2 Posts: 1,166

    @dave1707 sorry to spam the thread: the other thing I miss is the depth, with all the colors it’s hard to see where the holes are in the structure. Is there a way to deepen the shadows? I tried creating a light entity and boosting the intensity really high but it didn’t seem to do anything

    Edit

    This seems to do something like it:


    scene.sun.rotation = quat.eulerAngles(45,0,45) scene.ambientColor = color(0) skyMaterial = scene.sky.material skyMaterial.horizon = color(46, 70, 76) cameraComponent = scene.camera:get(craft.camera) cameraComponent.hdr = true cameraComponent.colorTextureEnabled = true sunLight = scene.sun:get(craft.light) sunLight.intenstity = 100
  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober I modified the above code again.

  • Posts: 1,166

    @dave1707 I think this got lost in the posts but I am genuinely interested: how did you figure out how to delete blocks?

    I feel like there are all these Craft features buried somewhere that I can't learn about directly from the documentation.

  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober I looked thru the Craft examples and reference for anything that looked like it might work. That’s about all you can do.

  • edited June 2 Posts: 2,219

    @dave1707 @Simeon - Codea 3.3.2 (276) doesn’t crash - that’s with the latter demos.

    Update - when run the earlier @dave1707 demo with manual editing the value of ss - with 9 it was OK, 27 OK then 21 crash.

    Subsequently crashed as before, even with other demos above. Can someone try to duplicate this, starting to worry about my machine.

  • dave1707dave1707 Mod
    Posts: 9,243

    @Bri_G The only ss values that will work with that code is 3, 9, 27, and 81. Going one more increment to 243 doesn’t display the cube, but just one layer, or else it crashes.

  • Posts: 2,219

    @dave1707 - thanks for the feedback, you confirmed that it crashes. After the first crash I found running the other demos started to crash. Almost like some part of Craft had been damaged with the out of bounds entry for ss.

  • dave1707dave1707 Mod
    edited June 2 Posts: 9,243

    @Bri_G It only crashes sometimes when ss = 243. The other 4 values run OK. Here’s a smaller version.


    function setup() ss=3 assert(OrbitViewer, "Please include Cameras as a dependency") scene = craft.scene() v=scene.camera:add(OrbitViewer,vec3(50,50,50), 6*ss, 0, 1000) v.rx=30 v.ry=30 entity = scene:entity() volume = entity:add(craft.volume, 300, 300, 300) cube(0,0,0,ss) end function update(dt) scene:update(dt) end function draw() update(DeltaTime) scene:draw() end function cube(x,y,z,size) local s=size//3 for x1=-s,s,s do for y1=-s,s,s do for z1=-s,s,s do if (y1~=0 or z1~=0) and (x1~=0 or z1~=0) and (x1~=0 or y1~=0) then if size~=3 then cube(x1+x,y1+y,z1+z,s) else volume:set((x1+x+50), (y1+y+50), (z1+z+50), 'name', 'solid', 'color', color(255,255,0)) end end end end end end
  • Posts: 2,219

    @dave1707 - hmmm, sounds like there is a problem in Craft. In some. of the other values entered for ss Codea fired out a series of errors. Very inconsistent.

  • dave1707dave1707 Mod
    edited June 2 Posts: 9,243

    @Bri_G I think for ss=243, I might be exceeding the limits that are set for Craft, so I don’t see that as a problem, just a limit. The other values, 3,9,27,81 should run fine. Any other value for ss will cause problems because the code in the function cube() is only for powers of 3. Anything else and it will get messed up.

    PS. At ss=243, I’m trying to plot 3.2 million cubes on the screen.

  • Posts: 1,166

    @dave1707 “plotting” doesn’t mean rendering thought right?

    I thought one of the tricks of the voxel engine is that it doesn’t render non-visible edges, so the ones that can’t be seen are really just coordinates in a table, or do I have that wrong?

  • dave1707dave1707 Mod
    Posts: 9,243

    @UberGoober I don’t know if they’re being rendered or not. I just know at ss=243, I’m calling volume:set 3.2 million times. Sometimes I get a partial cube, other times it crashes.

Sign In or Register to comment.