Giter Site home page Giter Site logo

ghoulsblade / love-webplayer Goto Github PK

View Code? Open in Web Editor NEW
237.0 25.0 33.0 2.9 MB

WebPlayer for Love2D engine games (webgl+javascript)

Home Page: http://ghoulsblade.schattenkind.net/wiki/index.php/Love-WebPlayer

License: zlib License

Lua 5.50% Logos 3.88% PHP 0.76% JavaScript 89.85%

love-webplayer's Introduction

Love2D WebPlayer
started 2012-03 [email protected]
demos: http://ghoulsblade.schattenkind.net/love-webplayer/
github: https://github.com/ghoulsblade/love-webplayer
infos: http://ghoulsblade.schattenkind.net/wiki/index.php/Love-WebPlayer
love-forum: https://love2d.org/forums/viewtopic.php?f=5&t=8487

NEWS:
* 2013-05 for 100% c-lua compatibility (fully working lua string patterns etc) check out 
** campadrenalin's work on "weblua" : https://github.com/campadrenalin/weblua
** and his porting of love-webplayer to it in the weblua branch : https://github.com/ghoulsblade/love-webplayer/tree/weblua


goal : play games made for love2d inside the browser without plugins (webgl+javascript capable browser required)
usage: unpack .love file (rename to .zip), add the .js files and the index.html from love-webplayer, upload the whole folder to webserver, open in browser, play
tech : webgl for display, github.com/mherkender/lua.js to run lua code in javascript

love2d is a lua based 2d game engine : http://love2d.org/ 
lua-parser.js is a lua interpreter/converter in javascript from https://github.com/mherkender/lua.js (added LuaBootStrap call)
Box2dWeb-2.1.a.3.min.js is a javascript port of the Box2D engine from http://code.google.com/p/box2dweb/

not-yet-implemented (incomplete list) 
* love 0.8 api (currently webplayer is mostly for 0.7, to test some 0.8 stuff add to index.html : <body onload="Love_Enable_Experimental_080(); ...>
* spritebatch,framebuf
* love.physics/box2d  (started usign Box2dWeb)
* font truetype/ttf loading (rasterizer), pixelfonts should work  (except a few special cases in text formatting/wrapping)
* network/luasocket
* love.thread
* love.sound sounddata/decoder stuff. audio itself should work, but is troublesome in some browsers, notably firefox (html5 audio)
* love.timer.sleep : not possible in js, would lead to browser hang in most browsers
* love.imagedata (load-from-file + imgdata.paste + graphics.newImage(imgdata) works, but not decoding, etc)
* love.filesystem stuff (some of it already works, but only if "localstorage" is available in the browser, stored in cookies or sth)
* debug.stacktrace and useful stacktraces on error in general (i recommend testing in native love first and if the problem is webplayer only litter the code with lots of print("pos01") to narrow it down)
* complex string matching pattern, especially balanced braces (e.g. xml parsers, see below)
* screensize wrong (-1,-1) during love.load : love.graphics.getWidth()/getHeight()
* raw sound/audio editing : love.sound.newSoundData etc

known issues : 
* audio : music formats .xm and .mod not supported by browsers usually
* 404 warning in webconsole when using "require somemodule", you can safely ignore this, this is just the only way javascript can do a file-exists check for the module loading behavior of require
* (TODO) workaround for 404 : call LoveFileList('filelist.txt') in index.html body onload to enable love.filesystem.enumerate
* images have to be listed in index.html onLoad call for preloading, otherwise .width/.height access can return 0, and it's not possible in chrome+firefox to pause running code without changing code-structure to callback
* ticket/issue at lua.js github : mherkender/lua.js#5
* parser bug : clouds demo : parse error in keypressed :  >> love.filesystem.load("main.lua")() << (already fixed for some generic cases) workaround : >> (love.filesystem.load("main.lua"))() <<
* parser NotImplemented : string.format("%d",5),debug.backtrace,coroutines,...
* firefox(11) is known to have issues with sound: lag,delay..   chrome (18.0.1025.151) works better for me on ubuntu 11.04 (2012-04)
* doesn't work with file:// url for some reason. so you need to upload stuff to a webserver to try, php and similar isn't needed.
* when changing lua files, be sure to clear browser cache to see your changes, pressing f5 is not enough since it doesn't refresh dynamically loaded files like the .lua ones
* lua string patterns aren't fully convertible to javascript regexp, so while most string patterns should work, more complex ones (like xml parsers) might fail
** if you need this for maploading or similar i'd recommend working around that by serialize the loaded table as .lua file
* functions not allowed as table key
* table with key-type=obj tends to slow down if inserted/deleted a lot every frame, usage of js:splice in lua-parser might be bad? further testing needed, example devmania2012veh pre 2012-10-12

web api available:
* if (love.web) then ... end
* love.web.javascript("jsfun()")
* if (string.find(love.web.getAgent(),"MSIE")) then ...mp3... else ...ogg... end
* love.web.setMaxFPS(99) -- default 60, stepper interval
* love.web.showPreCompiledJS("map.lua") -- shows a html textbox with the lua file converted to javascript, useful for loading big (several mb) files in firefox without parser hang, see ludumdare201204 for example
* if (love.web.browserIsFirefox() or love.web.browserIsChrome()) then ... end

love-webplayer's People

Contributors

aeonofdiscord avatar bartbes avatar campadrenalin avatar dannyfritz avatar ghoulsblade avatar sience avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

love-webplayer's Issues

Get Clouds example to work with Weblua

I'm breaking up #17 piece by piece, since it's such a massive refactor. So for the first thing, I'm going to try to get the Clouds example working with weblua. I want to do the simplest ones first, working my way up the complexity chain until all existing examples work.

Switch from existing Lua parser to Emscripten-based one

lua-parser.js sucks, and it's too much work for us to fix it on our own.

My current porting project for Hawkthorne is a nightmare thanks to the multitude of "unfinished business" in the current Lua parser. In order to get vendor libraries to work, someone would have to implement string.match, at least far enough for the following line to work:

local _PACKAGE = (...):match("^(.+)%.[^%.]+")

No. Fuck that. I'm done.

There's a better way, just waiting for us to use it.

People have compiled Lua to JS with Emscripten. This is a legit compilation of the actual C source code into Javascript. The interpreter acts the exact same way as the "real deal," because it pretty much is. There are no surprises, no unimplemented features, no parser-specific craziness to waste days debugging.

We switch our internal parsing and compilation to that, and we get a fast and accurate Lua base on which to build our kingdom.

Will this be hard?

Some parts yes, some parts no. The basic architecture should be easy to switch out, but it's the surrounding stuff (especially our customizations to the old lua-parser.js code) where we will likely run into trouble. All our existing code is built on lua-parser, and examples may temporarily break during the transition.

That said, the change is really, really worth it. A consistent, correct, and uncrippled Lua parser is essential to porting any sort of advanced game to Webplayer.

Who will do it?

Probably me. I'm the most highly motivated, all my work can happen in a toy branch over in my repo while we get it up to snuff for merging, etc. But with the satellite concerns, such as supporting other demos, it's more than a one-man job.

Pysfs

Hi,

This is the first time I look into this project. First thing I noticed is that you need to uncompress the .love file in order to play games.

I think it would be a very nice change if the player could directly read .love files instead.

Ideally I'd like to have an index.html with just one line:

<script href="love.js" data-love="http://your.game.url/game.love"></script>

I think one of the missing pieces for setting this up would be having physfs working in js. It might be possible to bind it to javascript just like the Lua interpreter has been. I don't know for sure though.

Port Hawkthorne to Weblua

Biggest, longest, most extensive porting project that we'll ever do with love-webplayer. Might as well get started now.

Single file / require

Hi,

I think requiring the files like this just doesn't cut it:

<script type="text/javascript" src="../js/lua-parser.js"        ></script>
<script type="text/javascript" src="../js/lua-parser-utils.js"  ></script>
<script type="text/javascript" src="../js/gamepad.js"      ></script>
<script type="text/javascript" src="../js/jquery.js"      ></script>
<script type="text/javascript" src="../js/jquery.hotkeys.js"      ></script>
<script type="text/javascript" src="../js/utils.js"         ></script>
<script type="text/javascript" src="../js/utils.webgl.js"       ></script>
<script type="text/javascript" src="../js/love.render.js"       ></script>
<script type="text/javascript" src="../js/main.js"          ></script>
...

I see two options:

  • Using a tool like Uglify to bundle all the js files into a single one (maybe as part of a "push" task, so it is done automatically every time you push new stuff to github)
  • Including a lib like requirejs so that a single file (love.js) can use it to require all the files it needs.

how about pixijs + love?

I was wondering if it were possible to use pixijs as the renderer for love-webplayer. pixijs uses webgl and has a backwards compatibility to canvas and pixijs is faster.

"Pixi.js is a rendering library that will allow you to create rich, interactive graphic experiences, cross-platform applications, and games without having to dive into the WebGL API or grapple with the intricacies of browser and device compatibility. Killer performance with a clean API, means not only will your content be better - but also faster to build!"

pixijs: http://www.pixijs.com/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.