javascript_netwhack
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| javascript_netwhack [2023/11/22 01:46] – appledog | javascript_netwhack [2025/11/30 16:08] (current) – removed appledog | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | = JavaScript NetWhack | ||
| - | * This is a late season3 project, and is elective. | ||
| - | * The code base is [[JavaScript Terminal V2]]. | ||
| - | * The technical demo for the codebase is playable at [[www.helloneo.ca/ | ||
| - | * The current version of NetWhack is playable at [[www.helloneo.ca/ | ||
| - | |||
| - | == Extending the Codebase | ||
| - | === Class Area | ||
| - | First, the data structures of the game will be created; Area (or Level) and Tile. An area is a collection of tiles. An Area can have a three dimensional collection of tiles. This will allow more vibrant dungeons where things on one level can trivially (in terms of game engine design) affect things on other levels. It allows for some interesting things to occurr ('You fool of a Took!' | ||
| - | |||
| - | === Class Tile | ||
| - | Anyways, Tile will hold an inventory array and it will dispay (look like) the top character. A lot of this design comes straight out of the Java version of NetWhack. The intent is to copy, or translate, the functionality of the Java code into JavaScript. This will not only demonstrate my knowledge of Java and JavaScript, but my practical ability and experience to translate codebases quickly, accurately and efficiently, | ||
| - | |||
| - | === UI design; Projecting the Map | ||
| - | Second, the update() function will have a projection function which will copy the active Area map, centered on the px,py location, onto the Terminal. However it will also display msgline1 and msgline2, which will be handled by the msg() function to provide proper word-wrap or hyphenation and a --more-- prompt (which is a special game mode called ' | ||
| - | |||
| - | As well, the update() projection method will also write character data at the bottom of the screen, like in NetHack or other roguelike games. The window size will be autocalculated and only what will fit in the map box will be projected from the Area class. This is already in Java NetWhack so the algorithm is already known. | ||
| - | |||
| - | === loadMap() | ||
| - | We will also need functions to load areas from textfiles. The way this worked in Java NetWhack is that there is a text file (or string) which is it's own processing language. The string is split by lines and line by line processed. Keywords such as "MAP 10x10" or " | ||
| - | |||
| - | === makeMap() | ||
| - | We will also need some random mapmaking methods, which can create the sort of strings above. | ||
| - | |||
| - | === saveGame() | ||
| - | We will also need a way to load and save map information (and so forth). In Java we tried to use Serialization and it kind of worked, but there were many subtle bugs that turned out to be implementation problems. Next we tried pickle in Python and it was ok but not what we wanted. | ||
| - | |||
| - | For JavaScript things seem easier since we have access to strong JSON compatability. The idea will be to create a function that dumps data into a JSON string and another that loads that same data. The data itself can be sent to a PHP script on the server which will do the heavy lifting of disk IO or My/SQL connection. | ||
| - | |||
| - | === Little Things | ||
| - | There are a lot of little things, like combat, turn priority (action points) and so forth that need to be implemented. And then, you will be able to play the game, in the sense that there is some kind of game world and you can move around in it and interact with it's rules. At that point we move to the content stage. | ||
| - | |||
| - | === Content | ||
| - | Content will be drawn from a large number of sources, but will shortly overtake the codebase in terms of size. Variety, do not forget, is the spice of life. | ||
javascript_netwhack.1700617581.txt.gz · Last modified: by appledog
