We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3D maze in browser controlled by Small Basic
(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 )
Reply
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.
[-] The following 1 user Likes litdev's post:
  • stevantosic
Reply
Am I correct in understanding that line "LDNetwork.SendWebRequest(urlAsync+"isReady")" stops the execution of the SB program until the server finishes the animation?
Reply
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.
[-] The following 1 user Likes litdev's post:
  • stevantosic
Reply
I got it.  Cool

This is a very interesting opportunity ...

Thank you.  Shy
Reply
As an addition to comment https://litdev.uk/mybb/showthread.php?ti...35#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.
Reply
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
Reply


Forum Jump:


Users browsing this thread: 32 Guest(s)