Hooking up the engine torque curves and sound engine to the actual engine sim and to the car wheels, simulating angular wheel velocity and a first draft of longitudinal slip forces!
Hooking up the engine torque curves and sound engine to the actual engine sim and to the car wheels, simulating angular wheel velocity and a first draft of longitudinal slip forces!
SOUND ON!
First draft of synthesized engine sound. this is also running in a handmade audio engine written with WASAPI.
Took a while to figure out, and I have no idea what I am doing nor have I ever dabbed in synthesizing sound before.
This uses a combination of sine, sawtooth, noise, and square functions that generate harmonics an are modulated based on different engine aspects.
Will likely modify this down the road but this is a first passable draft, now we have engine sounds!
here demonstarting changing different engine aspects and hearing the corresponding changes in sound. (added a basic FFT function to visualize the EQ curve in the bottom)
Spent some time setting up an engine performance simulation with multiple variables that aim to realistically affect the performance of the engine. Here is an in-game demonstration of that simulation, torque and gear speed curves. Now this can be plugged into the physics engine on forces that are applied to the drive wheels of the car.
putting together the tire forces in the first functioning car model!
I implemented controller support (see bottom right in video) to allow for fine control, with added basic torque and braking. The suspension allowed for calculating weight transfer and affecting grip on individual tires. This model also includes implementation of Pacejka's slip angle curve for lateral forces. (top right, you can see me tweak it there and it producing different grip behaviors), I started working on approximating slip ratios for longitudinal forces, these are unfortunately a bit more complicated to get right as they include tire angular velocities which are not directly simulated but rather derived here.
Now it's at a tweaking stage mostly. Next up is simulating engine torque curves and different gear ratios and engine RPM, (maybe also engine sound generation!)
(apologies for the flickering, this is from the screencap)
car suspension works! here's a demo with variable damping and stiffness parameters.
I have gone through many iterations on how to properly do this, initially I was overthinking it, doing separate rigid body calculations for each wheel and trying to simulate a spring between each wheel and the chassis. I ended up scratching that as it produced too many fine calculation errors and the implementation was wonky and required a lot of change to the collision system to work well.
I ended up adopting a very simple raycasting method from the wheel attaching points downwards to the plane + a suspension offset, a simple collision check with the plane sets updates the suspension difference, otherwise a basic damped spring algorithm is done on the suspension: offset * stiffness - suspension_velocity * damping
. when the raycast collides with the plane, it adds an impulse equal to the suspension force on the car's respective connection point of the wheel. The wheels are just rendered at that offset point.
the result is the following:
rendering object bounding boxes using geomtry shaders to generate out of position, dimension and color data
figured out proper matrix multiplication order in model heirarchy, now this works: car wheel rotation:
for (int i = 0; i < entity->model->meshes.count; i++) { render_mesh(&entity->model->meshes[i], m_Translate(entity->pos) * m_Rotate_RH(m_AngleDeg(entity->rot.x), m_V3(1, 0, 0)) * m_Rotate_RH(m_AngleDeg(entity->rot.y), m_V3(0, 1, 0)) * m_Rotate_RH(m_AngleDeg(entity->rot.z), m_V3(0, 0, 1)) * entity->model->meshes[i].parent_transform.transform * entity->model->meshes[i].local_transform.translation // * m_Rotate_RH(m_AngleDeg(rot.z), m_V3(0, 0, 1)) // optional case for local rotation of the wheel * entity->model->meshes[i].local_transform.rotation * entity->model->meshes[i].local_transform.scale ); }
Render pipeline for a (handmade) gltf model with multiple textured meshes in node hierarchy, transform matrix math in heirarchy works correctly! The loader reads the gltf scene's root nodes and loads models accordingly. in this case, the car chassis is the parent mesh and each of the four wheels is a child mesh.
Rendering pipeline for scale and translation gizmos using geometry shaders to render thick lines
Renderer now can load and render textured 3D models in gltf format (well at least this simple 3D test model I made in blender), on the left is a little gltf data viewer
Cactus Image Viewer version 2.2.0
New major feature!
You can get it here:
https://github.com/Wassimulator/CactusViewer/releases/tag/v2.2.0
Some technical info:
I create one big “thumbs” texture and loop retro- and prograde from the file index through the file list on a separate thread and use WIC to generate a thumbnail of fixed size and centered zoom (WIC has a nice interface for all of this) for each image, and periodically update this texture on the GPU, fixed size grid. Upon folder change, I overwrite on the same texture. This also necessitated introducing UI culling to only draw what’s on the screen which otherwise would’ve been a major bottleneck for folders with too many files. Good thing was culling was just one added if statement before rendering.
&cactus
Cactus Viewer update version 2.1.5 is out!
This update includes a few QOL features and some bug fixes. These include:
Thanks to @orcenhaze for the contributions to this release!
https://github.com/Wassimulator/CactusViewer/releases/tag/v2.1.5
Thanks to a great pull request from @hkva we have a very nifty feature of supporting copying an image in its current rotation, cropping, editing etc to clipboard with ctrl+c, which allows you to easily paste it in chat etc for quick edits without having to save.
Also I added mouse navigation with forward and backward buttons to flip thorugh images in a folder.
https://github.com/Wassimulator/CactusViewer/releases/tag/v2.1.4
Cactus Viewer now live redraws the window resposively when resizing the window. it's a small update, by using fibers there is no need to seperate the main loop to a separate thread to achieve this.
The update is live:
https://github.com/Wassimulator/CactusViewer/releases/tag/v2.1.3
&cactus
Cactus Viewer Update 2.1.1
Minor update, added performance improvements and few minor features:
CactusViewer update 2.1.0 is released!
This update brings:
You can download the image viewe and read the patch notes here:
https://github.com/Wassimulator/CactusViewer/releases/tag/v2.1.0
&cactus
you can now save image edits to disk, including rotation, cropping, and image value changes
&cactus
Cactus Viewer now now waits on Window events, instead of unnecessarily redrawing on idle, still supports UI animations and handles events set by image loader threads to wake up the process.
(tried demonstrating updates with printf("I");
, best I could)
&cactus
image saving pipeline, which should allow you to save whatever the shader is displaying, so any image value changes for now like saturation or gamma, etc. Planning to implement more basic image editing functions such as cropping, soon.
the render and encoding pipeline now works.
&cactus
CactusViewer 2.0 is officially out!
https://github.com/Wassimulator/CactusViewer
This is a big one.
This update brings radical changes to the architecture, code structure, style, and intruduces a number of new features:
Architecture:
Features:
Codebase:
master-2.0
branch, the previous version with ImGui and OpenGL is still available and be found under the branch: master-1.0
.&cactus
sneak peak into something I'm working on; CactusViewer is getting a fresh coat of paint, new handmade UI system to replace dear ImGui, D3D backend, and built in cleartype text rendering
Pathfinding
the idea is that the character can scan the accessible environment for points of interest, and can construct a path to whichever one they choose
notice how because the wall was blocking the wall, they couldn't account for the other two points.
more progress on the something I am working on!
Second video shows the editor: Entities can be customized to assign what sprites to use under what condition and what in-game tools can be used on what entity.
A little something I am working on, here's its level editor. I've detached the sprites from the tile type, and the tile can fill randomly from a set of selected sprites. Which means I can change or add assets without breaking the map data file.
custom handmade HLSL skybox shader with matching basic directional lighting
with @archon
been learning blender for the last week in order to make assets for the 3D game, here's a rifle I made:
Progress on our 3D engine with @archon
Today we got FPS controls setup!
Cactus Image Viewer just got a major update!
You can get it for free and check out the source code over here: https://github.com/Wassimulator/CactusViewer
or attached:
Putting it all together: Dialogue nodes now can set quest index to trigger events. In this little demonstration, the events get triggered consecutively, NPC teleports to the hallway, walks to the player, initiates conversation, player responds and goes through dialogue tree to a node that ends the conversation, that node sets quest index to trigger the next events, which in this case is the NPC walking back out and down the hallway.
This time I worked on the laptop interface. And we now have an Email app! It integrates with the event manager so that now email events can be triggered within the story. Now you can get pestered by your collogues inside a game as well!
(while the editors are done with dear imgui, I don't ship them in release, so the laptop interface is handmade imgui, text rendering and otherwise are in SimplyRend)
Back to my isometric RPG project. Today I worked on making an event manager and editor, with that data stored on and loaded from disk. The events work on the basis of "quests" each of which is an array of "events" that get triggered based on an a level index which the player has. That index gets advanced as the player advances in the respective quest. Events can be anything from camera events, to teleportation and movement. And the way the code is set up right now allows for easy changes if I want to add more types as the story might need.
At this point all necessary tools to start game design are ready, a world level editor, a dialogue tree editor and an event editor. All in-game, and all store their data to disk and allow for easy testing and change on the go. The in-game protagonist laptop mode is still WOP, more on that later.
glTF animation rendered using d3d11 with @archon
thanks to @d7 for the minimal example: https://gist.github.com/d7samurai/261c69490cce0620d0bfc93003cd1052
using cgltf for loading the models: https://github.com/jkuhlmann/cgltf
Part of the RPG I'm making is minigames on the protagonist's laptop, this meant I had to make a mini desktop interface within the game. It has its own immediate mode UI and button interface, (not using ImGui for this), and window draw functions can take a callback to functions that run their "apps" so the rendering is injected in the pipeline and scissored and placed correctly. All of this is using SimplyRend.
I was working on the shell application and implemented string and vector types to have an easy to use tokenizer, here is the thing in action.
Some improvements on the editor while working on the story. Visual aids to help Unspaghettify ™️ the editor, and controls to rearrange links
Spent some time working on expanding the dialogue editor. I rewrote the data structures to support more complex content creation, previously it supported specifically 6 options to every node and it was all dialogue, it didn't allow for nuance that might trigger custom code, expanded options, or simple actions like "give" and "take" or "attack" interactions with the NPC. The regidity was there because data structures were static arrays until now. Now a node can be connected to any number of other nodes with variable types and options, it can carry an "SCI", a special code index, which can be treated as an enum to trigger special code in a big switch statement in the game loop, all of this can be saved and reloaded, and works with the undo/ redo system. This required a restructuing of the ImNodes implementation, especially their unintuitive node ID system. I also added some visual changes to the editor and color coded stuff, which required tweaking ImGui's source code. Making editors is fun.
Lots of progress! I wrote the data structure and logic of NPCs, game state savefiles of where each NPC is and at what level, and I hooked it up to the existing dialogue system, which can be edited and expanded on through the in-game editor. The text rendering is done using SimplyRend's new functions that support wrapped text. We are getting somewhere with this!
Spent some time wrapping up certain debug functions and displaying already collected data here and there from the renderer. Using C++ constructors to profile functions or code blocks and displaying that info in a debug menu.
Spent some time making some QOL improvements on the isometric level editor, now you can visually scroll through voxel types, search for voxels, and access a recents list to quickly fill the grid with a certain type. Also ImGui can now work with SR_Sprites which is nice!
Took a while to make the animated assets but I got something rudimentary working. We got an animation system! with flexibility to support sprite sheets with different dimensions, frame count, and animation lengths, FPS independent. Next step is to put a few NPCs in the scene and hook up the dialogue system and editor already in place.
Setting the groundwork for an animation system required a fundamental rethinking of the render algorithm, since movement includes floating point change in points in 3D space, I couldn't get away with the regular layer sorting I was doing already. This time I push all things into an array then run a qsort()
alogirthm that orders thing in floating point percision in 3D space (this also made this all possible with one draw call), this allowed the sprite to transition behind and in front of objects without weird clipping and order bugs. (I need to actually make the animation gifs now)
Added a level editor, each cube in the 3D map can have a certain type of block or type_none
those types correspond to sprites and the renderer does the draw calls in the right order. The level can then be exported to and loaded from file. I'm realizing Most work on this project won't be technical, mostly asset making and level design.
Working on an isometric 2D world and just set up a render pipeline. the thing was to figure out an efficient way to organize the render commands with as few draw calls as possible, since the order requires taking diagonal rows from back to front. The solution was to make an array of render queues. The way the thing now works is you just specify the x,y, and z of the block in question, in game space, and pass the sprite RenderIsometric(SR_Sprite * Sprite, int X, int Y, int Z)
, the coordinates get transformed to isometric and the command then gets pushed to its appropriate render queue which gets looped on and the render calls get batched. in the example above there is a total of 10 render calls, the minimum amount necessary to render the sprites in the scene with appropriate alpha blending.
Caution: this demonstration wobbles.
Working on a little dialogue-based game. Today I made an in-game editor with ImNodes and ImGui to visualize the dialogue trees, it saves to and reads from and parses a file that holds the text data, supports undo/redo. The dialogue demo here is written with my render library SimplyRend
A little progress on limited time but it’s nice: SimplyRend now supports wrapped paragraph rendering, it has a mini lexer implemented where it looks ahead and wraps the words before they overflow a width limit set in a parameter. All in a single render call: SR_PushTextWrapped()
Over the last two or so weeks I've been working on a little handmade image viewer, and since I've started a new job I won't have much time to add more features to it. Since it's stable and I already use it on my own rig, I'm releasing CactusViewer alongside the source code today!
Features:
You can check out the source code, and find prebuilt binaries for Windows here:
https://github.com/Wassimulator/CactusViewer
&cactus
Not programming, but art: I’ve been working on hand and foot studies over the last two weeks, here’s 21 hours’ worth of sketches. Plus a time-lapse video of the process: https://youtu.be/yql2Xtx2MrM
Over the last week I've been working on a small lightweight** image viewer **(calling it Cactus Viewer), GPU rendered. So far we have: Folder scanning, Multithreaded loading of images, zoom and pan, a quick switch between nearest neighbor and linear filtering for pixel art, a pixel grid toggle, pixel inspector with a quick copy to clipboard color HEX. Adding a couple of more features and releasing this alongside the source code very soon!
Writing menu systems for games can be easily overcomplicated. In this article I go through writing a simple and robust menu system based around functions without using any data structures. The upshot is robust, readable, scalable code that flows logically, produces fewer bugs, and is easy to debug and work with.
&AV-Racer
https://wassimulator.com/blog/programming/av-racer/devlog_6.html
To preserve platform compatibility, I used SDL2 to manage rumble events. However, The functions were too simple and restrictive. So I wrote a rumble event manager to handle custom vibration events over multiple frames for the game, in this article I go over how it's done:
https://wassimulator.com/blog/programming/av-racer/devlog_5.html#
&AV-Racer
SimplyRend is the standalone header graphics engine that runs AV-Racer, in this detailed article I go through how it works. The diagram below sums up the implementation and render algorithm. https://wassimulator.com/blog/programming/av-racer/devlog_4.html &AV-Racer
No idea why I took so long to do it. Anyway AV-Racer now supports Steam Achievements.
You can get it here for like 3 bucks btw: https://store.steampowered.com/app/1978850/AVRacer/
&AV-Racer
My little handmade project, AV-Racer is finally released on Steam! Featuring career championships with 5 car classes and 24 playable tracks + two-player splitscreen with controller support. The project started on new year's and now it's complete. Thanks to everyone here for your support, I am proud to have been part of this awesome community while making this.
You can get it now on Steam: https://store.steampowered.com/app/1978850/AVRacer/
Inspired (and equally humbled) by the amazing rrespacker from @raysan5, I finally bit the bullet and spent the evening on writing a small packer for AV-Racer. It is very barebones, the packer is a commandline tool that packs a single file type without compression into one file, and a simple API to handle fetching addresses. It is now in the game to be released. it's on GitHub : https://github.com/Wassimulator/SimplyPack
After 4 Months since starting this project, AV-Racer is finally now live on Steam with planned release sometime next month! Featuring career championships with 5 car classes and 24 playable tracks + two-player splitscreen with controller support. The game is handmade in C using some libraries like OpenGL, stb, and SDL. If you find it interesting, feel free to wishlist on Steam! https://store.steampowered.com/app/1978850/AVRacer/ &av-racer
I wrote a post explaining how I make the maps and map files for my car game, AV-Racer.
https://wassimulator.wordpress.com/2022/04/15/av-racer-devlog-2-maps-and-the-editor/ &av-racer
Hey everyone, AV-Racer is in a relatively finished state, we're working on the Steam set up and I'm currently looking for people who are interested in playtesting the latest version and would kindly give feedback to their experience, before we release this thing publically. the game features a career mode with unlockable tracks, single player, and local two-player split screen. if anyone is interested, feel free to DM me.
we got split screen local play. Progress in Career mode unlocks more tracks to be playable in single race and split screen modes &av-racer
Gameplay demo below. cleaned up the UI, created new menus, new effects, game loop . I'm committed to the CRT effect (watch video in Fullscreen), decided on a new name, AV-Racer. At the end of the video, there's a race result screen. &av-racer
Shader work using SimplyRend, I tried this cool shader I found on ShaderToy. 2 post processing passes. Pixelate and quantize, then curve screen and add TV effect. &av-racer
Finally, migrated the game to OpenGL, in the process I created a single header small rendering library for easily getting a project up and running in OpenGL instead of the limited SDL renderer. it uses a couple of stb libraries, and a personal math library I made.
It offers streamlined sprite loading and packing, render layers, custom shaders, a text renderer with simple functions, load, and render. It utilizes immediate mode, and has two basic pipelines for basic shapes and textured quads.
The goal is ease of use, with modularity, and since I always start with SDL2 to get an idea up and running and then struggle with the migration (with migranes) this is a solution.
Particularly proud of this one, here it is: https://github.com/Wassimulator/SimplyRend &av-racer
I finally have a working (handmade) collision detection and resolving system of multiple objects and walls.
It’s a Body Oriented Intersection Negation & Kinetics system.
Also known as B.O.I.N.K
&av-racer
New AI system that projects a point forward and measures steering accordingly, results in the car following the AI spline very well, instead of waving around as per the previous version.
A difficult problem to tackle in a non-uniform spline based AI is acceleration and deceleration, and deducing the right times to hit the gas and brakes. The problem might blow up to require entirely new AI line organization, either uniform spline sizes, vectors and curves, or corner/straight based AI lines to make the car decide dynamically when to change inputs, as the decision is always based on the upcoming corner and that can be anything really. Being a vague problem, and also being unnecessary to make a dynamic model in a game that uses premade tracks, I ended up tackling the acceleration deceleration problem by just recording relative speeds at every nodes myself once, and then saving the values in the track metadata file. The AI then adjusts gas and brake accordingly, the results are pretty good as demonstrated in the video.
I also discovered through testing that adding a scaler to all of those values made the AI faster or slower without any loss in accuracy (up to a point. at some level the car gets too fast to make the corners). The speed points relative to each other was the determining factor in performance and not the exact speed values in a node per se. The car now adjusts speeds dynamically. This will make difficulty levels and driver performance difference much easier to design.
Now as you can see, the car is whoppingly fast around the corners, and the AI now beat my own record with the controller in lap times, and the system was deterministic enough to get accurate reproducable lap times up to a 100th of a second in lap time accuracy.
Randomness and overtaking systems should be easeir to make now by adjusting next AI node locations within a limit &av-racer
***Finally ***got the collision system to work properly without clipping bugs.
The challenge was resolving collision relative to what side of the wall the car was, determining a "right" side was also dependent on how the walls were created in the editor (clockwise or anticlockwise stacked nodes). The second challenge was resolving the angular velocity and linear velocity vectors in a way that makes sense, the more steep the attack angle, the stronger the change in these velocity vector directions should be. If a scaler wasn't isn't there, the car would bounce off the same regardless of how fast it attacks the wall, which looks unnatural.
with this in place, AI cars come next.
&av-racer
Editor finished. using the metadata drawn in it, I could determine collisions with walls (collision resolving still needs some work) and whether the car is on or off the track, this allowed to make tarmac grippy and non tarmac surfaces drifty, and helps determine the car's relative position on the circuit. with this information we could simulate tyre wear on different surfaces. Here's a lousy lap to demonstrate: &av-racer
two control modes, simulation and arcade, they're vastly different, arcade has automatic shifting and is simple enough to be played with a keyboard, the former requires delicate analog input, it simulates individual tyre forces, grip and traction, while arcade is just fun to drive with no hassle. also finally got to making a better track, and added a minimap, right now I'm making an editor to easily create track metadata like walls, surface info, and AI nodes and waypoints. The next step is to get the editor and parsing to work (more tedious than complicated) then we should be able to start working on a gameloop
&av-racer
Added tire spin and loss of traction, oversteer, weight transfers, Gforces and a G-meter &av-racer
Wrote a little program that tests your reflexes, it takes the average of 10 tests. People who game regularly, especially FPS tend to have measurably faster reflexes. it's limited by hardware latency so its data is objective within tests done on one machine (if anyone has any practical tips on how to resolve measurement with hardware latency I'd welcome it)
https://drive.google.com/file/d/1C3yqOimQOmWs-i6NT155HmoVGpSorirt/view?usp=sharing
Implemented engine sounds using OpenAL, added gears, RPM, torque curves, and engine braking, and added a local split screen multiplayer mode. &av-racer
2D Car simulation collaboration with @archon. Here we simulate the tyre forces and solve for the sum of longitudinal and lateral forces based on the slip angle and using Pacejka's formula on each of the four tyres. (There is surprisingly sparse material online on how to simulate this so we had to come up with our own interpretations) torque, track resistance, and brake force applied on the tires determine the final velocity vector of the car, and using the coefficients on the top corner, one could adjust to simulate different road and tyre conditions, and car performance. Currently working on a local multiplayer mode (Online maybe too) and up next is gears and torque curve simulation. &av-racer
Work in progress simple 2D car game together with @archon we're (still) working on simulating car and wheel forces. &av-racer
Added a genome coding system to the cell simulations. The DNA string below every column contains the information of their respective cells. A parser also can decode the string to cell info that works for the game, meaning the game can now have the ability of genome editing and creating different kinds of cells as a player
Hot reloading of in-game structures for the simulation.
The game parses two files, one that has a numbered list of all symbols and items inside the simulation, the other file has cell structures of enzymes and other data. It was hard-coded previously, now I can edit those files and with one command parse them into an intermediary number based code (using a small tool I made for this) and with a console command in-game, I can update the simulation with the new data while it's running. Took a lot of time to set up but this will streamline testing game design concepts.
EDIT: check the thread, now I run the batch file from within the game. It's all one command now
Smooth pixel art filtering, using the smoothstep anti aliased texture filtering function in the shaders from: https://www.shadertoy.com/view/ltBfRD
Rewritten the renderer in OpenGL, the game now runs with under 20 draw calls and less than 1 mb data buffered to GPU. reduced used RAM by around 600mb by placing all sprites into one texture and sending it to VRAM, the entire game sprite pixel data and font atlasses are on one giant texture stored in the GPU, used VRAM ~ 300 mb. (you can see debug info on the left, gif is low FPS and has artifacts, the thing runs at 60 with no problems).
The "Render layers" is a system that solves alpha blending problems as it is order dependent. The renderer splits the 2d space into layers so that those at the bottom get rendered first and translucent objects blend correctly. This still doesn't produce that many draw calls as you can see below.
Looks the same as before, just runs better with more control + shaders!
Update 0.2.0 is officially released! there's a ton of new features, overhauled simulation, graphics, objectives, scenarios, the works! check it out here: https://astrobion.wordpress.com/2021/08/12/alpha-v-0-2-0/
Working on simulating organic looking cell reproduction. anyway, here's a very inefficient way to draw a white rectangle:
Hot reloading live raytracing shapes using SDF equations and ray marching. collab with @archon
performance friendly Markdown parsing and live rendering with links to different pages within the game. (don't mind the filler text)
3D rope simulation using Verlet integration, enforcing constraints using the Jakobsen method, rendered in OpenGL. collaboration with @archon
Real time basic ray tracer, using compute shaders in OpenGL running on the GPU, collaboration with @archon
I managed to get drop-down menus working in my game and added textboxes where you could type
This is not strictly programming related, but I wanted to share my new game logo design:
in my Astrobiology puzzle game I've added a solution based system where you feed the cell through a pump that adds to the wash-fluid. Next I'm planning to add a simplified molecule-synthesizer that lets you place orders on custom pharmaceuticals to use and test on cells.
Consider following my little project, there’s playable alphas as well: https://discord.gg/UNNBd34J
I’m Making a puzzle game about being an astrobiologist and figuring out alien organisms. You can read more about it here: https://ragsterb.WordPress.com
We also have a discord server: https://discord.gg/aQc3Ud5W3D Your opinions would be much appreciated!
I am writing a puzzle game (C/C++ with an engine from scratch) where you play as an astrobiologist trying to figure out alien organisms. Here’s the website if you’re interested, it has playable alpha versions and links to dev streams: https://ragsterb.wordpress.com