Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A whole new iteration of RallyMKA #42

Merged
merged 40 commits into from
May 14, 2023
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3b2685a
WIP use new model format
mokiat Jun 26, 2022
9491f2c
Fix static entity transformations
mokiat Jun 27, 2022
6ab11b5
Switch to new unified game api
mokiat Jul 10, 2022
780aa8b
Align car construction to new API
mokiat Aug 29, 2022
01dbbb1
Align some stuff to 64bit
mokiat Aug 29, 2022
991e608
WIP: Use new game API
mokiat Sep 2, 2022
fd450d7
Align part of the code with new lacking API
mokiat Sep 6, 2022
6d14010
WIP changes
mokiat Mar 16, 2023
ebdabc2
Add loading widget
mokiat Mar 19, 2023
2bcaa4a
Change to new user interface
mokiat Mar 19, 2023
6c4caf8
Add licenses and credits
mokiat Mar 22, 2023
a9d157a
Rework home screen
mokiat Mar 29, 2023
9e23f14
Improve play screen
mokiat Mar 31, 2023
c7ea376
Add more user interface features
mokiat Apr 1, 2023
6ab3885
Make UI improvements
mokiat Apr 2, 2023
b2cee83
Handle different environments
mokiat Apr 3, 2023
98f8a3a
Add new app icon
mokiat Apr 8, 2023
8aeeca6
Support mouse and keyboard
mokiat Apr 8, 2023
59c1a49
Add mouse and keyboard images
mokiat Apr 8, 2023
4adf5ed
Add gamepad image
mokiat Apr 9, 2023
c007077
Rework credits
mokiat Apr 9, 2023
194e898
Reuse resource set
mokiat Apr 23, 2023
c4d744e
Enhance profiling tesks
mokiat Apr 23, 2023
e2586b1
Handle exit menu escape button
mokiat Apr 26, 2023
ff56701
Auto-focus licenses scroll
mokiat Apr 26, 2023
112a81f
Add new skybox images
mokiat Apr 29, 2023
362c86b
Attach lights to car
mokiat Apr 30, 2023
9a9774d
Prep web for itch
mokiat May 2, 2023
a43d9bc
Reduce collision corrections
mokiat May 2, 2023
4f09163
Adjustments to new vehicle model
mokiat May 6, 2023
e897412
Adjust for suspension model
mokiat May 7, 2023
8ea53ac
Add new suv model
mokiat May 8, 2023
5b1c72f
Add home screen model
mokiat May 8, 2023
09e8af9
Adjust light angle
mokiat May 8, 2023
b817b92
Bump dependencies
mokiat May 13, 2023
0a26720
Set to maximized
mokiat May 13, 2023
578233a
Add new forest level
mokiat May 13, 2023
9388ca5
Update license command
mokiat May 13, 2023
528c32b
Fix licenses
mokiat May 14, 2023
f80996b
Update README
mokiat May 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reuse resource set
mokiat committed Apr 23, 2023
commit 194e8985ceb28c7bed760cc2f6eb99c32c62d5cf
2 changes: 1 addition & 1 deletion cmd/rallymka/app_cgo.go
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ func runApplication() error {
cfg.SetFullscreen(false) // TODO: Enable
cfg.SetMaximized(true) // TODO: Remove
cfg.SetMinSize(1024, 576)
cfg.SetVSync(false) // FIXME: V-sync causes slow resource loading.
cfg.SetVSync(true)
cfg.SetIcon("resources/ui/images/icon.png")
cfg.SetMaximized(true)
return glapp.Run(cfg, app.NewLayeredController(gameController, uiController))
5 changes: 4 additions & 1 deletion internal/ui/bootstrap.go
Original file line number Diff line number Diff line change
@@ -12,8 +12,11 @@ import (
)

func BootstrapApplication(window *ui.Window, gameController *game.Controller) {
engine := gameController.Engine()
resourceSet := engine.CreateResourceSet()
co.RegisterContext(global.Context{
Engine: gameController.Engine(),
Engine: engine,
ResourceSet: resourceSet,
})
co.Initialize(window, co.New(Bootstrap, nil))
}
36 changes: 11 additions & 25 deletions internal/ui/controller/play.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package controller

import (
"runtime"

"github.com/mokiat/gomath/dprec"
"github.com/mokiat/gomath/sprec"
"github.com/mokiat/lacking/app"
"github.com/mokiat/lacking/game"
"github.com/mokiat/lacking/game/ecs"
"github.com/mokiat/lacking/game/graphics"
"github.com/mokiat/lacking/game/physics"
"github.com/mokiat/lacking/game/physics/collision"
"github.com/mokiat/lacking/game/preset"
"github.com/mokiat/lacking/ui"
"github.com/mokiat/lacking/util/shape"
"github.com/mokiat/rally-mka/internal/game/data"
)

@@ -193,6 +195,7 @@ func (c *PlayController) Start(environment data.Environment, controller data.Con
Zoom: 1.0,
})

runtime.GC()
c.engine.ResetDeltaTime()
}

@@ -266,13 +269,11 @@ func (c *PlayController) createVehicleDefinition() *preset.CarDefinition {
AngularDragFactor: 0.0,
RestitutionCoefficient: 0.0,
CollisionGroup: collisionGroup,
CollisionShapes: []physics.CollisionShape{
shape.NewPlacement[shape.Shape](
shape.NewTransform(
dprec.NewVec3(0.0, 0.3, -0.4),
dprec.IdentityQuat(),
),
shape.NewStaticBox(1.6, 1.4, 4.0),
CollisionBoxes: []collision.Box{
collision.NewBox(
dprec.NewVec3(0.0, 0.3, -0.4),
dprec.IdentityQuat(),
dprec.NewVec3(1.6, 1.4, 4.0),
),
},
})
@@ -284,11 +285,8 @@ func (c *PlayController) createVehicleDefinition() *preset.CarDefinition {
AngularDragFactor: 0.0,
RestitutionCoefficient: 0.0,
CollisionGroup: collisionGroup,
CollisionShapes: []physics.CollisionShape{
shape.NewPlacement[shape.Shape](
shape.IdentityTransform(),
shape.NewStaticSphere(0.25),
),
CollisionSpheres: []collision.Sphere{
collision.NewSphere(dprec.ZeroVec3(), 0.25),
},
})

@@ -347,15 +345,3 @@ func (c *PlayController) createVehicleDefinition() *preset.CarDefinition {

return carDef
}

// func (h *playLifecycle) OnKeyboardEvent(element *ui.Element, event ui.KeyboardEvent) bool {
// return h.carSystem.OnKeyboardEvent(event) || h.cameraStandSystem.OnKeyboardEvent(event)
// }

// func (h *playLifecycle) OnMouseEvent(element *ui.Element, event ui.MouseEvent) bool {
// // bounds := element.Bounds()
// // viewport := graphics.NewViewport(bounds.X, bounds.Y, bounds.Width, bounds.Height)
// // camera := h.gfxScene.ActiveCamera()
// // return h.vehicleSystem.OnMouseEvent(event, viewport, camera, h.gfxScene)
// return false
// }
3 changes: 2 additions & 1 deletion internal/ui/global/context.go
Original file line number Diff line number Diff line change
@@ -3,5 +3,6 @@ package global
import "github.com/mokiat/lacking/game"

type Context struct {
Engine *game.Engine
Engine *game.Engine
ResourceSet *game.ResourceSet
}
7 changes: 4 additions & 3 deletions internal/ui/view/home_screen.go
Original file line number Diff line number Diff line change
@@ -33,7 +33,8 @@ type HomeScreenPresenter struct {
Data HomeScreenData `co:"data"`
Invalidate func() `co:"invalidate"`

engine *game.Engine
engine *game.Engine
resourceSet *game.ResourceSet

loadingModel *model.Loading
homeModel *model.Home
@@ -48,6 +49,7 @@ func (p *HomeScreenPresenter) OnCreate() {
co.InjectContext(&globalContext)

p.engine = globalContext.Engine
p.resourceSet = globalContext.ResourceSet
p.loadingModel = p.Data.Loading
p.homeModel = p.Data.Home
p.playModel = p.Data.Play
@@ -540,8 +542,7 @@ func (p *HomeScreenPresenter) onNightClicked() {
}

func (p *HomeScreenPresenter) onStartClicked() {
resourceSet := p.engine.CreateResourceSet()
promise := data.LoadPlayData(p.engine, resourceSet, p.homeModel.Environment(), p.homeModel.Controller())
promise := data.LoadPlayData(p.engine, p.resourceSet, p.homeModel.Environment(), p.homeModel.Controller())
p.playModel.SetData(promise)

p.loadingModel.SetPromise(promise)
5 changes: 3 additions & 2 deletions internal/ui/view/intro_screen.go
Original file line number Diff line number Diff line change
@@ -24,7 +24,9 @@ var IntroScreen = co.Define(func(props co.Properties, scope co.Scope) co.Instanc
globalContext = co.GetContext[global.Context]()
screenData = co.GetData[IntroScreenData](props)

engine = globalContext.Engine
engine = globalContext.Engine
resourceSet = globalContext.ResourceSet

homeModel = screenData.Home
loadingModel = screenData.LoadingModel
)
@@ -37,7 +39,6 @@ var IntroScreen = co.Define(func(props co.Properties, scope co.Scope) co.Instanc
})

co.Once(func() {
resourceSet := engine.CreateResourceSet()
homeModel.SetData(data.LoadHomeData(engine, resourceSet))
})

4 changes: 2 additions & 2 deletions resources/web/main.js
Git LFS file not shown