Giter Site home page Giter Site logo

coestar / sadracer Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 3.0 2.14 MB

Building an old-school pseudo 3D racer as a stream theme.

Home Page: https://twitch.tv/Coestar

License: Creative Commons Zero v1.0 Universal

HTML 0.78% JavaScript 97.54% CSS 1.68%
3d outrun phaser phaser3 pseudo twitch coestar streamaday

sadracer's People

Contributors

coestar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sadracer's Issues

Spiral Roads / Mario Kart Roads

What it says on the tin

It'd be super cool to have a road segment that spiraled around upside down like some kind of sonic or mario kart level
Also, driving on road segments that transition to driving on the wall, or any arbitrary insane road shape.

I have some idea of how to do this, but I haven't put too much thought into the implementation yet.

Function based road segment generation

Currently, the different road segments that can be added are manually defined.
So the more complex segments (like S curve or low rolling hills) are just a collection of add road calls with arguments

I think it'd be cool to define a road segment according to a pair of functions
One for the "height" of the road and one for the shape as seen from above.

y = f(z) as seen from the side
x = f(z) as seen from above

This would make it easier to add very silly roads and roads with more variety.

It is also more Math, so maybe that's a bad idea. (-_-;)

Code structure reorganization

Project is currently in a state of mid-reorg. There are two Game.js, the one under modules is vestigial and will be removed (the main one is /scenes/Game.js). Class-based structure is the plan, but open to suggestions - I'm still learning here.

Some roadside sprites should be able to flip horizontally

Some roadside sprites such as trees would benefit from having the option to be flipped horizontally. Initial thought was to base it on which side of the road they are on, but it would be better as a case-by-case option (or even random). Some sprites also don't make sense to flip, such as billboards that have readable text.

Revisit FPS locking code

Create debug controls

I've added a debug HUD scene (toggle bound to Q), now it needs some controls to fiddle with values.

Raid alert idea(s)

Get blue shelled and have the raiding streamer drive by in another car.

Implement obs-browser events support

There are a number of useful events/functions available when running in a browser source that would be useful in this project, for instance:

  • Awareness of and reacting to OBS scene switching. Different functionalities, appearance, and more depending on which OBS scene is loaded.
  • Awareness of whether OBS is currently broadcasting.
  • Awareness of whether browser source is currently visible (and perhaps pause game).
  • Transition callback support to perhaps perform transition-like behavior during scene switching.

Reference:
https://github.com/obsproject/obs-browser

Car sprite turning should account for speed

Currently, when testing auto drive, if the vehicle stops in the midst of a curve, it remains in the turned position and emitting tire smoke particles. Should be enhanced to account for current speed as well as curve.

Camera Rotation Math

Hiya, Sajji here

Some theoretical camera rotation implementation I haven't tested yet:

x = cos(angle) * x + -sin(angle) * y
y = sin(angle) * x + cos(angle) * y
note: angle is in radians, may want to use a math function version that uses degrees

This math should rotate a point around the focal point of the camera/viewplane.

Math Ref

I believe it would do so around the horizon, but I'm not sure.

The psuedo implementation I wrote up:

  • Intercept the projected road points before the polygon is rendered to the projection
  • Convert projected road points to coord pairs via a non mutating method
  • Apply the rotation math to the (x, y) pairs
  • Return the new points as an array
  • spread the array to the draw function

If that works how I think, it should rotate the road by whatever amount you want.
To finish the implementation, you'd also have to rotate the coords and angle of the sprites and adjust the rotation of the background elements.

Anyway, that's the current results of my Camera math research

Replace camera rotation implementation

Current camera tilt in turns implementation is a bit of a cheat using the Phaser main camera. The main camera is slightly zoomed in to hide the edges of the graphics, then rotated. This has negative impacts.

Possible alternative is to rotate the world/car/props. This might be problematic because all are drawn differently and therefore would have different requires to ensure all rotate based on the same pivot point.

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.