Page 17 of 21
Re: Love2D WebPlayer (WebGL)
Posted: Wed Oct 10, 2012 10:23 pm
by ghoulsblade
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 =)
Re: Love2D WebPlayer (WebGL)
Posted: Fri Oct 12, 2012 2:39 pm
by ghoulsblade
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.
Re: Love2D WebPlayer (WebGL)
Posted: Sun Oct 14, 2012 9:02 pm
by SiENcE
@ghoulsblade great!
Thx for keep working on it. I hope it gets official love2d one day.
Re: Love2D WebPlayer (WebGL)
Posted: Mon Oct 15, 2012 10:09 am
by SimonLarsen
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:
Code: Select all
t.str['scale'] = function (sx,sy) { GLModelViewScale(sx || 1,sy || 1,1); return LuaNil; }
Or rather, unsure how to change it to the wanted behavior.
Re: Love2D WebPlayer (WebGL)
Posted: Mon Oct 15, 2012 11:18 am
by Nixola
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; }
Re: Love2D WebPlayer (WebGL)
Posted: Tue Oct 16, 2012 2:09 pm
by ghoulsblade
thanks, i think it should be
Code: Select all
t.str['scale'] = function (sx,sy) { GLModelViewScale((sx || 1) ,(sy || sx || 1),1); return LuaNil; }
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) {
if (sx == null) sx = 1;
if (sy == null) sy = sx;
GLModelViewScale(sx,sy,1);
return LuaNil;
}
Re: Love2D WebPlayer (WebGL)
Posted: Tue Oct 16, 2012 2:45 pm
by SiENcE
New demo that works with webplayer from the l3d thread:
http://sience.schattenkind.net/love2d/l3d/
cheers
Re: Love2D WebPlayer (WebGL)
Posted: Fri Oct 26, 2012 8:48 am
by bartoleo
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:
- forking (or forks)
- branching (or branches)
- cloning (or clones)
- pushing
- pulling
What do we mean by loosely based on these concepts? We literally mean, loosely based. Some examples might be a FPS where you throw forks at water balloons, an educational game about DNA cloning, or perhaps a platformer where you push and pull objects.
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
Re: Love2D WebPlayer (WebGL)
Posted: Tue Nov 06, 2012 9:35 pm
by rokit boy
I've tried to put PHP vars in there in every way I can, how can I put PHP vars in there?
Re: Love2D WebPlayer (WebGL)
Posted: Wed Nov 07, 2012 7:52 am
by ghoulsblade
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 :
Code: Select all
<script type="text/javascript">
gMyVarFromPHP = <?php echo 100+23;?>;
</script>
then in love.load do
Code: Select all
gMyVarInLua = love.web.javascript("gMyVarFromPHP")
or to call php at runtime, something like this should also work :
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)