Simple HTML5 Wesnoth implementation

Discuss the development of other free/open-source games, as well as other games in general.

Moderators: Forum Moderators, Developers

Simple HTML5 Wesnoth implementation

Postby apsillers » August 2nd, 2016, 1:36 pm

Last year I worked on a pet project called "Lords of the Fey" which is a re-implementation of some of Wesnoth multiplayer in a browser using HTML5. Code is at https://github.com/apsillers/lords-of-the-fey, with a test server up at https://lotf-apsillers.rhcloud.com.

So far I've only implemented a tiny fraction of Wesnoth functionality: Rebel and Northerners factions, some terrain types, recruiting, combat, villages. There's no animations, fog of war, multi-turn move planning, sound, damage calculator, terrain transitions, etc. (I'm interested in the possibility of pulling in functionality from wesnoth-tiles to handle map-drawing.) I was waiting to share this until at least some of those were completed, but I think this project will never be in a place that I feel is "ready to share" so I thought I might as well share it now. (I haven't done any work on it several months.)

My long-term goal for the project is to make a persistent, large world map, which player can fight over by playing games of Wesnoth. (Think of the board game Risk, but instead of rolling dice, you play complete games of Wesnoth.) As it stands right now, though, the game is just a simple implementation of Wesnoth-like gameplay in the browser.

One feature I did implement that I like a lot is the ability to send a link to a game that immediately grants control of a player without logging in. Only one person needs to make an account and great a game, and then the creator can invite friends to play without forcing them to create an account first. For instance, in the game at https://lotf-apsillers.rhcloud.com/client/#game=57a097774509d4feb8864cfb, player 1 is a logged-in player, but you can control player 2 - 4 by visiting the links

* Player 2: https://lotf-apsillers.rhcloud.com/clie ... 4662872851
* Player 3: https://lotf-apsillers.rhcloud.com/clie ... 5804156214
* Player 4: https://lotf-apsillers.rhcloud.com/clie ... 1396288574

You can only do anything as a particular player if it's their turn, so only one of those links will allow you to control units at any given time. (Advance move planning during your off-turn is not implemented.)

Note that this implementation isn't compatible with the real game, because it uses a JSON representation for units, factions, and moves, rather than WML. If I had a WML parser written in JavaScript, it might be possible to actually use data files directly from BfW (and -- even more far-off -- potentially communicate with a BfW game sever).
apsillers
 
Posts: 1
Joined: May 18th, 2010, 12:28 am

Re: Simple HTML5 Wesnoth implementation

Postby bumbadadabum » August 4th, 2016, 4:25 pm

Wow this is really cool.
User avatar
bumbadadabum
Developer
 
Posts: 1004
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: Simple HTML5 Wesnoth implementation

Postby ancestral » August 8th, 2016, 6:28 am

Neat! Reminds me of my prototype Wesnoth-Canvas project. (Feel free to pilfer or steal whatever you like from it.)
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
ancestral
macOS Packager
 
Posts: 1107
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Simple HTML5 Wesnoth implementation

Postby Shadow_Walker » January 3rd, 2017, 3:19 am

Don't make my mistake, please start using pixi.js as early as possible. It gives you the power of WebGL, so your 2d game will run draw much faster, and it will allow you to use GL effects for things like fog of war.
Shadow_Walker
 
Posts: 80
Joined: July 27th, 2014, 4:34 pm


Return to Game Development

Who is online

Users browsing this forum: No registered users and 2 guests