codingtrain / oregon-trail Goto Github PK
View Code? Open in Web Editor NEWA p5.js version of the Apple ][ Oregon Trail Game
Home Page: https://ct-oregon-trail.netlify.app
A p5.js version of the Apple ][ Oregon Trail Game
Home Page: https://ct-oregon-trail.netlify.app
Edited: Disregard - most browsers won't support this solution anyway.
I was looking into the input.js source and there is actually an easier way to do that in CSS by modifying the caret: shape value and setting it to "block" instead. Either way works but maybe (?) the CSS way wouldn't look as confusing?
see: https://css-tricks.com/almanac/properties/c/caret-shape/
I have looked at the first few pages (before Matt's General Store) and here are all the page configurations that are in use.
Breakdown of the elements:
Breakdown of the elements:
Breakdown of the elements:
Breakdown of the elements:
Breakdown of the elements:
Breakdown of the elements:
Breakdown of the elements:
Breakdown of the elements:
There are a lot of page layouts that are not even the core game. Currently adding pages is hard and not efficient. Maybe a simple page editor that would generate the JSON code will solve this issue.
Maybe there is a better term, but taking the data from game_data.json
and rendering the text and choices.
Don't know if any of you have discovered this already but I found what appears to be the full game sprites for Oregon Trail. Perhaps these could be a useful reference for any graphic artists working on this? [Edited] Looks like they're for the PC version though.
Link: https://spritedatabase.net/game/2151
Could there maybe be a collection of saved screenshots organized some way, perhaps in numerical order notation, that could be used to simply paint an image of that screen and grab keyboard input to "play" an alpha version of this? Perhaps maybe whoever is doing the new artwork could refer to it as well?
Are you going to do it in BASIC, or p5.js? First question!
In order to test/play it without downloading it add this URL as website:
https://codingtrain.github.io/Oregon-Trail/
It seems like there should be only one in use.
So that code like this:
// From js/slide_manager.js lines 107-112
changePageTo(name) {
const page = this.getSlideByName(name);
if (page != undefined) {
this.currentSlide = page;
}
}
is less confusing:
changeSlideTo(name) {
const slide = this.getSlideByName(name);
if (slide != undefined) {
this.currentSlide = slide;
}
}
I can refactor it, but I need to know which one.
??????
Maybe a input
element is enough
(Been working on my own take on this while checking back here).... After a few attempts to build the various rooms I noticed that, for me anyway as a longtime hobby programmer, it looks like it will be easier to simply build the game world editor program first and then later the game itself. That way it'll be easier (?) to view, manage and update the json files while getting a visual idea of how these screen/pages are going to look like. and all fit together.
So the big question here is, wouldn't it be a better idea to build the world editor first? Because right now I'm seeing a problem here right away, in that the json files here don't seem to logically connect with something like a room number and pointers to/from other room numbers and room class types. Plus back-connector data as well.
Just for as an example on this, a simple "hit spacebar to continue" screen should have "nextRoom" and "prevRoom" data in it, esp. helpful for later bug testing. and of managing and updating the game world itself. To clarify, I don't mean the next or previous element in the json file but the actual room paths back and forth, because those may be different and in a game editor it's going to make more visual sense to page through how the player's going to see these screens.
For each "game slide" (page?), read prompts and describe imagery for screen readers. p5's describe()
function might be enough for this?
Right now for rendering a new line you must add a new element in the JSON string array.
@shiffman already suggested using the text()
function where you can specify the width and height of the textbox.
Hi,
i would like to propose a structure for the game data json file, which is called "slide_data.json" in the repository.
At the JSON root you have a start and end name as Entry- and Exitpoint for the game. Then you have a object called Pages, which holds all the Data for a given Page. Each Page has a Name to reference it in other Pages (think of it as an ID) and a type. The type determines, which Class should Render the Page. e.g. a Page with the Type "shop" should be rendered by the shop class. Everything the class would need to do it's job, would then be in the data object for the page. So when instantiating the Class, you would give it the data Object and it would know how to deal with this data.
This approach would be totally data driven. The type Classes would be instantiated with the data, and some other Class, propably a game Manager of some sort, would get the Instance and would go from there. You propably would need more than one class per Type, for the different game Mechanics, e.g. one for Rendering, one for taking over the input and so on.
The JSON could look something like this
{
"start": "startPage",
"end": "ending",
"pages": [{
"name": "startPage",
"type": "start",
"data": {
"title": "The Oregon Trail",
"choices": [{
"text": "Travel the trail",
"action": "changePage",
"newPageName": "travel",
}, {
"text": "Learn about the trail",
"action": "changePage",
"newPageName": "learn",
}, {
"text": "See the Oregon Top Ten",
"action": "changePage",
"newPageName": "topTen",
}, {
"text": "Turn sound off",
"action": "toggleSound",
"atlernativeText": "Turn sound on"
}],
"prompt": "What is your choice?",
"img": "img/title.png",
}
}, {
"type": "choice",
"name": "travel",
"data": {
"text": "First text",
"choices": [...],
"img": "",
"nextPage": "story1"
}
}, {
"type": "story",
"name": "story1",
"data": {
"texts": [
"This is the first text",
"This is the second text, which will appear after pressing space"
]
}
}, {
"type": "shop",
"name": "firstShop",
"data": {
"items": [{
"id": 1,
"name": "Some thing to buy",
"description": "This is a buyable thing",
"price": 1600
}],
"topText": "Here could be your shop text",
"nextPage": "pageAfterShop"
}
}]
}
Letters like ΓΌ or Δ and many more.
Also there is no exclamation mark.
Maybe some kind of Settings file to set some theming (font color, background color)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.