darozak / Advolition

1 stars 0 forks source link

What would be the best language to use? #1

Closed darozak closed 7 months ago

darozak commented 7 months ago

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?

darozak commented 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.

darozak commented 7 months ago

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.

darozak commented 7 months ago

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.

darozak commented 7 months ago

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.

darozak commented 7 months ago

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.

darozak commented 7 months ago

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.