Love2D WebPlayer (WebGL)

Discuss any ports of LÖVE to different platforms.
User avatar
SiENcE
Party member
Posts: 721
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Love2D WebPlayer (WebGL)

Post by SiENcE » Thu Jan 17, 2013 12:35 pm

Linuus wrote:Ok this looks really cool, and I'd love to use this for the new miniLD.
How do I get it to work? Should I just put the js folder and the index.html inside the game's folder? (That's how I understand it from the first page)
Is there any way I can test if it works locally (in my browser but running from the computer) before uploading it somewhere?

Thanks :)
You have to specify all images in the index.html . Just look at a sample.

Samples:
http://sience.schattenkind.net/love2d/

This mini-webserver works.
http://www.jibble.org/miniwebserver/

just run it: java -jar SimpleWebServer.jar

cheers

User avatar
Kjell Granlund
Prole
Posts: 33
Joined: Tue Jan 08, 2013 12:39 am
Location: Virginia Beach, VA USA

Re: Love2D WebPlayer (WebGL)

Post by Kjell Granlund » Wed Jan 23, 2013 2:42 am

Ubermann wrote:It is a shame that Android doesn't have or support WebGL.
After some searching I found that firefox on android supports it. Use that browser. It works. I just tested it on my android. Freaking awesome! Now I must use this in my game!!!

User avatar
Volgoza
Prole
Posts: 26
Joined: Fri Jul 13, 2012 12:20 pm

Re: Love2D WebPlayer (WebGL)

Post by Volgoza » Tue Nov 19, 2013 3:07 pm

Hello!

See please at my site. I can't understand whats wrong with this webGL. :(
http://lazysquid.bl.ee/index.php

SalteMishel
Prole
Posts: 11
Joined: Thu Mar 01, 2012 1:38 am

Re: Love2D WebPlayer (WebGL)

Post by SalteMishel » Sat Nov 23, 2013 9:19 am

Hmm...I get this error, I copied the js, css, and main index into my game folder, change the js file directory to js/... , css directory to style.css and changed the image to the right directories. did I miss anything?
error during shader int:ReferenceError:gShaderCode_Fragment is not defined

User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Love2D WebPlayer (WebGL)

Post by Ranguna259 » Sat Nov 23, 2013 11:11 am

OP could you please post your progress on the first post, progress list is one of the most important things to write on a post (right next to a description of the app, and screenshots) but apparently it's something that lovers don't usually do, so could you please write something like which modules work, which don't and which you are working on ?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

User avatar
SiENcE
Party member
Posts: 721
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Love2D WebPlayer (WebGL)

Post by SiENcE » Mon Dec 09, 2013 11:51 am

I think ghoulsblade put this webplayer on hold. Because most basic features of love are working.

Read the Readme to know what works and what not.
https://github.com/ghoulsblade/love-webplayer

@SalteMishel
What you get:
error during shader int:ReferenceError:gShaderCode_Fragment is not defined
It means Shaders/Fragment Shaders are not yet implemented (not defined)! So you need to remove that from your game to make it work with love-webplayer.

User avatar
YellowAfterlife
Prole
Posts: 29
Joined: Mon Jan 23, 2012 4:05 pm
Contact:

Re: Love2D WebPlayer

Post by YellowAfterlife » Wed Jan 22, 2014 5:53 am

SiENcE wrote:
YellowAfterlife wrote:
SiENcE wrote:here are some additional love2d-webplayer samples.

http://sience.schattenkind.net/love2d/

cheers
Hey, I've been linked to your site section few times, and noticed that you are hosting an old version of my platformer engine among other things.
Could you...
* Update it to current version (one looks and plays much better)
* Insert some sort of traceback link to topic so if someone were to think of using engine they would get a most recent one.

Of webplayer overall, this looks quite and quite interesting.
HTML5 performance rules remain though - one has to optimize things to have them working at full speed.
Shure i can update it. But i need todo a lot of changes, because not everything is supported yet. I drop a link to your game but i will remove it anyway ... this is only for testing the webplayer ;-).
I find it interesting that two years later it's still that outdated version that is up on page. Not like it really matters. Not like things were done right.
yal.cc
Contains things I work on. Also gets Love2d examples time to time.

User avatar
SiENcE
Party member
Posts: 721
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Love2D WebPlayer (WebGL)

Post by SiENcE » Wed Jan 22, 2014 11:28 am

This was only for testing the love-webplayer. Never meant for players to play your game.

As i said...it's a modified version. Yours does not run out of the box. I'm not going to update it. If you feel better I delete yours.

User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Love2D WebPlayer (WebGL)

Post by qwook » Tue Jan 28, 2014 10:19 am

I've been working on porting lua pattern matching into javascript pattern matching, but I'm not that well versed in regex.

It works most of the time, but I'm hoping to see if anyone else is interested at looking at it and fixing it up a bit:

Code: Select all

var m_c = {
    "p": "[!\"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]",
    "a": "[A-Za-z]",
    "l": "[a-z]",
    "u": "[A-Z]",
    "s": "[\\f\\v\\n\\r\\t ]",
    "c": "[\\0\\v\\n\\r\\t]",
    "d": "[0-9]",
    "w": "[0-9a-zA-Z]",
    "x": "[0-9a-fA-F]"
}

function matchclass(s) {
    return m_c[s]
}

function LRegExEmptyCaps(lregex) {
    var arrs = []
    lregex = lregex.replace(/(%*)\((.*?)\)/gm, function (match, esc, paren) {
        if (esc.length % 2 == 0) {
            if (paren.length == 0) {
                arrs.push(true)
            } else {
                arrs.push(false)
            }
        }
        return match
    })
    return arrs
}

function LRegEx(lregex, opt) {
    lregex = lregex.replace(/(%*)([{}\\])/gm, function (match, esc, toesc) {
        if (esc.length % 2 == 0) {
            return esc + "\\" + toesc
        } else {
            return match
        }
    })
    lregex = lregex.replace(/(%*)-/gm, function (match, esc) {
        if (esc.length % 2 == 0) {
            return esc + "*?"
        } else {
            return "-"
        }
    })
    // lregex = lregex.replace(/%([^bpaluscdw])/gm, "\\$1")
    lregex = lregex.replace(/%(.|\n)(.?)(.?)/gm, function(match, p1, p2, p3) {

        if (p1 == "b") {
            var p2_esc = p2.replace(/([\[\].\\{}\^?!|])/gm, "\\\\$1")
            var p3_esc = p3.replace(/([\[\].\\{}\^?!|])/gm, "\\\\$1")
            return p2_esc + "(?:(?:[^" + p2 + p3 + "]+)|(?:[^" + p2 + p3 + "]*\\{[^" + p2 + p3 + "]*\\}[^" + p2 + p3 + "]*)+)" + p3_esc
        }

        var tail = p2 + p3
        if (p2.length == 1 && p3.length == 1) {
            if (p2 == "%") {
                var set = matchclass(p3)
                if (set != undefined) {
                    tail = set
                } else {
                    tail = "\\" + p3
                }
            }
        }

        var set = matchclass(p1)
        if (set != undefined) {
            return set + tail
        } else {
            return "\\" + p1 + tail
        }
    })

    return new RegExp( lregex, opt || "gm" )
}

function string_find(str, pattern, start) {
    var jspattern = LRegEx(pattern, "m")
    var emptyCaps = LRegExEmptyCaps(pattern)

    var offset = 0
    if (typeof start != undefined && start != null) {
        offset = start - 1
        str = str.substring(offset)
    }
    var match = jspattern.exec(str)
    if (match != null) {
        var res = [offset + match.index+1, offset + match.index+match[0].length]
        str.replace(LRegEx(pattern), function() {
            var curmatches = Array.prototype.slice.call(arguments, 1, arguments.length-2)

            // matches ()
            var index = arguments[arguments.length-2]
            for (var i in curmatches) {
                var match = curmatches[i]
                if (emptyCaps[i]) {
                    curmatches[i] = index + 2
                }
                index += match.length
            }
            // end matches ()

            res = res.concat(curmatches)
            return arguments[0]
        })
        return res
    } else
        return []
}

function string_match(str, pattern, start) {
    return string_find(str, pattern, start).splice(2)
}

function string_gmatch(str, pattern) {
    var matches = []
    var emptyCaps = LRegExEmptyCaps(pattern)
    str.replace(LRegEx(pattern), function() {
        var curmatches
        if (arguments.length == 3) {
            curmatches = [arguments[0]]
        } else {
            curmatches = Array.prototype.slice.call(arguments, 1, arguments.length-2)
        }

        // matches ()
        var index = arguments[arguments.length-2]
        for (var i in curmatches) {
            var match = curmatches[i]
            if (emptyCaps[i]) {
                curmatches[i] = index + 2
            }
            index += match.length
        }
        // end matches ()

        matches.push(curmatches)
        return arguments[0]
    })
    // we'd return a pairs(matches) for the user to iterate through
    return matches
}

function string_gsub() {
    // todo: this is the hardest to implement
}

// string.find("Hello Lua user", "Lua") -- this is lua
console.log(string_find("Hello Lua user", "Lua", 4)) // expected: 7, 9
console.log(string_find("Hello Lua user", "Banana")) // expected: nil
console.log(string_find("Hello Lua user", "%w+")) // expected: 1, 5
console.log(string_find("Hello Lua user", "(Lua) (user)()")) // expected: 7, 14, 'Lua', 'user'
console.log(string_match("Hello Lua user", "(Lua) (user)")) // expected: 'Lua', 'user'

console.log(string_gmatch("Hello Lua user test", "(.-) ()")) // expected 'Hello', 'Lua' and 'user', 'test'

User avatar
BluBillz
Prole
Posts: 46
Joined: Tue Oct 29, 2013 6:02 pm

Re: Love2D WebPlayer (WebGL)

Post by BluBillz » Sun May 25, 2014 1:25 pm

I am still confused on how to setup everything to get it completely working on your browser. How exactly do you get a server up and running for you to try this on? and how do you even setup where to put all the files at?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest