You are browsing as a guest. Sign up (or log in) to start making projects!

jam

  • 8 Devlogs
  • 35 Total hours

A puzzle game based off of solving traffic jams.

Open comments for this post

3h 14m 12s logged

Now roads can be drawn and it’s looking cool!

As you can see in the recording, without drawing the roads, the cars just stop at the intersection because they cannot find any routes (gaps between roads are intersections, I’ll fix that later). By drawing a road, the cars can drive to their destination in the simulation.

The biggest issue I had while coding this was mixing up physical IDs and internal IDs, which are not interchangable (I should have probally used a class or struct to represent IDs instead of a raw size_t).

Next, I’ll work on making the intersections look better and maybe get some statistics on how well the cars preformed at the end of the simulation!

0
0
77
Open comments for this post

1h 32m 6s logged

Added some player controls and separated the editor window and simulation window.

As you can see, the simulation now works okay and can be changed to 3 different speeds. I haven’t done too much, but next I will probally fix the roads meeting at the intersections.

0
0
15
Open comments for this post

5h 47m 20s logged

I know it doesn’t look like much, but this represents a lot or work and progress.

I spent almost 6 hours to refactor my code to use a much cleaner ownership system that should completely prevent memory leaks and have much better separation of the static parts of simulation vs. parts that area ctually getting simulated.

In a nutshell, what I did was make two classes, Layout and Simulation. Layout always exists and is the thing that is drawn on screen. Layout doesn’t have any cars or moving stuff and you can edit layout. When you start a simulation a NEW simulation object is created with all the cars which can simulated it. The clean split makes it a lot easier to know everything and edit/save stuff which might be usefull later.

I had to do a lot of changing and if you look at the git commit basically every file was modified, but now the architecture is much cleaner.

Next, I’ll work on adding the Simulate button and making a new window show up with the cars to simulate it.

0
0
43
Open comments for this post

3h 15m 56s logged

Made some progress, but then decided to revert back to yesterday

So now I know why smart pointers are discouraged! So my ownership model was really screwed up and super confusing and I had some crazy memory problems and segmentation faults so I reverted back to yesterdays commit and am going to refactor the code to use SMART POINTERS (wow) and have a better ownership model.

I feel pretty sad that I basically made no progress with 3 hours of work but I guess I learned something?

SO the new plan is that Layout class will handle all things that are static in simulation and are just there (roads and intersections, both physical/logical) and Simulation will only handle all the cars and driving around. The EditorWindow class will have a pointer to (but now own) Layout so it can modify Layout but not Simulation. The SimulationWindow class will have a smart pointer to (and own) a simulation (fresh) and PhysicalCar s. This should help clarify ownership and prevent memory management issues.

0
0
62
Open comments for this post

5h 6m 2s logged

More visuals (multiple roads + intersection support) and LOADING PRESETS!

I had to refactor a bunch of my code to use stuff allocated on the heap because I, stupidly, decided to initialize a bunch of my objects on the stack in a loop, causing a lot of the pointers to become hanging. Oh well, now I just have to make sure to remember to delete the allocated objects.

Some plain and dirty presets can be loaded and the textures look pretty bad, but it will look a lot better pretty soon. I’m going to work on adding the first player interaction: allowing the player to add a road by clicking twice. I expect this might be a bit hard and school’s starting so it will probably be a while before I post another devlog (depending on how hard it is for me to add it)

I also might try to get the road offsets and intersections better so it is more playable.

0
0
11
Open comments for this post

4h 26m 32s logged

Got some real visuals going!

It’s a bit messy but if you look closely you can see the car follow the road (that road is supposed to be a 4 lane road but I didn’t draw it), switch onto a lane on the side, and keep accelerating. The framework has been built to easily expand to different types of roads like one way, 2 lane, 4 lane, etc.

Next I’ll start working on getting the car to transition at intersections and finish the simulation portion. Then I can get started on working on the player interaction part!

0
0
43
Open comments for this post

2h 15m 10s logged

Finally got the cars to be a little bit intelligent and traffic lights to actually work

Traffic lights

The traffic lights now enforce lane rules (cars must be on a certain lane when light is green to go to the next lane). The traffic lights are also auto generated in a bit of a “dumb” way. The traffic light just gives turns to each incoming road to go wherever they want and all other roads cannot go. Later, I might allow valid right turns, but that’s a problem for later.

Car pathfinding

Although I haven’t implemented the BFS search for the cars, given a route cars will now look ahead to the next intersection and randomly auto merge onto the lane (the cars are more likely to merge when they are closer to the intersection). This is to make sure that cars won’t all merge at the same time, which would be weird.

0
0
19
Open comments for this post

9h 34m 20s logged

Started my new video game, JAM

JAM is a puzzle video game about solving traffic jams! I don’t have much experience writing video games so this will be a first for me (although I have plenty of regular c++ experience). So far I’ve just written the very very basic car driving logic and have it printed out to the debug console (I plan to add actual graphics once core logic is done).

Currently I’ve got simple one-lane roads working and some really stupid intersections, but I’m working on multi-lane roads, merging, traffic light schedules, and cars actually waiting at intersections!

0
0
17

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…