In which case I wonder why you chose what is, superficially, an enormously more complicated approach than just using the standard BBC BASIC 3D libraries. Perhaps you wanted to set yourself a very difficult challenge, which is admirable, but it's a shame that cross-platform compatibility has been sacrificed in the process. Personally I'm lazy and always go for the easiest option!
Not Quite MineCraft
Re: Not Quite MineCraft
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Not Quite MineCraft
I did try a couple of other methods of rendering, but unless you render all vertices in one buffer, once the number of objects gets beyond a few thousand the whole thing slows down to an unacceptable speed. As mentioned before, 5 FPS or worse. Hence what looks like a massively over complicated way of doing it, but the results speak for themselves. Even with the use of staging textures on every other pass, it still runs at nearly 70 FPS.
Does the video link work?
Kind regards Ric
Does the video link work?
Kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Not Quite MineCraft
Mike,
Have you had the latest update working, even if you have to adjust the SCREEN_WIDTH%. In the new version it is S_W% and S_H%.
Kind regards Ric
Have you had the latest update working, even if you have to adjust the SCREEN_WIDTH%. In the new version it is S_W% and S_H%.
Kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Not Quite MineCraft
My apologies, this is the YouTube link
https://youtu.be/8W3kZvjMtLQ
I did say I didn't know what I was doing
Happy viewing
Kind regards Ric
https://youtu.be/8W3kZvjMtLQ
I did say I didn't know what I was doing
Happy viewing
Kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Re: Not Quite MineCraft
Absolutely. But rendering tens of thousands of vertices as one object is, of course, what 3D rendering (including the BBC BASIC libraries) is all about.

The complication is how to edit that object 'on the fly', in order to replace the block which previously had 'focus' and remove the block which now has focus. But I don't see any reason why that should be more difficult when rendering it with the standard library.
Admittedly I've not looked into how to do that in Direct3D at all, whether D3D9 or D3D11, but it looks straightforward enough in OpenGL. I wouldn't be trying to do it every frame, it might not be fast enough for that, but only when the 'focus' block changes.
No, you misunderstand, What seems much more complicated, to me, is using D3D11 rather than the BBC BASIC library. Using a single object to represent the world (which is what I suggested, before you said it's what you already do) isn't particularly complicated, so long as you can figure out how to edit it.Hence what looks like a massively over complicated way of doing it
Anyway, we are where we are. I agree that there's no practical way your program could be ported to BBCSDL.
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Not Quite MineCraft
Exactly. The edit is quite easy, if you order the vertices as triangles with X + Y shifted a bit + z shifted a bit more all the triangles(faces) align numerically and then a simple search to find the place in the list.
Have you managed to run the code yet?
Kind regards Ric
Have you managed to run the code yet?
Kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Re: Not Quite MineCraft
I haven't tried it since getting the 'Bad subscript' errors.
One comment on the general appearance: the lighting is very 'flat'. Something you get for free from the BBC BASIC libraries (sorry to keep banging on about them!) is up to five lights, which can be point source, directional or spotlight, plus specular reflections. I don't know how easy it is to add lights in D3D11, but if you can the subjective appearance would probably be greatly improved.
Getting the lighting to work in the web (browser) edition of BBCSDL was fun, because I had to write shader code from scratch to emulate what the OpenGL and OpenGLES Fixed Function Pipelines provide, but WebGL doesn't. It gives similar, but not identical, results; my spotlight is far better than theirs because it uses per-pixel calculations (in the fragment shader) rather than per-vertex calculations as the Fixed Function Pipelines do.
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Not Quite MineCraft
The lighting is just a simple directional light, if needed I will add more later, they are mainly generated in the shaders too, so pixel accuracy is achieved. I posted some d3d11 tutorials for the different types of light, when the game has objects like torches, I will implement more light then.
I don't know about d3d9 but in d3d11 when you want more lights with little or no speed implications, you use a render to texture that accepts as output the normals from the scene, then one pass as a 2d textue and multiply by all the lights in the scene ( this then only performs light calcs on the pixels that can be seen) which can be added all as one using a matrix, so many, many lights can be used, and then add to the original scene. Sounds complicated, but once you get to grips with d3d11, most of this type of function can be added with simple loops.
Kind regards Ric
I don't know about d3d9 but in d3d11 when you want more lights with little or no speed implications, you use a render to texture that accepts as output the normals from the scene, then one pass as a 2d textue and multiply by all the lights in the scene ( this then only performs light calcs on the pixels that can be seen) which can be added all as one using a matrix, so many, many lights can be used, and then add to the original scene. Sounds complicated, but once you get to grips with d3d11, most of this type of function can be added with simple loops.
Kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Re: Not Quite MineCraft
Lighting is much easier when using the BBC BASIC libraries because it's built in as a standard feature. You need only look at any of the supplied 3D examples which use lighting (most do) to see how straightforward it is. The most complicated lighting arrangement is used in bbcowl.bbc because it was designed to match the BBC's original OWL rendering, here is the relevant code (BBCSDL version):
Code: Select all
DIM light{(4) Type%, Diffuse{r%,g%,b%,a%}, Specular{r%,g%,b%,a%}, \
\ Ambient{r%,g%,b%,a%}, Position{x%,y%,z%}, Direction{x%,y%,z%}, \
\ Range%, Falloff%, Attenuation0%, Attenuation1%, Attenuation2%, \
\ Theta%, Phi%}
light{(0)}.Type% = 1 : REM point source
light{(0)}.Diffuse.r% = FN_f4(1)
light{(0)}.Diffuse.g% = FN_f4(1)
light{(0)}.Diffuse.b% = FN_f4(1)
light{(0)}.Position.z% = FN_f4(-1000)
light{(1)}.Type% = 1 : REM point source
light{(1)}.Specular.r% = FN_f4(.6)
light{(1)}.Specular.g% = FN_f4(.6)
light{(1)}.Specular.b% = FN_f4(.6)
light{(1)}.Position.x% = FN_f4(-10)
light{(1)}.Position.y% = FN_f4(100)
light{(1)}.Position.z% = FN_f4(-100)
light{(1)}.Range% = FN_f4(200)
light{(1)}.Attenuation0% = FN_f4(1.0)
light{(2)}.Type% = 1 : REM point source
light{(2)}.Diffuse.r% = FN_f4(2)
light{(2)}.Diffuse.g% = FN_f4(2)
light{(2)}.Diffuse.b% = FN_f4(2)
light{(2)}.Position.x% = FN_f4(-4)
light{(2)}.Position.y% = FN_f4(4)
light{(2)}.Position.z% = FN_f4(5)
light{(2)}.Range% = FN_f4(200)
light{(2)}.Attenuation0% = FN_f4(1)
light{(3)}.Type% = 1 : REM point source
light{(3)}.Diffuse.r% = FN_f4(2)
light{(3)}.Diffuse.g% = FN_f4(2)
light{(3)}.Diffuse.b% = FN_f4(2)
light{(3)}.Position.x% = FN_f4(4)
light{(3)}.Position.y% = FN_f4(4)
light{(3)}.Position.z% = FN_f4(5)
light{(3)}.Range% = FN_f4(200)
light{(3)}.Attenuation0% = FN_f4(1)
light{(4)}.Type% = 1 : REM point source
light{(4)}.Diffuse.r% = FN_f4(2)
light{(4)}.Diffuse.g% = FN_f4(2)
light{(4)}.Diffuse.b% = FN_f4(2)
light{(4)}.Position.x% = FN_f4(0)
light{(4)}.Position.y% = FN_f4(-5)
light{(4)}.Position.z% = FN_f4(5)
light{(4)}.Range% = FN_f4(200)
light{(4)}.Attenuation0% = FN_f4(1)
Code: Select all
DIM Light@webgl{(4) position%,direction%,ambient%,diffuse%,specular%,angle%}
...
DATA "#define MAXLIGHTS 5"
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Not Quite MineCraft
I have a query about crashing BB4W.
I can replicate the circumstances in which my program crashes BB4W, but i cant trap it. Is there a way to find out why? I think it is to do with moving bits of memory about but cant be sure, can anyone help?
kind regards Ric
I can replicate the circumstances in which my program crashes BB4W, but i cant trap it. Is there a way to find out why? I think it is to do with moving bits of memory about but cant be sure, can anyone help?
kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023