Git Product home page Git Product logo

wolfensvelte-3d's Introduction

Wolfensvelte 3D

Yes, it's a Svelte "port" of Wolfenstein 3D.

No, there's no WebGL, or canvas.

Live Site: https://wolfensvelte-3d.vercel.app/

Screenshots

Demo Video

Click to show
8mb.video-bZ3-w9MmiNQT.mp4

NOTE: Demo video is heavily compressed due to GitHub size restrictions. You can see the full quality file at .github/demo.mp4

What? Why? How?

What do you mean, it's a Svelte port of Wolfenstein 3D?

Well, it's Wolfenstein 3D... but entirely rendered with Svelte! [1]

Why?

A better question would be "why not?"

But, the primary reason this project exists is because of Svelte Hack 2023. But also because it seemed very interesting to work on!

How?

A lot of alcohol, and even more CSS 3D Transforms.

[1] it's not Wolfenstein 3D, of course. It's not 1:1, but it's familiar enough when you play. Plus, Wolfensvelte is a cool name.

Overview

Wolfensvelte 3D is a Svelte reimagining of the classic PC game Wolfenstein 3D. The entire game is made up from HTML DOM elements that have CSS 3D transforms applied to render the graphics.

The only tech used can be summed up as: Svelte, HTML, (S)CSS, and TypeScript/JavaScript.

Features

  • Enemies (Guards + Guard Dogs)
  • Weapons and ammo system
  • Secrets (pushwalls)
  • Item pickups
  • Full E1M1 map
  • Player Health
  • Basically, everything you'd expect

Technical Overview

This game attempts to push Svelte and the DOM to their limits, since everything is done through DOM Elements and CSS. Every "world object" in the game is made from a set of Svelte components: Door.svelte, Elevator.svelte, Pushwall.svelte, Wall.svelte, MapObject.svelte. These components will manage their state through their props, functions exported from the component instance, or through the item object that gets passed to them. Any state changes that will change the map in some way (picking up an item, opening a pushwall or door, etc.) will 'bubble' the change up to the top level CurrentLevel store, so that the change can be reflected accordingly from the POV of the level.

The core of the game is of course the game loop, which is found in src/lib/utils/raf.ts. Using a single loop globally is the optimum way of doing a requestAnimationFrame game loop, since only one frame is requested per render.

The bulk of the code is dedicated to managing game objects, calculations (such as distance, position, converting 'real' positions to 'local' positions), and asset management.

wolfensvelte-3d's People

Contributors

snuffydev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wolfensvelte-3d's Issues

Add Mobile Support

This project looks amazing!
It would be nice to extend it with mobile support.

It could be that if the app detects that it is played on mobile, the inputs would be switched to these:

  • a 4 directional gamepad on the left for moving around
  • a shoot and reload button on the right
  • look around the same way as in minecraft mobile

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.