Category Archives: Videogames

Videogame related posts

F1 modelling

I’m using Wings3D to create my 3D model. so far the editor is good enough for my purpose. The editor also has features for UV mapping, so if I ever become more proficient in creating 3D models this tool has got me covered for now.

Wings3D can export to DirectX format (.x) so models can be used in Monogame’s content pipeline. I plan to export the model as XML data first so I can do my own normal map calculations instead. So I may need to create a content project for this as well later on.

Racer thoughts #2

In my 80s Racer the car only had two gears, a “low gear” and “high gear” much like the racers from that era. The implementation is quite simple. With some easing functions I made sure that the low gear accelerates fast but has a limit to the speed. The high gear accelerates slow but gives the car a higher speed.

However in the Virtua Racing game, the formula one car has more gears. A couple of easing functions build on top of oneother is not going to cut it. Since I’m going for a more arcade racer, I don’t need real physics. In fact, the game logic will be mostly 2D. Thus a 2D physics engine to deal with my cars accelerating and a bit of drifting will suit my game nicely. Time for some research! Reddit has a nice topics about cars, gears and how to simulate it. Another great find is this one by Marcus Monster.

The reddit topic was quite a revelation; the current speed of the car is used to  calculate the rpm of the engine.  In all interesting stuff.

Flat shading style in Monogame

For the “flat shade” aesthetic each of the triangles that make up the world will be shaded evenly. The way the video card creates the nice shades is because of the normal vector of a given surface.  This vector basically tells the videocard what direction the light to bounce to create light and dark shades.

Because 3D models are made up of triangles, the best way to ‘hide’ these triangles is to define the normal vector at the vertex (the corners) of each triangle. The videocard can smoothly fade between these vectors across the surfaces and this gives the effect of smooth shading.

However, in my case, I don’t want the smooth shading. I want my models to be simple and look simple as well. So instead of the videocard smoothing out the normals between eacht vertex, I actually want the same normal across the entire face of the triangle. In order to do this, the videocard needs to calculate the normal vector of the entire triangle when drawing a triangle. After doing a bit of research- this requires a geometry shader- the geometry shader has access to the different vertices that make up the triangle.
Unfortunately, Monogame doesn’t support geometry shaders (yet). On a positive note, for now I don’t want to touch shaders yet and use the built in ‘BasicEffect‘ to do the hard work for me.

In order to solve this, I decided to make each triangle a separate entity- this means that no vertices are shared between triangles. This also enables me to set the normals for each vertex in each triangle to the same value. So what I need is a structure for each vertex that holds the position, normal and the color.

Since there is no such structure in the Monogame framework, I made my own like this:

Now using this structure, the BasicEffect can draw flat shaded geometry as expected!
The downside to this method is that the models in the game use more vertices than one where information of triangle-neighbors is shared.
For now I am not concerned; the models will be much simpeler than most of the modern games (where models with thousands of triangles are no exception). I expect my road sections to use about 8 to 10 triangles, so maybe an entire circuit comes close to one single model in a triple A game.

Racer thoughts #1

So I want to make a race game in 3D.  I know my limitations; without the proper experience I’m not going to be able to create a full 3D racetrack with fancy graphics. So I’m going to generate the track geometry much like a slotcar racetrack.
I haven’t made a 3D racer before, but I did create a 2D (pseudo3D) race game. With some thought these principles can translate to 3D. It may be quite different from the way modern racers are made, so let’s see where this is headed.

As in the 2D racer, each track will be built up using segments. Each segment will have some properties to it: is it a curve? if yes, how sharp is the turn? Does it have kerbstones? What is the width? And so on. This can be expanded later with more properties.
Stringing theses sections together will create a track. The cars on the track will have knowledge of the section they’re on and the sections ahead of them. So internally the cars only work with these sections and not actually interact with the 3D model at all! The model of the track is just to display the game’s internal state.
Once the list of the sections is known, a 3D model of the track can be generated.

 

Monogame in the third dimension

Until now most of my games were made in 2D. Sprites and a bit of pseudo 3D- essentially scaling tricks to make thing appear 3D.  For my next project I will need ‘real’ 3D stuff. Time to get familiar with how 3D computer graphics work. I’m still learning so join me while I figure this out.

I will be using Monogame for this project. Why Monogame? Glad you asked. I want to use Monogame for a couple of reasons: I want to learn how things work.
I’ve tried both Unity and Unreal Engine. It worked nice for quick prototypes, but I felt I was struggling learning how these tools work instead of actually getting the result I was looking for. Perhaps my next game will be in Unity once I have a better understanding 3D concepts in general.
Another thing is familiarity: I started creating games in the XNA framework a couple of years ago and have since moved on to Monogame. Stuff like a custom Content Pipeline has become familiar to me.
Furthermore I’m not a 3D modeller. I have the basic concept of my game in my mind and I plan to generate most of the 3D content. Using this concept a familiar tool helps me to focus on what I want to learn.

So time to get familiar with Monogame and basic 3D concepts!

 

New project: Virtua Racing remake

With the development of the 80s Racer I learned a lot about how a racegame works. As a kid we had an arcade nearby with Outrun and Hang-On, so as a kid I spend many hours in there. Imagine the amazement when I first saw Virtua Racing in the arcade. Sure we’ve had polygon games before, but nothing could beat the speed, the bright colors of Virtua Racing. Even today the game looks great.

I dabbled a little in 3D polygons so I’m tempted to start a new project: a race game inspired by Virtua Racing. The polygons are flat shaded, and fairly simple (looks can be deceiving though) but I think I can pull this off.

So my next project will be inspired by Virtua Racing! See the original game below:

 

The 80s Racer

One of my projects is the 80s Racer:

The game is inspired by old school racers such as Outrun (Arcade) and Lotus 2 (Amiga). The game is programmed in C# using the XNA framework. The XNA framework is deprecated so I plan to port it to Monogame someday. The project has stalled because the code is very messy – it basically started as a proof of concept based on Louis Gorenfeld’s Pseudo 3D page. From the concept I kept adding stuff.

The game  contains several levels with effects such as rain, snow, fog, day-night switches, split road, cliffs and tunnels. I may pick this one up again some day to create a full game from it. Note that ‘Apex’ is the name of the demo group I had with my friends during the Amiga years…

New focus: videogames!

Things on this blog have shuffled around a bit. My intention was to have a blog about the board and card games I was creating. I loved to create ruleset and physical cards and gameboards. Unfortunately this turned out to be an expensive hobby and very time consuming. On top of that it required a lot of playtesting. Playtesting is very time consuming and for many people a tedious process. With so many great games in my current gaming group we hardly have time to play the new releases let alone play around with a game mechanic that isn’t fleshed out yet. Then there are a ton of other hobbies…

So I had to decide what I was going to do with the scarce spare time I have. So this is the result: I continue playing boardgames with my friends. I paint miniatures. I play videogames… and: program videogames as a hobby.

The upsides of programming videogames are that I can do it without real additional costs (I already own a decent PC and most of the tools are for free). I practice my programming skills in the meantime. I can do most of the initial playtesting of the game myself. The downside? I’m no 3D modeller or skilled pixel artist nor am I a musician.  So a lot of games will start out as proof of concept or gameplay mechanics.

So onward! Join me on my adventures in the realm of videogames!