swift502 / Sketchbook

3D playground built on three.js and cannon.js.

Home Page:https://jblaha.art/sketchbook/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add offline support, race vehicles, day/night cycling, flip over button (because sometimes AI fails), explosions and lights for vehicles.

Nyuutrino opened this issue · comments

TL;DR

There's a title for a reason


I love this "game"! How did you get the player AI movements (I love it when your helicopter flips upside down and when you get in it you suddenly turn upside down and hop in like gravity is reversed)? I absolutely love the "fling the door open and then slam it shut" animation.

Offline support is really easy with service workers (especially since you load very few scripts and resources).

To make it more appealing, I think you should add race vehicles like race cars (maybe take the General Motors Lykan Hypersport as a good example) (preferably hypercars), fighter jets, fast and lean helicopters, and such.

In addition, it would be nice if you add a day/night cycle (because that would look nice overall). It might also be good to add night as well (not just dawn/dusk).

A "flip over button" would be nice too. I had a helicopter fly upside down and I took 10 minutes ramming it with my car and pushing it off of the edge of the earth (LOL).

Lights would be nice too (especially if you add night).

Oh, and last one! Add explosions.

I love making dramatic scenes in slow motion where I leap off the ground from the tunnel and get out of my car mid-air in slow-mo. It would be nice if I could walk away from the car as it rams into the sculpture and explodes (*action scene intensifies*).

Thanks for taking your time to read this!

Hi!
I don't know too much on how the game works, but I'll try my best here.

For each of these vehicle models, you most likely need to add wheels separately and manually write in the wheel constraints for each model AFAIK. However, as long as the wheels can turn, using models should work.

Adding explosions requires a particle system, which luckily, already exists in Three.js. An "explosion" though might require some math. But yes, this is possible.

I believe the cars automatically flip, but maybe helicopters don't? Adding a shortcut for flipping the car (setting rotation to 0,0,0, possibly moving the car up a bit (resolve any collisions that might happen by turning)) may also be more convenient. Depending on where the vehicle flip code is, this shouldn't be too hard.

After seeing the day/night cycle controls in World Settings, adding a day/night cycle may not be very hard, as you (may) be able to simply add a bit of code that adds to the Sun's elevation.

Lights shouldn't be too hard..

Hi!

Sorry for a late answer. I'm a bit short on time recently and I wanted to write up a proper answer.
Glad you like my project, I hope it inspires you to make something cool yourself.
I might not work on the project for some time as I'm currently busy with other stuff. So all my answers unfortunately pertain to a time frame of "maybe some day in the distant future".

How did you get the player AI movements

Not sure what you mean exactly. The character animation was made by me in Blender. And NPC characters are then driven by simple AI behaviors here https://github.com/swift502/Sketchbook/tree/master/src/ts/characters/character_ai

when you get in it you suddenly turn upside down and hop in like gravity is reversed

Yeah that's just lerping the character orientation so they end up rotated the right way before getting in/out of a vehicle.

Offline support is really easy with service workers

Not at all sure what you mean? 🤔

I think you should add race vehicles like race cars

Probably not something I'm interested in. I was really just interested in getting the handling and physics right. Producing nicer graphics would be something for a commercial project, not a non-commercial hobby project like this. I'm personally happy with the box car, it serves its purpose well as a test vehicle.

day/night cycle

Like @tussiez mentioned, it would be trivial to do. I just didn't want to bother with night lighting.

flip over button

Pretty much what @tussiez said. 🙂

explosions

Again, what @tussiez said, but also I don't find that an interesting challenge myself. Since it's already been done. Three.js definitely has particle systems, it's only a matter of figuring out how to use them. I'm more interested in things that haven't been done and tackling them myself.

Again, really glad you like my project. Unfortunately I just don't plan to come back to this in the near future. Though I'll always try my best to accept PRs and guide anyone who's interested in contributing to the project.

Service workers allow you to cache files and allow offline support (you can load it offline). In addition, static resources can be loaded from cache offering faster load times and less overall network interaction.

Yeah, I knew it was more of a fun project, but race vehicles would be nice (oh well).

There exists a glitch too where if you go backwards down a ramp or anything that tilts downwards you accelerate extremely fast (which is perfectly fine I do love frekin running my car off the map to oblivion LOL). I don't know if that has to do with your programming itself, or cannon.js (which you use for the physics system).

I wish I could contribute, but I just started high school and started coding only about a year ago. In addition to that, I'm really a web developer not designer, and I just can't really get the hang of arts/modeling much. I focus much more on performance and accessibility for websites than I do with design and layout.

Still I love your "game" (more of a fun project really). I recommend finding a way to allow the users to upload car models in the game. The only problem with that is it would be hard to detect the wheels and other parts needed to be loose (since wheels are the moving parts in this case).

Overall, very nice project!