简体   繁体   English

如何使用HTML5 Canvas制作3D射击游戏?

[英]How can I make a 3D shooting game using HTML5 Canvas?

I want to make a 3D shooter (just shooting, no movements or anything) using HTML5 Canvas. 我想用HTML5 Canvas制作一个3D射击游戏(只是射击,没有动作或任何东西)。

How can I do that? 我怎样才能做到这一点? I searched for some tutorials but I couldn't find any good ones. 我搜索了一些教程,但我找不到任何好的教程。

Here is a nice website with 16 starter tutorials 这是一个很好的网站,有16个入门教程

http://learningwebgl.com/blog/?page_id=1217 http://learningwebgl.com/blog/?page_id=1217

First of all I think this question is more suitable for the gamedev stackexchange website (http://gamedev.stackexchange.com/) 首先我认为这个问题更适合gamedev stackexchange网站(http://gamedev.stackexchange.com/)

As said by the others, you gonna need to learn WebGL , which is the OpenGL ES 2.0 API for the ECMAScript implementation of most browsers. 正如其他人所说,你需要学习WebGL ,这是用于大多数浏览器的ECMAScript实现的OpenGL ES 2.0 API。 You need a WebGL enabled browser (The latest version of Firefox, Chrome or Safari) and a graphics card driver compatible with OpenGL ES 2.0. 您需要支持WebGL的浏览器(最新版本的Firefox,Chrome或Safari)以及与OpenGL ES 2.0兼容的图形卡驱动程序。

The first thing to learn when beginning with game development imo are the maths about some matrix and vector operations . 从游戏开发imo开始学习的第一件事是关于一些矩阵和向量运算的数学。 Search the web for some nice and fast tutorials on how to do matrix multiplication, transposition, how to get the determinant of a 4x4 matrix (which is different from getting a 3x3 or 2x2 matrix determinant) and how to invert a matrix should be enough. 在网上搜索关于如何进行矩阵乘法,换位,如何获得4x4矩阵的行列式(这与获得3x3或2x2矩阵行列式不同)以及如何反转矩阵应该足够的一些好的和快速的教程。 Then learn some (pretty easy) vector operations, Dot product, Cross product, adition, multiplication, normalization and scaling. 然后学习一些(非常简单的)矢量操作,Dot产品,Cross产品,adition,multiplication,normalization和scaling。

Then learn about the transformation matrices , the rotation, translation and scale matrices. 然后了解变换矩阵 ,旋转,平移和尺度矩阵。 And the view and projection matrices as well. 而且视图和投影矩阵也是如此。

A little of the GLSL shading language and what are 3D models ( Vertex positions, normals, texture coordinates and materials ). 一点GLSL着色语言和什么是3D模型( 顶点位置,法线,纹理坐标和材质 )。

Ok, those are the keywords, now google it all. 好的,那些是关键词,现在谷歌这一切。 Here is a nice series of tutorials about vector operations for ya: http://www.dickbaldwin.com/KjellTutorial/KjellVectorTutorialIndex.htm 以下是关于矢量操作的一系列精彩教程: http//www.dickbaldwin.com/KjellTutorial/KjellVectorTutorialIndex.htm

What you are looking for Canvas with 3D content , has now become WebGL . 您正在寻找具有3D内容的Canvas ,现在已成为WebGL

I found a tutorial: Learning WebGL 我找到了一个教程: 学习WebGL

You probably want something like three.js . 你可能想要像three.js这样的东西 It's primarily a WebGL framework, but you can also use/fallback on (2D) canvas. 它主要是一个WebGL框架,但您也可以在(2D)画布上使用/ fallback。

Here are some of the 3D canvas demos . 以下是一些3D画布演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM