• Content count

  • Joined

  • Last visited

  • Days Won


mattstyles last won the day on August 25 2017

mattstyles had the most liked content!

About mattstyles

  • Rank
    Advanced Member

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
    Not Telling
  • Location

Recent Profile Visitors

5,456 profile views
  1. mattstyles

    New member want to say hi

    Welcome to the forums
  2. mattstyles

    Trying to make a Dating Sim...

    Unless your decision tree is absolutely huge there is no need to consider true database storage and all the issues that come with that, I imagine your data can be loaded in and that your application can be a stand-alone client-side application (which greatly simplifies things). It sounds a little like you are confusing two not-really related things: * How do I change application scenes? * How do I store the decision tree? I'm not really sure what a dating sim is so I'm going to assume it is a series of scenes, each with dialogue, and that your dialogue choices affect game play. Therefore, each scene has its own decision/dialogue graph. This really is a graph as nodes can be connected, but, if you can get away with it (you probably can), make it a tree. In a tree data flow down linear paths. i.e. A / \ B C / \ D E This really does simplify how you traverse and store this information. A graph structure is probably better, but its also a little trickier to use. Changing scenes is more to do with a larger change to your application and typically all games will have some aspect of this, they are often called game states but I think the term state is a little misleading as effectively the state of any system is made up of all of its constituent parts, not just whether that system is in the Main Menu or the Main Game states. Scene isn't perfect either, but its less confusing (to me anyway). Many applications apply a Finite State Machine to handle scenes, its hard to find an application without several state machines in operation, particularly where human interaction is expected. Phaser has a well-defined state machine mechanism with life cycle methods to handle scenes and their transitions. Maybe that would be a good place to do some research.
  3. mattstyles

    Lack of CoDs or CK2s that use HTML5/JS

    For rendering a browser gets pretty much the same access to the GPU as any other application, albeit with less control (and via an older spec, webgl isn't quite as good as you'd have with different avenues). For running calculations JS is impressively fast for a JIT compiled language but can't match any AOT languages such as most modern games would use. There is no getting around this, WASM (web assembly) is mooted, but, it may not quite get to the same place. There is also an argument that JS is not a particularly good language for larger teams, such as those involved in more complex application (i.e. AAA games). Again, there are some solutions for this, such as Haxe, TypeScript, Elm or even using LLVM to convert your code in to WASM (or JS), as always, there are trade-offs. The browser has some interesting restrictions that make achieving optimal performance tricky i.e. reliant on a platform canvas implementation, no UDP sockets, cross-platform differences are much trickier than most AAA games have to deal with etc etc. Websites have different load requirements than local applications i.e. most games require a hefty download (or a large storage device such as a CD or memory stick) to a local storage device, would you accept this wait every time you wanted to play? Because the browser is not permitted to store so much information locally (there are hacks around this, but, they are nasty) so you'd have it for every play. Browser users have expectations of browser-based applications that they typically do not for a local application, expectations can be broken down, but its hard. I still think there is one issue that trumps all of these above: monetisation. Closed application stores and closed source applications are opposed to the fundamentals the web is built on so a new method is required, which hasn't really happened yet.
  4. mattstyles

    How to display text based on variables

    You're almost certainly best of asking this in the Twine forums (I think they also have a Discord channel) to find out how to do it in that platform. In general programming you're talking about applied logic, specifically you're after a conditional. As this is (primarily) a javascript board the following is a JS example: // Create a variable, we're also initialising it here because we are pros var axe = 1 // Conditional if (axe === 1) { // This is an example of a function call, it just does 'something' setOption('Cut down the tree with an axe') } // Here is another function call setOption('Punch the tree') Twine has its own syntax (three by the looks of it) for doing the same as the above, in fact, I'm not sure I've ever heard of a programming language that can not do it.
  5. mattstyles

    Guidelines for posting in this board

    @pixel pugs you just got it, post and wait, now you just can post without the wait! Welcome to the forums.
  6. mattstyles

    Cobalt Dungeon

    I'm super late to the party, that write-up is awesome! Super super stuff. I've downloaded the game whilst typing this, it sounds a little similar to something I've been dabbling with on and off for a while without any real progress, really looking forward to playing your game.
  7. mattstyles

    SVG images not displaying in FF

    looks good in FF from here (59.02) Just updated to latest 61.0.1, still looking good
  8. mattstyles

    What lacks in HTML5 games in terms of revenue

    There are quite a few HTML based games already on iOS/Android/etc stores, they monetise (or attempt to) exactly as you suggest. All are valid ways to earn a crust. I don't know what services exist to save you coding, but, all of these things can be coded in to a web-based game.
  9. mattstyles

    How do i create a farmville like game ?

    Imagine it like a conversation: Client: Yo, server, whats the time? Server: Yo, fam, its 13:00 Client: Cool, let me just render this seed, and I'll leave a note saying when it was planted. Client: I'm outta here, see you later. Client: Yo, server, I'm back, whats the time? Server: Yo, its 15:00 Client: Cool, lets see, what did that note say? Oh yeah, right, ok, it was planted 2 hours ago, I'll render it as a plant now. And that is, pretty much, it.
  10. mattstyles

    Server-sided map with Node.js?

    These are super questions. Phaser is indeed a client side library, as it primarily handles audio/visual and user input that is no surprise (it also has various other helpers such as a state machine and some app logic stuff that might be useful elsewhere, but, largely, its client specific). There have been some efforts to get it running on the server, I'm not too sure on the use case (might just be for testing) but I don't think there was resounding success. I'd assume you can pull bits out of it you wanted elsewhere though. 1. I can't really help you as I don't know, but, poking through Phaser source files will help you see how it does and what it does with the Tiled data format/s, you may even be able to rip those out (using imports, or using Phaser.something, or, even good ole fashioned copy-paste some functions). Largely though the format you choose for your map relies on what you want out of it, I'd have thought Phaser would structure it in a nice way to render it and possibly do collision detection whilst being flexible enough for generic use-cases, you may not want this and may want to transform the json Tiled spits out (or, maybe its nice enough to work with as is and you just need to add some functions?). 2. WebGL is, in almost every case, faster. Also, your option is to either dig through canvas and context objects directly, or, use a wrapper library. Phaser v2.x uses Pixi.js for rendering, and Pixi is *only* really concerned with creating a scene graph so it can render your stuff _really really_ fast. There are alternatives out there also. Unless you really want to dig through (and learn) how the canvas works then I'd suggest using an off the shelf library to help. Having said that, is an awesome project! As you said you're new to OOP I thought it might be of interest as its extremely light on OOP and OOP-like stuff.
  11. mattstyles

    Question on performance

    Yeah, V8 (and likely all other engines) are really good at optimising hot paths, this would surely be such a target for it so perf differences would be extremely negligible if noticeable at all.
  12. mattstyles

    Duplicate frames in SpriteSheet removal

    Thanks for posting the solution, others will likely run in to this as well
  13. mattstyles

    Question on performance

    Many callbacks from browser/DOM (such as `requestAnimationFrame`) bind the callback, in the case of `Element.addEventListener` this becomes the Element, in the case of `requestAnimationFrame` it'll be the window. Depending on your use-case this re-binding might be undesirable, e.g. consider the following (I'll use the time honoured OOP/inheritance example of cat speak, particularly relevant given your avatar ): var cat = { name: 'mazoku', speak: function (str) { console.log(, 'says', str) } } cat.speak('hello') // mazoku says hello requestAnimationFrame(cat.speak) // undefined says 293878273.231 requestAnimationFrame(function () { cat.speak('hello') }) // mazoku says hello The above highlights 2 possible reasons you'd wrap in a function: * You don't want the re-binding * You want to call that function every tick, but supply your own parameters You can get around the binding issue by ditching OOP-like strategies and just pass plain functions in, however, you'll still want to handle the case of passing variables in, thankfully, JS supports closure and it's a very powerful thing to have at your disposal, and would work great here as one possible solution: function sayThis (str) { return function say () { console.log('hello', str) } } requestAnimationFrame(sayThis('world')) // hello world In this case `str` gets locked in the closure, this pattern is sometimes called a thunk, but, really, its just using closure.
  14. mattstyles

    Really Basic Setup question

    Ah, I see, without the specific protocol on the remote request it defaults to the protocol you were using, which was presumably 'file://', which, even if you had specified the protocol for the CDN wouldn't have worked anyway. Yeah, localhost has an http protocol so it would then route out to the internet. Good work solving it.
  15. mattstyles

    BabylonJS for ES6

    Modern browsers (and not so modern ones) are almost 100% compliant with the initial es6 specifications,, most are compliant with newer language features as well. Whether they are as performant as the transpiled es5-compliant code is far more shaky ground. Not sure what you mean here, ESLint is for checking certain syntaxes and structures in your source code and informing you of where you contravene a given ruleset. It doesn't do compilation or transpilation. Did you mean another tool? By efficient you should probably clarify that you mean it has a number of sugar methods that make code less verbose (not that verbosity is always a bad thing though). (almost) Everything from ES6 can be transpiled back to es5 so es6 doesn't support anything new, it just has a new syntax making some things a little nicer to write and less error-prone for the developer (the browser doesn't actually care and in many cases the old way is better optimised for the engine, if not for the developer writing it). (I think there are some odd things in the spec like tail call ops which are impossible to shim, but, everything else, including tricky stuff like generators and proxies, _can_ be shimmed, you'd probably never want to write code like that but transpilers can do it just fine).