Simple HTML5 Wesnoth implementation
Moderator: Forum Moderators
Simple HTML5 Wesnoth implementation
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/clie ... feb8864cfb, 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).
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/clie ... feb8864cfb, 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).
- bumbadadabum
- Developer
- Posts: 1005
- Joined: March 20th, 2008, 5:54 pm
- Location: Netherlands
- Contact:
Re: Simple HTML5 Wesnoth implementation
Wow this is really cool.
Creator of the Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
Wesnoth-UMC-dev, a nice place for add-on creators.
Wesnoth-UMC-dev, a nice place for add-on creators.
Re: Simple HTML5 Wesnoth implementation
Neat! Reminds me of my prototype Wesnoth-Canvas project. (Feel free to pilfer or steal whatever you like from it.)
Wesnoth Bestiary ( PREVIEW IT HERE )
Unit tree and stat browser
Canvas ( PREVIEW IT HERE )
Exp. map viewer
Unit tree and stat browser
Canvas ( PREVIEW IT HERE )
Exp. map viewer
-
- Posts: 80
- Joined: July 27th, 2014, 4:34 pm
Re: Simple HTML5 Wesnoth implementation
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.