Posts: 451
Threads: 34
Likes Received: 359 in 246 posts
Likes Given: 178
Joined: Aug 2023
Reputation:
17
07-08-2024, 09:29 AM
(This post was last modified: 07-08-2024, 01:26 PM by litdev.)
(07-07-2024, 06:22 PM)AbsoluteBeginner Wrote: I am surprised by the 3D capabilities of Small Basic that SB received from the LD extension.
It seems to me that if I see a few more such expressive examples of 3D applications, then I will also have different ideas so that I can test myself in 3D programming.
To be honest, most of the effort writing this kind of thing is all the extra bits that make a game such as intro screen, scoring, levels, level editor (VLFW776.000-0), testing etc.
There is also a bit of learning about the basics of 3D - You can see I just use squashed cubes and used spheres which are single commands in SB - you then build objects by having several of them (created and positioned in a for loop). You need to understand the 3D coordinate system X,Y,Z how to position and point things like objects, lights and the camera and that's about it.
As I say, if you look at the code, the actual 3D stuff is minimal, the rest is just making a game around it. I am very happy to help you guys get started with this (this is what I hope this forum can be for) - the process is to create small test programs to gain understanding first, just like with your AI game or ZS's extension - its step by step and the magic comes when you put all the little bits together!
Ideally, if a few of you are interested we can start at the beginning and work on 3D, physics or game design. Otherwise I can only share bits of code occasionally which I don't think gets things so much further forward and may put people off.
How about a 'game of life' in 3D using Elzaimer's idea ( https://litdev.uk/mybb/showthread.php?tid=95)?
Posts: 317
Threads: 37
Likes Received: 109 in 86 posts
Likes Given: 214
Joined: Dec 2023
Reputation:
7
I like your idea and i am eager to learn 3d and also physics engine.
But i have seen ld3d maze example it work very slow could our ld3d speed increase.
at last i will be extremely happy to learn something new
ZS
Posts: 451
Threads: 34
Likes Received: 359 in 246 posts
Likes Given: 178
Joined: Aug 2023
Reputation:
17
07-08-2024, 12:06 PM
(This post was last modified: 07-08-2024, 12:13 PM by litdev.)
SB anything is never going to blazing fast!
It is however a great place to learn and with careful coding good things can be done. But, ultimately to get better performance you have to use better hardware and code more directly for it. We are not going to be writing GPU shader code in SB sometime soon. The LD extension is as fast as it can be reasonably be made, many of the overheads in SB are due to the 'Primitive' data type and arrays so careful use of LDList, LDArray and LDFastArray can go some way to improve things. Often best to have good program design and limit things as necessary.
So if a few of you want to try writing 3D stuff, then we can have a thread for it (so I split to this one) - as always the first will be the equivalent of "Hello World" - get anything/something to show up in 3D!
So, anyone interested in joining the 3D jouney, first challenge:
*** Try to create anything that shows something in 3D using LD3DView without copying existing code! ***
And share your code to help each other.
Posts: 395
Threads: 15
Likes Received: 123 in 106 posts
Likes Given: 203
Joined: Sep 2023
Reputation:
6
(translated by Google translator)
After publishing the code "Rabbit AI M3" (Rabbit with the third mutation), I want to start studying the SmallBasicANN extension (neural network).
To use a neural network skillfully, I want to see the process that occurs in the neural network during training and use.
I will try to write a 3D program that will allow me to observe processes in a neural network as if I were flying in and around the neural structure.
( I can imagine how beautiful it will be there!!! )
Posts: 317
Threads: 37
Likes Received: 109 in 86 posts
Likes Given: 214
Joined: Dec 2023
Reputation:
7
Here my effort first save then try : XXNS627.000
ZS
The following 1 user Likes z-s's post:1 user Likes z-s's post
• litdev
Posts: 451
Threads: 34
Likes Received: 359 in 246 posts
Likes Given: 178
Joined: Aug 2023
Reputation:
17
07-08-2024, 04:08 PM
(This post was last modified: 07-08-2024, 07:40 PM by litdev.)
(07-08-2024, 03:52 PM)z-s Wrote: Here my effort first save then try : XXNS627.000
Wow , that's more than just something appearing in 3D, you have images, camera and creating a shape from points, not just using default geometries.
Lets see if any one else wants to join in - the first task is to get anything at all to display in 3D, not copying old code.
EDIT
Looks a bit like modified from one of the samples, can you do one from blank document without referring to any other sample code, just using intellisense to show something in 3D, only a few lines.
Posts: 395
Threads: 15
Likes Received: 123 in 106 posts
Likes Given: 203
Joined: Sep 2023
Reputation:
6
Hi all.
What do you think about the idea of creating a new game "3D Life"?
Everyone knows about what objects are born and die in the two-dimensional game "Life".
Can you imagine what objects will be born in the three-dimensional world?
Posts: 451
Threads: 34
Likes Received: 359 in 246 posts
Likes Given: 178
Joined: Aug 2023
Reputation:
17
07-10-2024, 08:39 AM
(This post was last modified: 07-10-2024, 08:44 AM by litdev.)
AB/anyone interested in 3D
First step into 3D is to try to write a very short program just using intellisense to see something in 3D - probably less than 5 lines!
Start with LD3DView.AddView ...
If we get a few takers along with ZS, then we can go through more 3D stuff bit by bit like Cameras, Geometries (points, indices, normals), Materials, Lights, Moving, rotating, animating objects and camera ...
Also look at https://learn.microsoft.com/en-us/dotnet...esktop-4.8
Posts: 317
Threads: 37
Likes Received: 109 in 86 posts
Likes Given: 214
Joined: Dec 2023
Reputation:
7
Just This Is My hardest Topic For Learning 3D World Of SB The Coordinates X,Y,Z In The 3D World I Got The Image From Litdev's Give Link About WPF 3D World.
How Easy 2D World Was Only Two Coordinates X,Y We Could Draw Shapes So Easily.
But 3D World Is Really Hard For Beginners Like Me
So I Gone To ChatGPT For Some Understanding.
[*] 2D Coordinate System: - Origin: Located at the upper-left corner of the rendering area (typically the screen).
- Axes Orientation:
- X-axis: Positive values extend to the right.
- Y-axis: Positive values extend downward.
[*] 3D Coordinate System: - Origin: Located at the center of the rendering area.
- Axes Orientation:
- X-axis: Positive values extend to the right.
- Y-axis: Positive values extend upward.
- Z-axis: Positive values extend outward from the origin, towards the viewer.
Then I Open SB And Made Following Code:
Code: GraphicsWindow.BackgroundColor = "LightBlue"
view = LD3DView.AddView(GraphicsWindow.Width,GraphicsWindow.Height,"True")
Point_A = "0 0 0"
Point_B = "2 0 0"
Point_C = "2 3 0"
Point_D = "0 3 0"
all = Point_A + ":" + Point_B + ":" + Point_C + ":" + Point_D
obj = LD3DView.AddGeometry(view,all,"","","Red","E")
I Tested Looked Like A 2D Right Angle Triangle.
Added Following Code Segment From Litdev Sample For Rotating Camera.
The Final Code:
Code: GraphicsWindow.BackgroundColor = "LightBlue"
view = LD3DView.AddView(GraphicsWindow.Width,GraphicsWindow.Height,"True")
Point_A = "0 0 0"
Point_B = "2 0 0"
Point_C = "2 3 0"
Point_D = "0 3 0"
all = Point_A + ":" + Point_B + ":" + Point_C + ":" + Point_D
obj = LD3DView.AddGeometry(view,all,"","","Red","E")
While ("True")
'Use the keys to move the camera
yaw = 0
pitch = 0
roll = 0
move = 0
If (LDUtilities.KeyDown("Left")) Then
yaw = yaw-1
EndIf
If (LDUtilities.KeyDown("Right")) Then
yaw = yaw+1
EndIf
If (LDUtilities.KeyDown("Up")) Then
pitch = pitch-1
EndIf
If (LDUtilities.KeyDown("Down")) Then
pitch = pitch+1
EndIf
If (LDUtilities.KeyDown("A")) Then
roll = roll+1
EndIf
If (LDUtilities.KeyDown("D")) Then
roll = roll-1
EndIf
If (LDUtilities.KeyDown("W")) Then
move = move+1
EndIf
If (LDUtilities.KeyDown("S")) Then
move = move-1
EndIf
LD3DView.MoveCamera(view,yaw,pitch,roll,move) 'These are relative changes wrt current view
Program.Delay(10)
EndWhile
Import ID : ZBQM826.000
Now I Am Having Fun By Changing X Y Z Point's In Code.
ZS
Posts: 451
Threads: 34
Likes Received: 359 in 246 posts
Likes Given: 178
Joined: Aug 2023
Reputation:
17
07-10-2024, 10:02 AM
(This post was last modified: 07-10-2024, 10:26 AM by litdev.)
Great job,
In the first instance it is probably easiest to use some of the premade objects, LD3DView.Add.. (like cube, sphere tube etc). You can go a long way with these in most cases. To make more complex objects, generally you would use some other program like blender to create them, but it is great to understand that everything in 3D is ultimately made up of triangles, with normals (vectors pointing outwards). The ordering of the triangle corners along with normals define whether we see the triangle or not and how it reflects light (we see the front, but not the back in general).
The coordinates are X (left/right), Y(down/up), Z(in/out) by convention from - to +, but since you can move and point the camera in any direction, what you actually see will depend on from where you look. By default LD3DView starts with camera at 0,0,10 looking in direction 0,0,-1. This is 10 units out of the page looking into the page. Most default shapes are created with unit size, centered on (0,0,0) - this will make them easier to move when we get there.
So try adding a sphere, try changing its colour, experiment with using material type "E" and "D" to start with. Also then experiment with using the LD3DView.AutoControl(2) methods and understand the differences between them.
|