Small Basic Forum
3D maze in browser controlled by Small Basic - Printable Version

+- Small Basic Forum (https://litdev.uk/mybb)
+-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1)
+--- Forum: Discussion (https://litdev.uk/mybb/forumdisplay.php?fid=4)
+--- Thread: 3D maze in browser controlled by Small Basic (/showthread.php?tid=223)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: 3D maze in browser controlled by Small Basic - AbsoluteBeginner - 03-07-2025

(03-06-2025, 11:22 PM)litdev Wrote: ...

There are probably 3 people interested in this (you, me and AB who doesn't want constant change of the API).
...

Hi all.

I am very lucky in life, friends. I like to overcome difficulties that do not pose a threat to anyone.
I was interested in dealing with errors and delays on the server.
I'm interested even now, when there are no more errors and delays, because new entertaining difficulties of the development process in the project await me.  Rolleyes

( At the moment I am preparing ChatGPT for joint work on Small Basic programs. If I can teach ChatGPT to help me write good code, then I can continue my experiments in creating SB neural networks and AI using Small Basic. Without ChatGPT's help, I write code so slowly that it ruins most of the fun of programming for me.  Blush )


RE: 3D maze in browser controlled by Small Basic - litdev - 03-07-2025

Thinking of it like Turtle is a good idea.

The point of LDNetwork.SendWebRequestAsync is really that a program could use the cpu cycles while an animation is happenning.  Without this and just waiting, then the following 2 commands are pretty much equivalent to Turtle.Turn(45) operation for example.

Code:
LDNetwork.SendWebRequest("https://litdev.uk/apps/maze3D/maze3D.php?action=set&rotate=45") 'Start the animation
LDNetwork.SendWebRequest("https://litdev.uk/apps/maze3D/maze3Dasync.php?action=isReady") 'Wait for it to finish

In this way, PTSV104.000 can be simplified to PTSV104.000-0.


RE: 3D maze in browser controlled by Small Basic - AbsoluteBeginner - 03-07-2025

Am I correct in understanding that line "LDNetwork.SendWebRequest(urlAsync+"isReady")" stops the execution of the SB program until the server finishes the animation?


RE: 3D maze in browser controlled by Small Basic - litdev - 03-07-2025

Yes, urlAsync+"isReady" which in full is "https://litdev.uk/apps/maze3D/maze3Dasync.php?name=&action=isReady" is a command sent to the server that waits until all animations are completed and returns a message "Ready".  You can actually paste it into browser as a command as well, this is all LDNetwork.SendWebRequest does effectively.

So if we call LDNetwork.SendWebRequest("https://litdev.uk/apps/maze3D/maze3Dasync.php?action=isReady"), then SB waits until the server command returns (i.e. when animations are complete).

If we call LDNetwork.SendWebRequestAsync("https://litdev.uk/apps/maze3D/maze3Dasync.php?action=isReady"), then SB returns immediately and an event is fired (LDNetwork.WebRequestResult) when the server command finishes.  Therefore with this we could continue doing AI work in SB (rather than just waiting) while the animation completes, but only issuing the next command once the previous was completed.


RE: 3D maze in browser controlled by Small Basic - AbsoluteBeginner - 03-07-2025

I got it.  Cool

This is a very interesting opportunity ...

Thank you.  Shy


RE: 3D maze in browser controlled by Small Basic - litdev - 03-12-2025

As an addition to comment https://litdev.uk/mybb/showthread.php?tid=150&pid=1935#pid1935 #28
 
Comprehensive example (find all maze cells and BFS maze navigation) - Import MSRQ812.000

This was my (hopefully final) effort at a comprehensive test of animation - a few improvements made to the web server/client for this.  I believe this example and the web at https://litdev.uk/apps/maze3D/index.html are now pretty much ready to start thinking about competetive interaction with AI controlled robots in the maze.


RE: 3D maze in browser controlled by Small Basic - AbsoluteBeginner - 03-12-2025

This is very good news.  Smile

I think I am also well prepared enough to participate in code development using ChatGPT's capabilities.
I hope that now I will be able to create more code than before, while spending the same amount of time on development.  Rolleyes


RE: 3D maze in browser controlled by Small Basic - AbsoluteBeginner - 03-14-2025

Well, now that neural networks can increase the speed of my work with code, can someone tell me the first task for my robot's AI in the maze?  Cool

Wink


RE: 3D maze in browser controlled by Small Basic - litdev - 03-14-2025

If you look at the settings there 3 'game objectives' created so far:

1] Visit all cells: you can test with different maze layouts also set in settings.
2] Tag: A multi-robot Tag game where a single roboit is 'IT' and must tag other player robots, who should avoid being tagged, this would need the GetAll action to know where other robots are.
3] Hunt Yetis: single robot must enter the cell of all Yetis to capture them.

If you have other ideas I am interested to hear.


RE: 3D maze in browser controlled by Small Basic - AbsoluteBeginner - 03-15-2025

Hi all.

I want to start my robot's adventure in the maze using the "Yeti Hunt" scenario.
To begin with, my robot will move through the maze using the "movement along the left wall" algorithm.  Rolleyes
When the robot has the Yeti in its sights, my program will fire a virtual shot.
Then, the program will remember the name of the shot Yeti and will not react to it until the end of the cycle.
Next, the program will continue hunting for other Yetis whose names are not on the list of already obtained hunting trophies.

Once all the Yetis have been shot, the game cycle will end.
You can set the number of cycles in one game. After completing one cycle, the list of names of shot Yetis is cleared.
You can add to the game a measurement of the time it takes the robot to complete all the cycles of one game.

This is my starting scenario.  Cool