From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/kab/games/imedyaten/index.html | 126 ++++++++++++++++++ files/kab/games/index.html | 96 +++++++++++++ .../techniques/3d_collision_detection/index.html | 148 +++++++++++++++++++++ .../3d_on_the_web/basic_theory/index.html | 119 +++++++++++++++++ .../kab/games/techniques/3d_on_the_web/index.html | 117 ++++++++++++++++ files/kab/games/techniques/index.html | 32 +++++ files/kab/games/tools/engines_and_tools/index.html | 66 +++++++++ files/kab/games/tools/index.html | 40 ++++++ .../tutorials/2d_breakout_game_phaser/index.html | 53 ++++++++ files/kab/games/tutorials/index.html | 27 ++++ 10 files changed, 824 insertions(+) create mode 100644 files/kab/games/imedyaten/index.html create mode 100644 files/kab/games/index.html create mode 100644 files/kab/games/techniques/3d_collision_detection/index.html create mode 100644 files/kab/games/techniques/3d_on_the_web/basic_theory/index.html create mode 100644 files/kab/games/techniques/3d_on_the_web/index.html create mode 100644 files/kab/games/techniques/index.html create mode 100644 files/kab/games/tools/engines_and_tools/index.html create mode 100644 files/kab/games/tools/index.html create mode 100644 files/kab/games/tutorials/2d_breakout_game_phaser/index.html create mode 100644 files/kab/games/tutorials/index.html (limited to 'files/kab/games') diff --git a/files/kab/games/imedyaten/index.html b/files/kab/games/imedyaten/index.html new file mode 100644 index 0000000000..370f14cee4 --- /dev/null +++ b/files/kab/games/imedyaten/index.html @@ -0,0 +1,126 @@ +--- +title: Imedyaten +slug: Games/Imedyaten +translation_of: Games/Examples +--- +
{{GamesSidebar}}
{{IncludeSubnav("/en-US/docs/Games")}}
+ +

Asabter agi yesmirew  kra n timsenszaɣin  n tatiknulujit n web yesewhamen iw akken a tizmirem ad agmem tahregt,u a-tt-urarem sumata yis.d anagi n wayen i tzemrem a tgem s JavaScript,WebGL d tatiknulujit n tuqqna.snat n tigezmiwin timezwura tt-umuɣent uraren ay tt-uraren,mad wayeḍ asun n catch-all iw sken n timsenszaɣin ur nelli d aḍulli deg uraren imyermuden.

+ +
+
+

Uraren n baṭṭel/timsenszaɣin

+ +
+
Beloola
+
 BeloolaWebVR d agwni sdded n iramsuten.tarmit yestufan deg igdilen 2D u ɣef VR HMD (Iɣewwaren / Eddu ɣer askar VR).
+
Tanx
+
Urar imenɣi s char agetmyuraren,yett wasnulfa s PlayCanvas.
+
Hyper Vanguard Force
+
Urar n nteg azidal n adrurem aratak.
+
Swooop
+
Urar n tufga s usafag:snaɣdet asafag n wen u err-t-ed isɣunen.tikkelt nniḍen,yettwesnulfa s. PlayCanvas.
+
Sellek ass
+
Srifeg s helikupter usellek nnig umḍiq n tawaɣit u sellek tiɣtasin i weḥlen (ga.me.)
+
Polycraft
+
Azder d urar n tudra.sniremet tigzirt u smernayet imsziwen.
+
HexGL
+
Urar n temszizla timalit arurad.
+
Dead Trigger 2
+
Igi aklassiki n usimas u ẓumbit get s. Unity3D.
+
Angry Bots
+
Alyen-esque yiwen n timalt iẓumetrikit amdan wis 3 i nteg  imsenszaɣen eg s Unity3D.
+
Nutmeg
+
Adrurem umaqqal n agwni d igi.
+
Tuɣalin ɣer Candyland
+
Tamelɣa-3 (Candy Crush) aɣanib n urar.
+
+ +
+
Biolab Disaster
+
Side-scrolling adrurem n nteg.
+
X-Type
+
 Timsenszaɣin aratak msudeɣent seg tallunt n nteg..
+
Xibalba
+
Amahray(Doom Style) amsenṭeg amezwaru.
+
Gorescript
+
Aɣanib nniḍen amsenszaɣ amsenteg amezwaru .
+
Amarag
+
tidwelt ɣer tidwelt,urar n puzzle iɣrem.
+
Hextris
+
Tetris-am urar n puzzl higzagunal.
+
2048
+
Uṭṭun n tucḍa urar puzzl d iqremyad.
+
Aɣṛum s banan
+
Urar n unteg ugarimyuraren 3D  aterras amezwaru ad isnefli s tallalt n Emscripten, WebGL et WebRTC.
+
Monster Madness
+
webGL d asm yeszadur ɣef u nteg ugarimyuraren deg izirig,yettwasnefli sɣuṛ  Nom Nom Games d usedhu n askar.
+
Auralux
+
WebGL akked asm.js-based d urar n tastratijit:ṭṭefet-ed tifuktin iw akken a-tt-alek-eḍ!
+
BrowserQuest
+
MMORPG yesnulfat-id asakwen amecṭuḥ d Mozilla.
+
Shoot The Rocks
+
D urar n nteg aywan 2D deg ɣanib n wurar n talɣiqwit n itran aklasiki n Atari 1979.
+
Star Citadel
+
Yiwet n tuṭfa tamaynutt ɣer Star Castle, urar taɣiqwit n itran aklasiki 1980 n Cinematronics, yuli s uzeṭṭa 2D.
+
+ +

Uraren imsenziyen

+ +
+
Oort deg izirig
+
MMO d urar n usnirem,n usali d imenɣi (i teddu ɣer taneflit.)
+
Amulab n imhergi
+
Asawen awessar Zelda-esque asnirem/RPG.
+
QbQbQb
+
D urar n puzzl talɣiqwit asentel n tussna tanaɣlant.
+
Elliot Quest
+
8-bit d urar tudlift n taluft tuɣalin.
+
+
+ +
+

Tamsenszayt yemezgen

+ +
+
WaveGL
+
Asziked WebGL i y iɣbula imsiwelen.
+
Azeṭṭa utellel n unafag
+
Takarḍa yemrun i skanayen tinafagin ig qelɛen u ig ttṣubbun deg inafagen,u daɣen ijjaṛiḍen n iberdan n usrifeg.
+
Tamkfadut aɣaran
+
3D,tirrin,annar,ṭumubil,aseqdec ammo.js iw siḍanen n aɣaran.
+
Aktum Particle Flow
+
Assulu aɣaran amengi tufsiyt.
+
Aṭarḍaq d wayen id yekkan segs
+
Asṭarḍaq n tizelɣayin ara d-yeglun d uṭarḍaq nniḍen..
+
Agensatriw yettwasutayen seg uzeṭṭa
+
Agensatriw s taggust n uzungur di tuzzya.
+
Digital Fireworks
+
Animated firework effects rendered on canvas.
+
Autumn
+
Falling autumn leaves, with light source shining through. Created using Three.js.
+
Fire walk with me
+
Billowing fire cloud effect.
+
Rainbow Firestorm
+
Rainbow-coloured particles, falling like rain, bouncing around on a terrain of orbs.
+
Crowd Simulation
+
Simulation of a bustling crowd of people all trying to reach their opposite positions.
+
SVG Masking Experiment
+
An Xray machine, creating using an SVG mask.
+
Realistic Water Simulation
+
Flowing water, like the waves on the ocean.
+
Dungeon demo
+
Haxor-based dungeon scene with walkable character.
+
Massive Assault tech demo
+
Rendered archipelago with futuristic military vehicles.
+
Flight Stream
+
3D globe with simulated flight paths.
+
WebGL filters
+
Demo showing WebGL filters being used to add effects to HTML elements.
+
SVG isometic tiles
+
Generating isometric tiles with SVG matricies.
+
ThreeJS App Player
+
A player into which you can load and run Three.js examples.
+
+
+
diff --git a/files/kab/games/index.html b/files/kab/games/index.html new file mode 100644 index 0000000000..023e1c726b --- /dev/null +++ b/files/kab/games/index.html @@ -0,0 +1,96 @@ +--- +title: Taneflit n wurar +slug: Games +translation_of: Games +--- +
{{GamesSidebar}}
+ + + +

Urar d-yiwen seg irmuden n Tasenselkimt aɣerfan.titiknulujiyin timaynutin ttawint-d yal ass asnefli arebbaw u seg widen iǧehden ig zemren ad iddu di yal iminig ɣef web arawas i tignutin.

+ +
Snefli uraren di web
+ +
+ +
+
+

Anṣuf yissek ɣer s agans n usnefli n wurar MDN!deg taɣult agi n wasmel,nejajjaw tiɣbula i yinaflayen n web ig bɣan ad sneflin uraren.atafem ahdum ilmedẓanen d imagraden iteknikiten a yelhun deg umuɣ amenzawi ɣef zelmeḍ,ihi ur ttkukru ara snirmed.

+ +

Nesekcem daɣen yiwet n tigezmi n tamselɣut akken a tizmirem s ttawil attafem isalen ɣef meṛṛa GSS ( aGrudem n uSihel n yiSnasen) yettwamahlen deg tasneflit n uraren,akked umuɣen imsaddayen a yilhun d wallalen ad uraren sumedya.

+ +
+

 —Tamawt: Asnulfu n wuraren deg Web yers ɣef kra n titiknulujiyin Web n taffa am HTML,CSS d JavaScript. Tama Learning Area tin yelhan i walmed n taffa .

+
+ +
+
+
+ +
+

Port d urar agwneslul deg web

+ +

Ma yella teliḍ d-aneflay agwneslul(amedya uraren n tira s C++),u ma yella daɣen tɣeḍwfeḍ i wamek ara tesiwḍeḍ uraren ɣer web,yessefk attlemdeḍ xilla afecku nneɣ Emscripten-D asefsay LLVM ɣer JavaScript,ig ttaṭafen  LLVM bytecode (amedya,srew seg C / C ++ s tallalt n clang,neɣ seg tutlayt nniḍen)u ad isefsu ayagi ɣer asm.js,ig zemren ad ittuselkem di web.

+ + + +

Iw sizmur, sesten:

+ + +
+
+ +
+
+

Imedyaten

+ + + +

Iw umuɣ imedyaten n uraren Web,wali asebter nneɣ imedyaten.sesten daɣen openwebgames.com i tiɣbula d imedyaten i wulmen.

+ + +
+
+ +

+ +

Wali daɣen

+ +
+
+
+
Snulfud uraren imaynuten
+
D asmel asdukkalan ig rran azal i waṭas n ilmeḍras n taneflit n uraren Web yeldin.acukkan ur lḥin ara akken i wullem,maca ɣurṣen taɣbalut ilhan.
+
Asnulfu JS
+
D yiwet n Talkensit ti tiknikiyin  JavaScript yesewhamen d waṭas n tirmitin,wer sefru i  wuraren,acu kkan wulmen.ussan agi ur yermed,maca yeṭṭef tiɣbula yelhan.
+
Tamudemt usihel n uraren
+
Adlis ar uqqin,yura Bob Nystrom,ig ttmeslayen ɣef timudmiwin n usihel deg tawenna n taneflit n urar iw akken a nefk tallalt i yineflayen n uraren akken ad ger tangalt i fazen.
+  
+
Gamedeγ.js Weekly
+
Gamedev.js tanfult n dduṛt iw snefli n uraren HTML5,i d ittwaznen yal sḍisass.degs ameɣlal aneggaru n imagraden,almeḍris,ifecka d iɣbula.
+
Agraw n amyannan HTML5
+
Agraw n ineflayen,isnulfuyen n ikataren d imaszṛagen.mmud tuttra,ad awiḍ iwenniten,a tefkeḍ tallalt i wiyaḍ.
+
+
+ +
+
+
Amsadday n unadi HTML5
+
Umuɣ ikataren n uraren HTML5 aɣerfan akked summa n sen,Tiskanin d tilemmicin.
+
JSBreakouts
+
Snemhel ijguya n Breakout JavaScript deg yal imezlan n ikataren iw akken attafem tallalt u attfernem akken iwata.
+
Tuts+ asnefli n urar
+
Ilmedṛisen d imagraden deg taneflit n uraren sumata.
+
Amsekker HTML5
+
Starter iy imsnefliyen n uraren,yiwen wumuɣ n iseɣwen n aṭas iɣbula useqdec deg Web.
+
js13kGames
+
JavaScript  tamenziɣt tangalt i yimsnefliyen n uraren HTML5 akked ubadu n tiddi n ifuyla yerṣa ɣer 13 kilubytes. meṛṛa uraren zeggszan ttwaheggan s udem n talɣa yettwaɣṛan deg GitHub.0.
+
Ablug n Mozilla hacks
+
Taggayt n uraren deg ablug Mozilla Hacks nagbas imagraden ackiten ɣef  gamedev.
+
+
+
diff --git a/files/kab/games/techniques/3d_collision_detection/index.html b/files/kab/games/techniques/3d_collision_detection/index.html new file mode 100644 index 0000000000..7596fba5d1 --- /dev/null +++ b/files/kab/games/techniques/3d_collision_detection/index.html @@ -0,0 +1,148 @@ +--- +title: 3D Tifin umbberez +slug: Games/Techniques/3D_collision_detection +translation_of: Games/Techniques/3D_collision_detection +--- +
{{GamesSidebar}}
+ +

Amagrad agi yettakked tazwart i yal itiknikiyen n wablaɣ n ujemmeq yettwasqedcen iw sedday n tifin umbberez deg tiwenaḍin 3D.imagraden n uḍfaṛ i tuddela usedday deg timkkarḍitin tulmisin 3D.

+ +

Tankult n ujemmeq usemsawi ɣef tinakatin

+ +

Am tifin umbberez 2D,tinakatin ujemmeq asemsawi n ugellus (TJSG) d iwarzimen izerben i w-guccel n sin-agi  ifendasen n wurar ma yella sembebbin naɣ uhu.ayagi i w-sburu ifendasen n wurar deg yiwet n tanaka ur nezzi.(akka tesemsawi s agellus) u ad tesselken ideggan n tixxamin deg tallunt n imsidag 3D akken ad nẓar ma yella temsembeddint.

+ +

+ +

Tugdda yemsemsawin ɣef tanaka tella i wakken ad illint timellal.asembebbi gar snat n tinakatin ur nezzi nezmer ad ttwadaddent s isnemhal timeẓliwin daya,maca tinakatin yezzin yessefk-asent timehlin timastayin,ig ẓayen i usiḍen.ma ɣuṛwen ifendasen ara yezzin,tzemrem ad tbeddelem iseggiwen n taɣzut n talast i wakken ad yesegrer yal ass taɣawsa,neɣ ma ulac ad yili ufran nniḍen n tanzeggit n talast,am tabluleɣt (yellan ttimsaritin i tuzzya).yeskanay-d amedya n tuzzya n  (TJSG) i  yesmezgay afendas yettezzin,tanaka tettbeddil yal ass tisektiwin i wakken ad tesmezgay akken iwata ɣer tanaka yellan degs.

+ +

+ +
+

Tamawt: Walit amagrad Bounding Iblaɣen akked Three.js iw akken ateẓṛem asnulfu yellan tallilt n tatiknikit agi.

+
+ +

Ired mgal TJSG

+ +

Sefqed  ired ma yella deg gensu n TJSG (AABB) ayagi d afrari - neḥwaǧ kan ad nefrari  imsidgen n yired yellan deg gensu n TJSG (AABB);get yal agellus s ubrez.anɣil belli Px, Py ad Pz d imsigen n yired  BminX-BmaxX,BminY-BmaxY ed BminZ-BmaxZ nutenti id tagrummiwin n yal exist n TJSG (AABB),nezmer ad nesḍen ma yeḍṛa-d umbberez gar sin-agi s useqdec n tsemselt-agi:

+ +

f(P,B)=(Px>=BaddXPx<=BafelX)(Py>=BaddYPy<=BafelY)(Pz>=BaddZPz<=BafelZ)f(P,B)= (P_x >= B_{minX} \wedge P_x <= B_{maxX}) \wedge (P_y >= B_{minY} \wedge P_y <= B_{maxY}) \wedge (P_z >= B_{minZ} \wedge P_z <= B_{maxZ})

+ +

Anda deg JavaScript:

+ +
Tasɣent d ired deg gensu n TJSB AABB(ired, tanaka) {
+ Tuɣalin(ired.x >= tanaka.addayX && ired.x <= tanaka.afellayX) &&
+         (ired.y >= tanaka.addayY && ired.y <= tanaka.afellayY) &&
+         (ired.z >= tanaka.addayY && ired.z <= tanaka.afellayZ);
+}
+ +

AABB mgal AABB

+ +

Sefqed ma yella AABB imyagger AABB nniḍen deg ukayad n yired.Neḥwaǧ kan ad neg akayad i yal agellas , s useqdec n ibuda n tinakatin.ameskan-agi sedaw-a yeskanay-d akayad i nessedday ɣef ugellus n X-adasil,tiseddaṛin AddayXAfellayX ed BddayXBfellayX  semnenint?

+ +

updated version

+ +

S tusnakt atan dacu ara d-yefɣen:

+ +

f(A,B)=(<=BfellayXAfellayX>=BddayX)(AddayY<=BfellayYAfellayY>=BddayY)(AddayZ<=BfellayZAfellayZ>=BfellayZ)f(A,B) =

+ +

u deg JavaScript ad neseqdec aya:

+ +
   Tiseɣnatin myaggerent(a, b) {
+   tuɣalin (a.ddayX <= b.fellayX && a.fellayX >= b.ddayX) &&
+         (a.ddayY <= b.fellayY && a.fellayY >= b.ddayY) &&
+         (a.ddayZ <= b.fellayZ && a.fellayZ >= b.ddayZ); 
+ +

Bounding spheres

+ +

Using bounding spheres to detect collisions is a bit more complex than AABB, but still fairly quick to test. The main advantage of spheres is that they are invariant to rotation, so if the wrapped entity rotates, the bounding sphere would still be the same. Their main disadvantage is that unless the entity they are wrapping is actually spherical, the wrapping is usually not a good fit (i.e. wrapping a person with a bounding sphere will cause a lot of false positives, whereas a AABB would be a better match).

+ +

Point versus sphere

+ +

To check whether an sphere contains a point we need to calculate the distance between the point and the sphere's center. If this distance is smaller than or equal to the radius of the sphere, the point is inside it.

+ +

+ +

Taking into account that the euclidean distance between two points A and B is (Ax-Bx)2)+(Ay-By)2+(Az-Bz)\sqrt{(A_x - B_x) ^ 2) + (A_y - B_y)^2 + (A_z - B_z)} , our formula for point versus sphere collision detection would work out like so:

+ +

f(P,S)=Sradius>=(Px-Sx)2+(Py-Sy)2+(Pz-Sz)2f(P,S) = S_{radius} >= \sqrt{(P_x - S_x)^2 + (P_y - S_y)^2 + (P_z - S_z)^2}

+ +

Or in JavaScript:

+ +
function isPointInsideSphere(point, sphere) {
+  // we are using multiplications because is faster than calling Math.pow
+  var distance = Math.sqrt((point.x - sphere.x) * (point.x - sphere.x) +
+                           (point.y - sphere.y) * (point.y - sphere.y) +
+                           (point.z - sphere.z) * (point.z - sphere.z));
+  return distance < sphere.radius;
+}
+
+ +
+

The code above features a square root, which can be expensive to calculate. An easy optimization to avoid it consists of squaring the radius, so the optimized equation would instead involve distance < sphere.radius * sphere.radius.

+
+ +

Sphere versus sphere

+ +

The sphere vs sphere test is similar to the point vs sphere test. What we need to test here is that the distance between the sphere's centers is less than or equal to the sum of their radii.

+ +

+ +

Mathematically, this looks like so:

+ +

f(A,B)=(Ax-Bx)2+(Ay-By)2+(Az-Bz)2<=Aradius+Bradiusf(A,B) = \sqrt{(A_x - B_x)^2 + (A_y - B_y)^2 + (A_z - B_z)^2} <= A_{radius} + B_{radius}

+ +

Or in JavaScript:

+ +
function intersect(sphere, other) {
+  // we are using multiplications because it's faster than calling Math.pow
+  var distance = Math.sqrt((sphere.x - other.x) * (sphere.x - other.x) +
+                           (sphere.y - other.y) * (sphere.y - other.y) +
+                           (sphere.z - other.z) * (sphere.z - other.z));
+  return distance < (sphere.radius + other.radius); }
+}
+ +

Sphere versus AABB

+ +

Testing whether a sphere and an AABB are colliding is slightly more complicated, but still simple and fast. A logical approach would be to check every vertex of the AABB, doing a point vs sphere test for each one. This is overkill however — testing all the vertices is unnecessary, as we can get away with just calculating the distance between the AABB's closest point (not necessarily a vertex) and the sphere's center, seeing if it is less than or equal to the sphere's radius. We can get this value by clamping the sphere's center to the AABB's limits.

+ +

+ +

In JavaScript, we'd do this test like so:

+ +
function intersect(sphere, box) {
+  // get box closest point to sphere center by clamping
+  var x = Math.max(box.minX, Math.min(sphere.x, box.maxX);
+  var y = Math.max(box.minY, Math.min(sphere.y, box.maxY);
+  var z = Math.max(box.minZ, Math.min(sphere.z, box.maxZ);
+
+  // this is the same as isPointInsideSphere
+  var distance = Math.sqrt((x - sphere.x) * (x - sphere.x) +
+                           (y - sphere.y) * (y - sphere.y) +
+                           (z - sphere.z) * (z - sphere.z));
+
+  return distance < sphere.radius;
+}
+
+
+ +

Using a physics engine

+ +

3D physics engines provide collision detection algorithms, most of them based on bounding volumes as well. The way a physics engine works is by creating a physical body, usually attached to a visual representation of it. This body has properties such as velocity, position, rotation, torque, etc., and also a physical shape. This shape is the one that is considered in the collision detection calculations.

+ +

We have prepared a live collision detection demo (with source code) that you can take a look at to see such techniques in action — this uses the open-source 3D physics engine cannon.js.

+ +

See also

+ +

Related articles on MDN:

+ + + +

External resources:

+ + diff --git a/files/kab/games/techniques/3d_on_the_web/basic_theory/index.html b/files/kab/games/techniques/3d_on_the_web/basic_theory/index.html new file mode 100644 index 0000000000..23774dbc5e --- /dev/null +++ b/files/kab/games/techniques/3d_on_the_web/basic_theory/index.html @@ -0,0 +1,119 @@ +--- +title: Azzegzi n tiszri tamedrut n 3D +slug: Games/Techniques/3D_on_the_web/Basic_theory +translation_of: Games/Techniques/3D_on_the_web/Basic_theory +--- +
{{GamesSidebar}}

Amagrad agi yezzegzey meṛṛa tiszrit n taffa ig wulmen att tissinem mara tebdum leqdic s 3D.

+ +

Anagraw n tismsidegt

+ +

3D d tumasant deg sebggen n tallɣa deg tallunt n 3D,s unagraw ig tt wasqedcen iw siḍan n tadeɣṛa.

+ +

Coordinate system

+ +

WebGL iseqdac anagraw n tamsidegt n yefus-agellus n x sweṛen ɣer yefus,agellus n y sweṛen d sawen,,agellus n z  sweṛen beṛṛa n wagdil,am akka ne ttwali deg adyagram agi safella.

+ +

Taɣawsa

+ +

Imeẓliyen n inawen tɣawsiwin ttwassalin s tallat n Vertex.d yiwen n ired deg tallunt ɣuṛes tadeɣṛa ines 3D deg anagraw n tamsidegt u tikkwal n isallen yernnan i ti sesbadu.yal ired yett wasen s wayla yagi.

+ + + +

tzemmrem a tesalim tanzeggit s useqdec n isal agi. — Atan umedya n agasas.

+ +

Cube

+ +

Udem n talɣa ye llan daɣawas ger vertices.amedya yiwen ugasas n 8 tikyutin yemgaraden (ired deg tallunt) d 6 udmawen yemgaraden, yalta tett wasers ɣef 4 n vertices.tagnut tesbadu tamehla ideg udem yett wanil.u yerna,s tuqqna n irden,nesnulfuyed idisan n ugasas.tanzeggit tett wasers seg takyut ed wudem, mad angawi d tasuddest,ig seqdacen ini neɣ tugna.ma sdded tanzeggit ɣer tasuddest,ad nesufeɣ tindar.

+ +

Iqadusen n tikci

+ +

iqadusenn n tikci d akala iseg tugniwin ttwaheggant u ttefɣent-ed deg wagdil.iqadusen n tikci tudlift tettaṭaf tiɣawsiwin 3D yett wasersen seg timenza yeglemen s tallat n vertices,sisnes asekker,ssiḍan ticlextin u arriten ɣer 2D s iferdisen.

+ +

Rendering pipeline

+ +

Tasniremt ig ttwa sqedcen deg zenziɣ agi safella ttagi:

+ + + +

Asekker (vertex) n tikyutin ed ticelxet ttussihel. —tzemmrem a ttarum i schaders nwen ig sqerdcen tuffɣa.

+ +

Asekker n vertex

+ +

Asekker n vertex ttwagan iw sdukkel n isalen ɣef vertices tisemdanin iw sdabu n imsidag deg tallunt n 3D iw akken ameshanay a ten iẓeṛ.am tuṭfa n tugna n wadlag id heggam
+ -ye seffk a tesersem tiɣawsiwin timezwura,swel kameṛa,dɣa ṭefed tugna.

+ +

Vertex processing

+ +

4 imecwaṛen ig llan deg asekker: tamezwarut tga iw tuddsa n tiɣawsiwin deg amaḍal,sawelen-as asseɣwel n wafrun.ticki, yella usseɣwel n iẓeri ig ttḥadaren ɣef tasdeɣṛiwt ed uslugen n taɣda n kamera deg tallunt 3D.Takamerat ɣuṛes kṛad imesktayen-asun,tanila ed taɣda-yesefk ad ttwa sbadunt iw sayes id yett wasnulfan tura.

+ +

Camera

+ +

Aseɣwel n tigri (sawelen-as daɣen aseɣwel n tasmuɣlit) tes unmil iɣewwaṛen n taweṣṣaft .yesiswel ayen tezmmer atẓeṛ takamerat —Tawila ɣuṛes tahri n tmuɣli, assaɣ n timeszrit ed Tixtiɣiyin i qarben u i yuden. iw akken a ttissinem ugar eɣret Taseddart kamera ye llan deg magrad  Three.js.

+ +

Camera settings

+ +

Amecwaṛ aneggaru n usfaylu,ig gllan stufɣa u tinɣers  aqadus n usuɣel.

+ +

Isisirew

+ +

Isisirew iselkit timenza (ye llan deg takyut yedduden) deg tiẓri n icelxen.

+ +

Rasterization

+ +

Ticlextin agi-ig llan d isenẓaṛen 3D iferdisen n tugna 2D-myedrasen ɣef iẓiki n iferdisen n tugna,iw akken ad yezmmir asiggez ɣef  wagdil 2D deg mecwar n wazday tuffɣa.

+ +

Asekker n icelxan

+ +

Fragment processing focuses on textures and lighting — it calculates final colors based on the given parameters.

+ +

Fragment processing

+ +

Tasuddest

+ +

Textures are 2D images used in the 3D space to make the objects look better and more realistic. Textures are combined from single texture elements called texels the same way picture elements are combined from pixels. Applying textures onto objects during the fragment processing stage of the rendering pipeline allows us to adjust it by wrapping and filtering it if necessary.

+ +

Texture wrapping allows us to repeat the 2D image around the 3D object. Texture filtering is applied when the original resolution or the texture image is different from the displayed fragment — it will be minified or magnified accordingly.

+ +

Tafat

+ +

The colors we see on the screen is a result of the light source interacting with the surface colors of the object's material. Light might be absorbed or reflected. The standard Phong Lighting Model implemented in WebGL has four basic types of lighting:

+ + + +

Azday n tufɣa

+ +

During the output manipulation stage all the fragments of the primitives from the 3D space are transformed into a 2D grid of pixels that are then printed out on the screen display.

+ +

Output merging

+ +

During output merging some processing is also applied to ignore information that is not needed — for example the parameters of objects that are outside of the screen or behind other objects, and thus not visible, are not calculated.

+ + + +

Tarayt

+ +

Now you know the basic theory behind 3D manipulation. If you want to move on to practice and see some demos in action, follow up with the tutorials below:

+ + + +

Go ahead and create some cool cutting-edge 3D experiments yourself!

diff --git a/files/kab/games/techniques/3d_on_the_web/index.html b/files/kab/games/techniques/3d_on_the_web/index.html new file mode 100644 index 0000000000..b301afb21a --- /dev/null +++ b/files/kab/games/techniques/3d_on_the_web/index.html @@ -0,0 +1,117 @@ +--- +title: 3D games on the Web +slug: Games/Techniques/3D_on_the_web +tags: + - Games + - Graphics + - NeedsContent + - NeedsExample + - NeedsTranslation + - TopicStub + - WebGL + - WebVR + - three.js +translation_of: Games/Techniques/3D_on_the_web +--- +
{{GamesSidebar}}

For rich gaming experiences on the Web the weapon of choice is WebGL, which is rendered on HTML {{htmlelement("canvas")}}. WebGL is basically an OpenGL ES 2.0 for the Web — it's a JavaScript API providing tools to build rich interactive animations and of course also games. You can generate and render dynamic 3D graphics with JavaScript that is hardware accelerated.

+ +

Documentation and browser support

+ +

The WebGL project documentation and specification is maintained by the Khronos Group, not the W3C as with most of the Web APIs. Support on modern browsers is very good, even on mobile, so you don't have to worry about that too much. The main browsers are all supporting WebGL and all you need to focus on is optimizing the performance on the devices you use.

+ +

There's an ongoing effort on releasing WebGL 2.0 (based on OpenGL ES 3.0) in the near future, which will bring many improvements and will help developers build games for the modern Web using current, powerful hardware.

+ +

Explaining basic 3D theory

+ +

The basics of 3D theory centers around shapes represented in a 3D space, with a coordinate system being used to calculate their positions. See our Explaining basic 3D theory article for all the information you need.

+ +

Advanced concepts

+ +

You can do a lot more with WebGL. There are some advanced concepts which you should dive into and learn more about — like shaders, collision detection, or the latest hot topic — virtual reality on the web.

+ +

Shaders

+ +

It's worth mentioning shaders, which are a separate story on their own. Shaders use GLSL, a special OpenGL Shading Language with syntax similar to C that is executed directly by the graphics pipeline. They can be split into Vertex Shaders and Fragment Shaders (or Pixel Shaders) — the former transforms shape positions to real 3D drawing coordinates, while the latter computes rendering colors and other attributes. You should definitely check out GLSL Shaders article to learn more about them.

+ +

Collision Detection

+ +

It's hard to imagine a game without the collision detection — we always need to work out when something is hitting something else. We have information available for your to learn from:

+ + + +

WebVR

+ +

The concept of virtual reality is not new, but it's storming onto the web thanks to hardware advancements such as the Oculus Rift, and the (currently experimental) WebVR API for capturing information form VR hardware and making it available for use in JavaScript applications. For more, read WebVR — Virtual Reality for the Web.

+ +

There's also the Building up a basic demo with A-Frame article showing you how easy it is to build 3D environments for virtual reality using the A-Frame framework.

+ +

The rise of libraries and frameworks

+ +

Coding raw WebGL is fairly complex, but you'll want to get to grips with it in the long run, as your projects get more advanced (see our WebGL documentation to get started.) For real world projects you'll probably also make use of a framework to speed up development and help you manage the project you're working on. Using a framework for 3D games also helps optimize the performance as a lot is taken care of by the tools you use, so you can focus on building the game itself.

+ +

The most popular JavaScript 3D library is Three.js, a multi-purpose tool that makes common 3D techniques simpler to implement. There are other popular game development libraries and frameworks worth checking too; A-FramePlayCanvas and Babylon.js are among the most recognizable ones with rich documentation, online editors and active communities.

+ +

Building up a basic demo with Three.js

+ +

Three.js, as any other library, gives you a huge advantage: instead of writing hundreds of lines of WebGL code to build anything interesting you can use built-in helper functions to do it a lot easier and faster. See the Building up a basic demo with Three.js subpage for the step-by-step process of creating the demo.

+ +

Building up a basic demo with A-Frame

+ +

A-Frame is a web framework for building 3D and VR experiences. Under the hood, it is a three.js framework with a declarative entity-component pattern, meaning we can build scenes with just HTML. See the Building up a basic demo with A-Frame subpage for the step-by-step process of creating the demo.

+ +

Building up a basic demo with Whitestorm.js

+ +

Whitestorm.js is a framework built on the top of Three.js technology. It's main distinction is existance of built-in Physics engine and Plugin system based on NPM. See Building up a basic demo with Whitestorm.js for further reading, tutorials and examples of making basic and even complex apps or games using this framework in pair with Three.js.

+ +

Building up a basic demo with PlayCanvas

+ +

PlayCanvas is a popular 3D WebGL game engine open sourced on GitHub, with an editor available online and good documentation. See the Building up a basic demo with PlayCanvas subpage for high level details, and further articles showing how to create demos using the PlayCanvas library, and the online editor.

+ +

Building up a basic demo with Babylon.js

+ +

Babylon.js is one of the most popular 3D game engines used by developers. As with any other 3D library it provides built-in functions to help you implement common 3D functionality more quickly. See the Building up a basic demo with Babylon.js subpage for the basics of using Babylon.js, including setting up a development environment, structuring the necessary HTML, and writing the JavaScript code.

+ +

Other tools

+ +

Both Unity and Unreal can export your game to WebGL with asm.js, so you're free to use their tools and techniques to build games that will be exported to the web.

+ +

+ +

Where to go next

+ +

With this article we just scratched the surface of what's possible with currently available technologies. You can build immersive, beautiful and fast 3D games on the Web using WebGL, and the libraries and frameworks build on top of it.

+ +

Source code

+ +

You can find all the source code for this series demos on GitHub.

+ +

APIs

+ + + +

Frameworks

+ + + +

Tutorials

+ + diff --git a/files/kab/games/techniques/index.html b/files/kab/games/techniques/index.html new file mode 100644 index 0000000000..66edeebd82 --- /dev/null +++ b/files/kab/games/techniques/index.html @@ -0,0 +1,32 @@ +--- +title: Techniques for game development +slug: Games/Techniques +tags: + - Games + - Guide + - NeedsTranslation + - TopicStub +translation_of: Games/Techniques +--- +
{{GamesSidebar}}
{{IncludeSubnav("/en-US/docs/Games")}}
+ +
+

This page lists essential core techniques for anyone wanting to develop games using open web technologies.

+
+ +
+
Using async scripts for asm.js
+
Especially when creating medium to large-sized games, async scripts are an essential technique to take advantage of, so that your game's JavaScript can be compiled off the main thread and be cached for future game running, resulting in a significant performance improvement for your users. This article explains how.
+
Optimizing startup performance
+
How to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device.
+
Using WebRTC peer-to-peer data channels
+
In addition to providing support for audio and video communication, WebRTC lets you set up peer-to-peer data channels to exchange text or binary data actively between your players. This article explains what this can do for you, and shows how to use libraries that make this easy.
+
Efficient animation for web games
+
This article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones. We touch on CSS transitions and CSS animations, and JavaScript loops involving {{ domxref("window.requestAnimationFrame") }}.
+
Audio for Web Games
+
Audio is an important part of any game — it adds feedback and atmosphere. Web-based audio is maturing fast, but there are still many browser differences to negotiate. This article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible.
+
2D collision detection
+
A concise introduction to collision detection in 2D games.
+
Tilemaps
+
Tiles are a very popular technique in 2D games for building the game world. These articles provide an introduction to tilemaps and how to implement them with the Canvas API.
+
diff --git a/files/kab/games/tools/engines_and_tools/index.html b/files/kab/games/tools/engines_and_tools/index.html new file mode 100644 index 0000000000..1538446ceb --- /dev/null +++ b/files/kab/games/tools/engines_and_tools/index.html @@ -0,0 +1,66 @@ +--- +title: Imsaddayen ed ifecka n wurar +slug: Games/Tools/Engines_and_tools +translation_of: Games/Tools/Engines_and_tools +--- +
{{GamesSidebar}}
{{IncludeSubnav("/en-US/docs/Games")}}
+ +

HTML5 amsadday n wurar

+ +

The following are game engines implemented with HTML5 and JavaScript:

+ + + +

HTML5 amsadday d ifecka

+ + + +

Tatiknulujit i wulmen

+ +

The following can be useful when developing games based on Web technologies.

+ + + +
+

Note: Not every browser supports every part of HTML5. For example, Canvas isn’t supported out of the box by any Internet Explorer version below 9. However, you can use Explorer Canvas to replicate canvas functionality (but that is not ideal and does not perform as well). WebSockets is supported by IE only in IE 10, and it isn’t supported in the stock browser of Android. But again, you can fake this by using Flash for the sockets, such as with Socket.IO. While supported in the latest versions of every other browser, WebGL in Internet Explorer requires at least version 11.

+
+ +

Tamudemt n wurar

+ +

You can use the Mortar Game Stub template to get a quick start on an HTML5 game, or you can use it to get ideas on best practices.

diff --git a/files/kab/games/tools/index.html b/files/kab/games/tools/index.html new file mode 100644 index 0000000000..1d026dae28 --- /dev/null +++ b/files/kab/games/tools/index.html @@ -0,0 +1,40 @@ +--- +title: Tools for game development +slug: Games/Tools +tags: + - Games + - Gecko + - Guide + - JavaScript + - NeedsTranslation + - TopicStub +translation_of: Games/Tools +--- +
{{GamesSidebar}}
{{IncludeSubnav("/en-US/docs/Games")}}
+ +
+

On this page you can find links to our game development tools articles, which eventually aims to cover frameworks, compilers, and debugging tools.

+
+ +
+
asm.js
+
asm.js is a very limited subset of the JavaScript language, which can be greatly optimized and run in an ahead-of-time (AOT) compiling engine for much faster performance than your typical JavaScript performance. This is, of course, great for games.
+
Emscripten
+
+

An LLVM to JavaScript compiler; with Emscripten, you can compile C++ and other languages that can compile to LLVM bytecode into high-performance JavaScript. This is a great tool for porting applications to the Web! There is a useful Emscripten tutorial available on the wiki. Note that we are aiming to cover Emscripten in its own section of MDN.

+
+
Gecko profiler
+
The Gecko profiler extension lets you profile your code to help figure out where your performance issues are so that you can make your game run at top speed.
+
Game engines and tools
+
A list of engines, templates and technologies useful to game developers.
+
Shumway
+
Shumway is a renderer for Adobe Flash built entirely in JavaScript, WebGL, etc., bridging the gap between Flash and web standards. This article shows how to make use of Shumway, and how to contribute fixes and bugs to the project.
+
Toolchain for developing and debugging games
+
How does this differ from normal web app debugging? What specialist tools are available? A lot of this is going to be covered by Will in tools, but here we should provide a kind of practical toolchain tutorial for debugging games, with links to Will's stuff: +
    +
  • Basic tools overview
  • +
  • Shader editor
  • +
  • Performance tools (still in production, estimated early 2014)
  • +
+
+
diff --git a/files/kab/games/tutorials/2d_breakout_game_phaser/index.html b/files/kab/games/tutorials/2d_breakout_game_phaser/index.html new file mode 100644 index 0000000000..30314e4c91 --- /dev/null +++ b/files/kab/games/tutorials/2d_breakout_game_phaser/index.html @@ -0,0 +1,53 @@ +--- +title: 2D Breakout urar iseqdacen Phaser +slug: Games/Tutorials/2D_breakout_game_Phaser +translation_of: Games/Tutorials/2D_breakout_game_Phaser +--- +
{{GamesSidebar}}
{{IncludeSubnav("/en-US/docs/Games")}}
+ +

{{Next("Games/Workflows/2D_Breakout_game_Phaser/Initialize_the_framework")}}

+ +

Deg almeẓdan agi ciṭ ciṭ ad nesnulfu urar umafus MDN afrari yettwarun s JavaScript,s useqdec n  framework Phaser.

+ +

Every step has editable, live samples available to play with so you can see what the intermediate stages should look like. You will learn the basics of using the Phaser framework to implement fundamental game mechanics like rendering and moving images, collision detection, control machanisms, framework-specific helper functions, animations and tweens, and winning and losing states.

+ +

To get the most out of this series of articles you should already have basic to intermediate JavaScript knowledge. After working through this tutorial you should be able to build your own simple Web games with Phaser.

+ +

Gameplay screen from the game MDN Breakout created with Phaser where you can use your paddle to bounce the ball and destroy the brick field, with keeping the points and lives.

+ +

Abruy n tamsirt

+ +

Meṛṛa timsirin-ed yal alqem n urar MDN Breakout i nesallay akken- ttunamalen deg Github

+ +
    +
  1. Initialize the framework
  2. +
  3. Scaling
  4. +
  5. Load the assets and print them on screen
  6. +
  7. Move the ball
  8. +
  9. Physics
  10. +
  11. Bounce off the walls
  12. +
  13. Player paddle and controls
  14. +
  15. Game over
  16. +
  17. Build the brick field
  18. +
  19. Collision detection
  20. +
  21. The score
  22. +
  23. Win the game
  24. +
  25. Extra lives
  26. +
  27. Animations and tweens
  28. +
  29. Buttons
  30. +
  31. Randomizing gameplay
  32. +
+ +

As a note on learning paths — starting with pure JavaScript is the best way to get a solid knowledge of web game development. If you are not already familiar with pure JavaScript game development, we'd suggest that you first work through this series' counterpart, 2D breakout game using pure JavaScript.

+ +

After that, you can pick any framework you like and use it for your projects; we've chosen Phaser as it is a good solid framework, with a good support and community available, and a good set of plugins. Frameworks speed up development time and help take care of the boring parts, allowing you to concentrate on the fun stuff. However, frameworks are not always perfect, so if something unexpected happens or you want to write some functionality that the framework doesn't provide, you'll need some pure JavaScript knowledge.

+ +
+

Note: This series of articles can be used as material for hands-on game development workshops. You can also make use of the Gamedev Phaser Content Kit based on this tutorial if you want to give a talk about game development with Phaser.

+
+ +

Next steps

+ +

Ok, let's get started! Head to the first part of the series — Initialize the framework.

+ +

{{Next("Games/Workflows/2D_Breakout_game_Phaser/Initialize_the_framework")}}

diff --git a/files/kab/games/tutorials/index.html b/files/kab/games/tutorials/index.html new file mode 100644 index 0000000000..90d1cb0790 --- /dev/null +++ b/files/kab/games/tutorials/index.html @@ -0,0 +1,27 @@ +--- +title: Tutorials +slug: Games/Tutorials +tags: + - Canvas + - Games + - JavaScript + - NeedsTranslation + - TopicStub + - Web + - Workflows +translation_of: Games/Tutorials +--- +
{{GamesSidebar}}
{{IncludeSubnav("/en-US/docs/Games")}}
+ +

This page contains multiple tutorial series that highlight different workflows for effectively creating different types of web games.

+ +
+
2D breakout game using pure JavaScript
+
In this step-by-step tutorial you'll implement a simple breakout clone using pure JavaScript. Along the way you will learn the basics of using the {{htmlelement("canvas")}} element to implement fundamental game mechanics like rendering and moving images, collision detection, control machanisms, and winning and losing states.
+
2D breakout game using Phaser
+
In this step-by-step tutorial you'll implement the same breakout clone as the previous tutorial series, except that this time you'll do it using thePhaser HTML5 game framework. This idea here is to teach some of the fundamentals (and advantages) of working with frameworks, along with fundamental game mechanics.
+
2D maze game with device orientation
+
This tutorial shows how to create a 2D maze game using HTML5, incorporating fundamentals such as collision detection and sprite placement on a {{htmlelement("canvas")}}. This is a mobile game that uses the Device Orientation and Vibration APIs to enhance the gameplay and is built using the Phaser framework.
+
2D platform game with Phaser
+
This tutorial series shows how to create a simple platform game using Phaser, covering fundamentals such as sprites, collisions, physics, collectables, and more.
+
-- cgit v1.2.3-54-g00ecf