GithubHelp home page GithubHelp logo

greeb / trakr.app Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 2.0 14.59 MB

Track car telemetry in 3D space

Home Page: https://trakr.app

License: MIT License

JavaScript 46.44% Sass 2.86% SCSS 6.82% Vue 43.67% Shell 0.21%
threejs data-visualization games app

trakr.app's Introduction

License Build Status issues Join the chat at https://gitter.im/trakr-app/community

Data

Really not sure how to do data atm we parse on server and on client to get nice data to animate car. Saving raw bytes would be 200MB/h at ~160 packets/second. So for now to test we only save XYZ to build worldmaps saved every 1000/2 ms. Frontend still gets full telemetry at 12 packets/second. We save the full telemetry bytes, frontend does parsing. Maybe implement Draco

Features

  • Three: Dynamic point rendering
  • Nuxt: Discord oauth
  • Nuxt: Usable Frontend
  • Three: Little "stress" page
  • Nuxt: Start of modular system for input data
  • Nuxt/Three: Custom Shader frontend
  • Nuxt: Simple Camera System
  • Nuxt: Simple Global maps

Contributing

Contributions are always welcome!

Development

To run the production version which takes URL into consideration for callbacks and CORS and also redirects to /about if not logged in

If you only wanna see the code for the WebGl/Three stuff there look at the assets folder.

First make sure you copy the example.env to .env

cp example.env .env

Read "Environment Variables" below

  yarn Install
  yarn dev

Games

This basically implements games assets/js/games

Url

Not really sure about this but for now, x is a uuid

Map

  • /map/x
    • /map/x/x

User

  • /user/x
    • /user/x/session/x
    • /user/x/map/x

Challange

  • /c/12345

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

IOPORT Socket.io port

URL Url for CORS and ssl later not really implemented yet if empty defaults to localhost

PORT App port also for CORS and stuff

JWTSECRET Secret used for JWT, can be generated with:

node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"
#or
openssl rand 256 | base64

POSTGRES Postgres URL

DISCORDID Discord oAuth id

DISCORDSECRET Discord oAuth secret

Dump

Acknowledgements

trakr.app's People

Contributors

greeb avatar gitter-badger avatar

Stargazers

srforever avatar M.Tubato avatar Nikita Zhenev avatar HiPeng avatar xtechnology avatar  avatar

Watchers

 avatar

trakr.app's Issues

Cache each map and maybe only sync db and cache to stop async calls in main function

Line: 13

// we check what mode user is in
// set throttle based on mode and only save data we need, maybe send full telemetry to frontend
/**
* TODO: Cache each map and maybe only sync db and cache to stop async calls in main function
* category=data
*/
export const throttledWrite = async (msg, rinfo, gameId) => {
// Checks
const userId = idFromIp(rinfo.address)
if (users[userId].udp === undefined) { return }

Cache each map and maybe, only sync db and cache to stop async calls in main function

Line: 13

// we check what mode user is in
// set throttle based on mode and only save data we need, maybe send full telemetry to frontend
/**
* TODO: Cache each map and maybe, only sync db and cache to stop async calls in main function
* category=nuxt
*/
export const throttledWrite = async (msg, rinfo, gameId) => {
// Checks
const userId = idFromIp(rinfo.address)
if (users[userId] === undefined || users[userId].udp === undefined) { return }

Add fake demo data, maybe a fake loop

fh5 steering is from -127+127

Line: 43

// this.car.position = new THREE.Vector3(val.alluserPos[i].x / 20, val.alluserPos[i].z / 20, val.alluserPos[i].y / 20)
}
/**
* TODO: Add fake demo data, maybe a fake loop
* category=three
*/
// fh5 steering is from -127+127
export function animateCar (val) {
if (val[0] + val[1] + val[2] === 0) { return }
if (this.car !== undefined) {
this.packOffset = this.packClock.getDelta()

Adding points doesn't work on mobile, three js works fine

Not sure why this happens yet but chrome->device simulation-> pixel 5 doesn't add points

Line: 26

this.geometry.setDrawRange(0, 0)
}
// FIXME: Adding points doesn't work on mobile, three js works fine
// category=threejs
// Not sure why this happens yet but chrome->device simulation-> pixel 5 doesn't add points
export function addPoint (xyz) {
const positions = this.points.geometry.attributes.position.array
positions[this.pointsCount] = xyz[0]
positions[this.pointsCount + 1] = xyz[1]

Check for multiple tabs and only run one for each ip for now

Line: 24

credentials: true
}
})
// TODO: Check for multiple tabs and only run one for each ip for now
// category=nuxt
io.use(function (socket, next) {
const authtoken = socket.handshake.headers.cookie
const token = cookie.parse(authtoken)
if ('auth._token.local' in token && cookie.parse(authtoken)['auth._token.local'] !== 'false') {
jwt.verify(token['auth._token.local'].split(' ')[1], config.secret, function (err, decoded) {
if (err) { return next(new Error('Authentication error')) }

Do actual smoothing between packets

For now this works but real lerping should lerp between packets so its actually always smooth

Line: 75

}
}
/**
* TODO: Do actual smoothing between packets
* category=threejs
* For now this works but real lerping should lerp between packets so its actually always smooth
*/
/**
* TODO: Implement car pitch&roll
* category=threejs

lil gui can be shown if not on a three page

The system to show or hide gui+stage stuff is not optimal
For now we give a mixin to pages we want the gui that show and hide on mount/destroy

Line: 216

}
},
toggleGui (w) {
// FIXME: lil gui can be shown if not on a three page
// category=lilgui
// The system to show or hide gui+stage stuff is not optimal
// For now we give a mixin to pages we want the gui that show and hide on mount/destroy
if (w) {
this.$cookies.set('gui', true, { path: '/', maxAge: 60 * 60 * 24 * 7 })
document.getElementsByClassName('guicontainer')[0].classList.remove('hide')

Add fake demo data, maybe a fake loop, or at least a video

fh5 steering is from -127+127

Line: 43

// this.car.position = new THREE.Vector3(val.alluserPos[i].x / 20, val.alluserPos[i].z / 20, val.alluserPos[i].y / 20)
}
/**
* TODO: Add fake demo data, maybe a fake loop, or at least a video
* category=threejs
*/
// fh5 steering is from -127+127
export function animateCar (val) {
if (val[0] + val[1] + val[2] === 0) { return }
if (this.car !== undefined) {
this.packOffset = this.packClock.getDelta()

Actually implement real code editor for shaders don't use this v-menu actual dialog should be used

Also this needs saving to db and sharing and much more a pre made library...

Line: 67

</template>
<script>
export default {
// TODO: Actually implement real code editor for shaders don't use this v-menu actual dialog should be used
// category=nuxt
// Also this needs saving to db and sharing and much more a pre made library...
data: () => ({
ops: {
bar: {
onlyShowBarOnScroll: true,
keepShow: false,

Refactor register page and fix direct load bug

because of data implementation site can't be loaded directly without first getting the new udp pack, fix that

Line: 223

</div>
</template>
<script>
// TODO: Refactor register page and fix direct load bug
// category=nuxt
// because of data implementation site can't be loaded directly without first getting the new udp pack, fix that
import { games } from '~/assets/js/games'
export default {
data: () => ({
games,
game: null,

Mobile styles are broken

Add breakpoints to all elements to fix

Line: 5

// category=styles
// This is broken because of hardcoded colors in darkmode fix by using vuetify variables
// TODO: Mobile styles are broken
// category=styles
// Add breakpoints to all elements to fix
$appbar-height: 48px
header
.menuContainer
margin-left: 2em

Bounding boxes are calculated every 100 points for now

This can't be optimal this should only be done when necessary idk how to check for that tho

Line: 83

}
/**
* FIXME: Bounding boxes are calculated every 100 points for now
* category=threejs
* This can't be optimal this should only be done when necessary idk how to check for that tho
*/
export function computeBoundings () {
if (this.pointsCount - this.lastCompute > 1000) {
this.app.$toast.info('computeBoundingSphere, may lag')
// this.geometry.computeBoundingBox()

Implement car pitch&roll

For now we only animate yaw of car or z axis we should implement the rest

Line: 81

*/
/**
* TODO: Implement car pitch&roll
* category=threejs
* For now we only animate yaw of car or z axis we should implement the rest
*/
export function smoothCar () {
// this.packOffset // we have ms of last packet
// this.stats //may have fps
// now we know our last pack was lets say 250 ms ago

Get this data over its client so we can first only take clients with visibility 0 and then we can do checks on all of these

Line: 139

return
}
// TODO: Get this data over its client so we can first only take clients with visibility 0 and then we can do checks on all of these
await models.position.findAll({
where: {
gameId,
normSuspensionTravelSum: { // dont display flying data on frontend helps with point from ppl teleporting even tho they shouldn't? can be undone when soft banning is on
[Op.gt]: process.env.MAXSUSPENSION || 0.4 // basically how much we remove points with low suspenstiontravelsum
}
},

Gui on mobile is broken/too big

Fix gui on mobile and style for mobile

Line: 5

import { Color } from 'three'
import Stats from 'three/examples/jsm/libs/stats.module.js'
// TODO: Gui on mobile is broken/too big
// category=lilgui
// Fix gui on mobile and style for mobile
// TODO: Gui fps sometimes show fps,ms,mem, and somethimes only fps,ms
// category=lilgui
// FPS section in gui can have 2 or 3 elements depending on browser account for that

Gui fps sometimes show fps,ms,mem, and somethimes only fps,ms

FPS section in gui can have 2 or 3 elements depending on browser account for that

Line: 9

// category=lilgui
// Fix gui on mobile and style for mobile
// TODO: Gui fps sometimes show fps,ms,mem, and somethimes only fps,ms
// category=lilgui
// FPS section in gui can have 2 or 3 elements depending on browser account for that
export function initGui () {
this.guiLet = {
boxVisible: false,
colorSchema: 'Height',

Check for multitple tabs and only run one for each ip for now

Line: 24

credentials: true
}
})
// TODO: Check for multitple tabs and only run one for each ip for now
io.use(function (socket, next) {
const authtoken = socket.handshake.headers.cookie
const token = cookie.parse(authtoken)
if ('auth._token.local' in token && cookie.parse(authtoken)['auth._token.local'] !== 'false') {
jwt.verify(token['auth._token.local'].split(' ')[1], config.secret, function (err, decoded) {
if (err) { return next(new Error('Authentication error')) }
socket.decoded = decoded

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.