Closed darozak closed 7 months ago
I found a thread in Stack Overflow that shows how to execute JavaScript from a browser text box. It seems fairly straight forward. I'm wondering if there is a similar way to do this with PyScript.
Python seems like a great language but it has one major flaw: there are no such things as private methods or attributes. This means that if I were to create a class, someone could access any of the methods or variables used within it. In the case of the Advolition class, this means that someone could hack the game.
Java, on the other hand appears to be a good option because there are private class components, which are unavailable outside the class. Furthermore, it's possible to package multiple classes inside a package that is stored as a semi compiled binary code (a class file) and can be imported as a whole into a Java script for use.
It might be possible code JavaScript inside a simple HTML file and access the Advolition code from a hosted server. The Avolition class could contain functions that will automatically print results to the browser window.
One challenge of using JavaScript in a browser is that it will be had to use formatting. It is possible to surround the JavaScript code with simple html code and view it in the browser. You can also reference the file by pointing to it on your local machine. This could get a little messy if you want to use classes since each class file will need to be separately loaded into the browser.
After talking with Nick, JavaScript sounds like it will be the most flexible way to create a game that can be run locally or remotely with Node.js. It also works nicely with React, which I can use to build the web interface.
Another advantage of JavaScript is that it's easily accessible to students via the browser and doesn't require special installs. It can be programmed and run on a Chromebook.
I've started coding the game in JavaScript.
I just came up with a cool idea for a Rogue like adventure game in which player's program robots to remotely explore dungeons (https://github.com/darozak/Advolition/commit/5904f59c969ee58db6eaee11ab0ce758bf986009). This will capture all the objectives of my Tournament Robotics project without requiring people to 3d print and assemble their own robots. Essentially the robots will be virtual avatars for the players to work through. However, you must be able to code in order to win!
I think I can accomplish this by allowing the players to use an existing language but interact with the game through an Advolition Class that builds and manages an instance of the game.
The first question I need to answer is what coding language should I use?