javascript_terminal_v3_rant
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
javascript_terminal_v3_rant [2023/11/24 06:15] – appledog | javascript_terminal_v3_rant [2023/11/29 01:03] (current) – appledog | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | = JavaScript Terminal | + | [[JavaScript Terminal |
- | Based on the ideas I came up with trying to write NetWhack in different languages and environments I hit upon the idea of having the game itself start out as a terminal simulator, and then writing the game engine to operate as a sort of thing, inside the environment of the terminal simulator. | + | |
- | + | ||
- | I found that if I chopped up the logic in a more granular way, I could achieve effects like string input. | + | |
- | + | ||
- | But as I developed this system more and more what I started to understand was that I had invented some kind of new computer language, and I was actually programming in (JavaScript)+new language to get things done that JavaScript couldn' | + | |
- | + | ||
- | Actually, I started to realize that is not such a bad idea. | + | |
- | + | ||
- | The game is already kind of running in a virtual machine, the terminal emulation side of the program. Why not fully embrace it? | + | |
- | + | ||
- | Today' | + | |
- | + | ||
- | Yeah it's a lot of work, but not as much as you might think. And the re-usability... the chance to do things right this time, like it was the first time... | + | |
- | + | ||
- | == Perspective | + | |
- | I could move from the bottom up, the top down, or the middle. Bottom up is writing a machine from scratch then writing an os for it, then writing tools, then writing netwhack in it. This would mean netwhack would run the same on any hardware forever. That's kind of cool, it's also a contribution to the community in terms of reusability. But I could also go from the top down, and just keep adding state, adding state, and breaking things up, until I have achieved almost the same thing. | + | |
- | + | ||
- | For example I could have a class called ' | + | |
- | + | ||
- | And I just keep abstracting and refactoring until I get a bunch of function calls that look like CPU instructions. At least to the point where the script I have essentially written allows me to do | + | |
- | + | ||
- | < | + | |
- | 10 A = INPUT() | + | |
- | 20 IF (A == ' | + | |
- | 30 C = GETKEY() | + | |
- | </ | + | |
- | + | ||
- | And what I have basically done, pun intended, is invent some kind of BASIC. | + | |
- | + | ||
- | < | + | |
- | 10 STORE C | + | |
- | 20 CALL GETKEY | + | |
- | 30 GET C | + | |
- | 40 IF C IS ABOVE 90 GOTO 10 | + | |
- | </ | + | |
- | + | ||
- | Whats with the 10, 20, 30? They' | + | |
- | + | ||
- | The point is, that there are many contexts. Suddenly I can fork(). In Javascript. But it runs in a single thread. | + | |
- | + | ||
- | I would have to re-implement print. But I have already grokked the logic of puts, etc. as shown not just in Java Netwhack but JavaScript Terminal Demo v2. This can be done. And once I have written it (i.e, written stdlib for the machine) truly amazing and beautiful things could happen. | + | |
- | + | ||
- | == Web Assembly | + | |
- | What about Emscripten? You can compile C/C++ for JavaScript! | + | |
- | + | ||
- | Yeah, but you can't fork(), you can't getkey(), and you can't access the DOM. These problems are trivial in my imagined CPU in a JavaScript Box. | + | |
- | + | ||
- | Web Assembly is an utter failure and it was designed to be a failure. | + | |
- | + | ||
- | This isn't even a plugin. I don't need anyone' | + | |
- | + |
javascript_terminal_v3_rant.1700806509.txt.gz · Last modified: 2023/11/24 06:15 by appledog