Love2D WebPlayer (WebGL)
- ghoulsblade
- Party member
- Posts: 111
- Joined: Sun Oct 31, 2010 6:11 pm
Re: Love2D WebPlayer (WebGL)
i'm currently working on getting box2d phyics (0.8 api) to run in webplayer using http://code.google.com/p/box2dweb/
one physics heavy game is already starting to work in webplayer : http://ghoulsblade.schattenkind.net/lov ... ia2012veh/
still some slowness due to some memleak that i didn't manage to pin down yet (so much for garbage collection preventing them, heh),
and missing joints, but definitely progress =)
win and love here if anyone wants to give the working native version a try, made on devmania gamejam and extended a bit =)
* http://ghoulsblade.schattenkind.net/fil ... t-v1.4.zip
* http://ghoulsblade.schattenkind.net/fil ... -v1.4.love
I could use some help : that memleak bug needs pinning down.
My prime suspect is a lot of body s being created and destroyed on a regular basis (shots, enemies and ground spawning and despawning),
so i refactored the lua-wrapper part to use prototype and metatable to reduce love-wrapper-object creation and size to a minimum -> didn't help =(
Setting a bunch of refs to null on object destruction didn't help either.
Next up will probably be constructing a js-only minimal test case to see if it happens in pure box2dweb also, but if that doesn't work i'm running out of ideas -> please help =)
one physics heavy game is already starting to work in webplayer : http://ghoulsblade.schattenkind.net/lov ... ia2012veh/
still some slowness due to some memleak that i didn't manage to pin down yet (so much for garbage collection preventing them, heh),
and missing joints, but definitely progress =)
win and love here if anyone wants to give the working native version a try, made on devmania gamejam and extended a bit =)
* http://ghoulsblade.schattenkind.net/fil ... t-v1.4.zip
* http://ghoulsblade.schattenkind.net/fil ... -v1.4.love
I could use some help : that memleak bug needs pinning down.
My prime suspect is a lot of body s being created and destroyed on a regular basis (shots, enemies and ground spawning and despawning),
so i refactored the lua-wrapper part to use prototype and metatable to reduce love-wrapper-object creation and size to a minimum -> didn't help =(
Setting a bunch of refs to null on object destruction didn't help either.
Next up will probably be constructing a js-only minimal test case to see if it happens in pure box2dweb also, but if that doesn't work i'm running out of ideas -> please help =)
love-android - gamejams
- ghoulsblade
- Party member
- Posts: 111
- Joined: Sun Oct 31, 2010 6:11 pm
Re: Love2D WebPlayer (WebGL)
webplayer physics demo works a lot better now : http://ghoulsblade.schattenkind.net/lov ... ia2012veh/
new in webplayer-physics support : revoluteJoint, weldJoint, body:setBullet, fixture:setMask and setCategory,
Workaround for slowness has been found, it seems the primary objectlist var in lua was the cause rather than box2dweb.
Periodically making a new array and copying the values prevents the slowness.
Not ideal, but works for now. might be related to javascript splice implementation that is used by js-lua when using objects as keys in tables.
Should be investigated further at some point.
new in webplayer-physics support : revoluteJoint, weldJoint, body:setBullet, fixture:setMask and setCategory,
Workaround for slowness has been found, it seems the primary objectlist var in lua was the cause rather than box2dweb.
Periodically making a new array and copying the values prevents the slowness.
Not ideal, but works for now. might be related to javascript splice implementation that is used by js-lua when using objects as keys in tables.
Should be investigated further at some point.
love-android - gamejams
Re: Love2D WebPlayer (WebGL)
@ghoulsblade great!
Thx for keep working on it. I hope it gets official love2d one day.
Thx for keep working on it. I hope it gets official love2d one day.
- SimonLarsen
- Party member
- Posts: 100
- Joined: Thu Mar 31, 2011 4:47 pm
- Location: Denmark
- Contact:
Re: Love2D WebPlayer (WebGL)
Found an API mismatch. When calling love.graphics.scale with only one argument (e.g. love.graphics.scale(2)) LÖVE scales in both axes, while the webplayer only scales in the X-axis. It's a simple fix in the game but I suppose it's better to fix it in the webplayer.
Wanted to make a pull request but a bit unsure how the arguments are evaluated at line 134:
Or rather, unsure how to change it to the wanted behavior.
Wanted to make a pull request but a bit unsure how the arguments are evaluated at line 134:
Code: Select all
t.str['scale'] = function (sx,sy) { GLModelViewScale(sx || 1,sy || 1,1); return LuaNil; }
Re: Love2D WebPlayer (WebGL)
MAYBE (maybe) this could work? (I don't know, uh)
Code: Select all
t.str['scale'] = function (sx,sy) { GLModelViewScale(sx || sx,sy || 1,1); return LuaNil; }
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- ghoulsblade
- Party member
- Posts: 111
- Joined: Sun Oct 31, 2010 6:11 pm
Re: Love2D WebPlayer (WebGL)
thanks, i think it should be
since "||" behaves roughly like "or" in lua , GLModelViewScale takes 3 parameters: sx,sy,sz. (braces added for clarity above)
or better yet
Code: Select all
t.str['scale'] = function (sx,sy) { GLModelViewScale((sx || 1) ,(sy || sx || 1),1); return LuaNil; }
or better yet
Code: Select all
t.str['scale'] = function (sx,sy) {
if (sx == null) sx = 1;
if (sy == null) sy = sx;
GLModelViewScale(sx,sy,1);
return LuaNil;
}
love-android - gamejams
Re: Love2D WebPlayer (WebGL)
New demo that works with webplayer from the l3d thread: http://sience.schattenkind.net/love2d/l3d/
cheers
cheers
Re: Love2D WebPlayer (WebGL)
I found this... it's a game competition made by GitHub
https://github.com/blog/1303-github-game-off
GitHub Game Off
The Challenge
You have the entire month of November to create a web-based game loosely built around one or more of the following themes:
Your game. Your rules. You can participate as an individual or as a team. You're encouraged to use open source libraries, frameworks, graphics, and sounds.
....
etc etc
https://github.com/blog/1303-github-game-off
GitHub Game Off
The Challenge
You have the entire month of November to create a web-based game loosely built around one or more of the following themes:
- forking (or forks)
- branching (or branches)
- cloning (or clones)
- pushing
- pulling
Your game. Your rules. You can participate as an individual or as a team. You're encouraged to use open source libraries, frameworks, graphics, and sounds.
....
etc etc
Bartoleo
Re: Love2D WebPlayer (WebGL)
I've tried to put PHP vars in there in every way I can, how can I put PHP vars in there?
u wot m8
- ghoulsblade
- Party member
- Posts: 111
- Joined: Sun Oct 31, 2010 6:11 pm
Re: Love2D WebPlayer (WebGL)
Not sure what you mean by PHP vars so:
PHP is executed on the server, Webplayer/javascript is executed in the players browser.
If you want to pass some variable you calculate on the server in php to the game running in the browser, you'll need to use some javascript:
for example with clouds : https://github.com/ghoulsblade/love-web ... index.html
change index.html to index.php
add a script block inside the "head" tag :
then in love.load do
or to call php at runtime, something like this should also work :
PHP is executed on the server, Webplayer/javascript is executed in the players browser.
If you want to pass some variable you calculate on the server in php to the game running in the browser, you'll need to use some javascript:
for example with clouds : https://github.com/ghoulsblade/love-web ... index.html
change index.html to index.php
add a script block inside the "head" tag :
Code: Select all
<script type="text/javascript">
gMyVarFromPHP = <?php echo 100+23;?>;
</script>
Code: Select all
gMyVarInLua = love.web.javascript("gMyVarFromPHP")
Code: Select all
local jscode = [[
var url = "bla.php?blub=4";
var gMyResult;
UtilAjaxGet(url,function () { gMyResult = res; },true);
return gMyResult;
]]
gMyVarInLua = love.web.javascript(jscode)
love-android - gamejams
Who is online
Users browsing this forum: No registered users and 8 guests