vornay

JS game engines overkill for Interactive Fiction?

Recommended Posts

I see that the various JS game engines have text and text effects available, so they could be used to create an Interactive Fiction type of game. Would the 60FPS of these game engines cause a mobile device to run its battery down?  An IF game could potentially run on very little CPU. Using a game engine is interesting because a lot of the game-mechanics have already been done (input,audio,etc).

Share this post


Link to post
Share on other sites
On 9/24/2018 at 7:21 AM, vornay said:

Would the 60FPS of these game engines cause a mobile device to run its battery down?  An IF game could potentially run on very little CPU.

it depends on many factors (animations, transformation,  shaders?, etc.)  I think isn't going to be a problem.

 

On 9/24/2018 at 7:21 AM, vornay said:

Using a game engine is interesting because a lot of the game-mechanics have already been done (input,audio,etc).

Agree, e.g. Phaser. (or other game framework)

Share this post


Link to post
Share on other sites
On 9/24/2018 at 6:21 AM, vornay said:

I see that the various JS game engines have text and text effects available, so they could be used to create an Interactive Fiction type of game. (...) Using a game engine is interesting because a lot of the game-mechanics have already been done (input,audio,etc).

I don't think you need an engine but a framework would definitely be a good idea (such as Phaser), especially for cross-browser- & cross-platform-compatibility. Even if you would build the whole IF in HTML and CSS (outside the canvas) you'd proabably still look for a framework such as jQuery for the same reason: cross-browser- & cross-platform compatibility.

On 9/24/2018 at 6:21 AM, vornay said:

Would the 60FPS of these game engines cause a mobile device to run its battery down?  An IF game could potentially run on very little CPU.

Sorry, I don't know this. I don't know if running the IF inside the canvas takes more CPU than simply creating it as a website with HTML and CSS.

Share this post


Link to post
Share on other sites

Sure, I'll be the voice of dissent :)

Canvas is probably the worst target for interactive fiction.

The majority of features that you are looking for a framework to provide are offered by default in the browser itself. The reason we even needed JS game frameworks is because the Canvas element requires you to recreate from scratch the functionality that the browser DOM gives you for free. I'd even argue that unless you plan to support IE 6 or old Android browsers, compatibility is a non-issue, so even something like jQuery isn't required (but can be useful).

PROS

  • Text is exponentially easier to manage on the DOM. Word wrap, inline styling, scrolling, selectability, input, etc. are all native browser features and don't require canvas hacks to recreate.
  • Your game can be responsive, conforming to the end user's device in ways more meaningful than simply scaling.
  • The DOM will repaint more efficiently and do it only as needed.
  • Complex text effects, styling, animation and tweening are easily added with CSS and will automatically update with the screen refresh.
  • The entire browser window and all its features can be your playground - break out of the canvas box paradigm!
  • You're just changing the presentation layer. The rest of your game logic (event listeners, etc.) is still plain JavaScript.
  • Your game should be more lightweight since half of the code you would need to get canvas to work is already taken care of for you in the browser.

CONS

  • CSS can be a bit tricky if you're not familiar with it.
  • You sacrifice some control of your presentation. The browser useragent can override your styles and increase text size and contrast for accessibility / visually impaired users if they want it to.

I'd urge you to consider just using the plain old DOM for an IF project. Simply start with a test. Pick a very thin vertical slice of your game with the features you are looking for and try to mock it up in both canvas and DOM and see which works better for you. My 2 cents.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.