Simple HTML5 Wesnoth implementation

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

Moderator: Forum Moderators

Post Reply
apsillers
Posts: 1
Joined: May 18th, 2010, 12:28 am

Simple HTML5 Wesnoth implementation

Post by apsillers »

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).
User avatar
Astoria
Inactive Developer
Posts: 1007
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: Simple HTML5 Wesnoth implementation

Post by Astoria »

Wow this is really cool.
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Simple HTML5 Wesnoth implementation

Post by ancestral »

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
Shadow_Walker
Posts: 80
Joined: July 27th, 2014, 4:34 pm

Re: Simple HTML5 Wesnoth implementation

Post by Shadow_Walker »

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.
shevegen
Posts: 497
Joined: June 3rd, 2004, 4:35 pm

Re: Simple HTML5 Wesnoth implementation

Post by shevegen »

So the thread is a little bit old, 5 to 3 years now at this point.

Has anyone with more experience in regards to HTML5, modern CSS
and javascript, followed webassembly? How feasible may it be to have
a wesnoth-in-the-browser variant for "free" (meaning not really any
additional coding work as such, NOT the cost of it; like to have the
traditional standalone game AND a browser variant that could be
played by people collaboratively).

All these projects seem to have a lot of the initial enthusiasm but then
kind of fall and fade away, which is understandable (people move on
to do other things, I get it) even though unfortunate. Have things
become simpler in this regard? What if we could have simplified
browser things? Like a collaborative map GUI designer? Unfortunately
while I know quite some HTML, CSS and JavaScript, my skills and
knowledge is way too limited to do anything fancy and epic. But
I read about webassembly/WASM and stuff, so there must be some
folks who are "closer to the metal" so to speak and could evaluate
the feasibility. Which kind of taps into the thread here, e. g. the
title being "HTML5 wesnoth implementation". Or perhaps also the
godot implementation but I am not as familiar with it; I stick to
main wesnoth as such mostly.
shevegen
Posts: 497
Joined: June 3rd, 2004, 4:35 pm

Re: Simple HTML5 Wesnoth implementation

Post by shevegen »

And the second consideration may be whether some people who worked
on this, could re-use code written by others before? So like we could have
a PARTIAL HTML5 implementation where some things would work, and
we could track which parts work and which parts don't work yet. A bit
like a milestone tracker or something like that.

apsillers hasn't committed a change in ~3 years so he probably is not
hugely active anymore. But perhaps others can build and extend on
prior work in this regard.
Post Reply