This topic has been closed. No new entries allowed.
Reason: You can now post comments on articles on Dev Opera
You need to be logged in to post in the forums. If you do not have an account, please sign up first.
Creating pseudo 3D games with HTML 5 canvas
Jacob Seidelin from nihilogic.dk has a lot of exciting tricks up his sleeve, with regards to creating games using HTML 5 <canvas>. This week we are lucky enough to have him sharing some of his techniques with us, in the shape of some code for creating pseudo-3D first person perspective games using canvas and raycasting.( Read the article )
I have posted it to Digg and Reddit!
extendopera.org • Report bugs to public BTS
30. November 2008, 20:11:00 (edited)
Fortunately, this feature can be disabled in opera:config under "Multimedia".
"config:opera" only shows the following 3 for Multimedia (v9.62):
Always load favicon
Play Background Sound
Show Animation <- ?????
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com
Originally posted by jseidelin:
Jacob Seidelin from nihilogic.dk has a lot of exciting tricks up his sleeve, with regards to creating games using HTML 5 <canvas>. This week we are lucky enough to have him sharing some of his techniques with us, in the shape of some code for creating pseudo-3D first person perspective games using canvas and raycasting.
( Read the article )
Hi ..sorry new to the forum and opera .. cld somebody tell me how to event key board events for opera in javascript .. i have no clue on this.. thanks ..
I've been working on similar projects for a while now and am beginning work on normal-mapping textured triangles using a canvas. I'm sure the final product will be very slow, but it's a learning experience. I've already worked on texture-mapping, real-time shading, shadow-mapping, ray-tracing, z-sorting, and a few other graphical techniques. Here are some widgets of what I've made so far:
http://widgets.opera.com/author/geekrecon/
And my website for Opera-centric projects, targeted at the Wii:
http://wiioperasdk.com
I'd like to share some ideas. Tangent128 is another individual who hangs around Opera's website creating projects like these. Maybe we could all code something since three heads are better than one.
http://twiiter.wiioperasdk.com - TWiiter
http://wiioperasdk.com - Wii Opera SDK
http://hullbreachonline.com - HullBreach MMORPG for the Wii/DS
http://my.opera.com/wiioperasdk/
What bothers me greatly though is the lack of floor textures. As much as I try to bend my mind around the problem, I just can't come up with a way to make floor tiles, simply because they would need to rotate as you rotate, to retain their texture pattern with the correct facing. Since JavaScript can't rotate images without canvas, we are out of luck.
Still, even one colored div floors would be better than nothing, since you could at least have different colors at diffrent places (right now the whole world has a gray floor in the demo), but I'm unsure how to make something like that. Any ideas?
@geekrecon: Nice stuff! I'll have to check out Tangent128 as well.
Just wanted to report an error in the code inlined in the article :
The castRays() function is called once per game cycle after the rest of the game logic. Next comes the actual ray casting as described above.
function castSingleRay(rayAngle) {
// make sure the angle is between 0 and 360 degrees
rayAngle %= twoPI;
if (rayAngle > 0) rayAngle += twoPI;
.. should be (and in fact IS corect in the downloaded code) :
if (rayAngle < 0) rayAngle += twoPI;
(I have had strange behaviour with the green ray because of that).
If you want to slide past walls instead of getting stuck in walls use the following:
//Old:
if (isBlocking(newX, newY)) { // are we allowed to move to the new position?
return; // no, bail out.
}
//New:
if (isBlocking(newX, player.y)) newX = player.x;
if (isBlocking(player.x, newY)) newY = player.y;
Originally posted by RobbertM:
TO JEST niesamowite ^ _ ^!
Jeśli chcesz przesuwają specyfikację ściany utknięcie W ścianach stosować następujące:
/ / Stare:
if (isBlocking (newX, newy)) (/ / mamy uprawn [/ color] ien, ABY przenieść do nowej sytuacji Się?
powrót / / NIE, wyskoczyć.
)
/ / Nowe:
if (isBlocking (newX, player.y)) newX = player.x;
if (isBlocking (player.x, newy)) newy = player.y; [/ quote]
http://ifree.is-programmer.com/2010/10/6/creating-pseudo-3d-games-with-html-5-canvas-1.21769.html