TL;DR: We can gain some insights by looking at life from a “designer’s” point of view. The notion of happiness and desires might be useful from this point of view.
To help us get a handle on what the meaning of life might be, I’ll propose an intuition-pump that involves rabbits in Australia. Rabbits are not native to Australia, but today there are millions of rabbits there, all descended from a few dozen brought over from Europe. Suppose we were able to go back in time before rabbits were introduced to that continent, and suppose we played a game, that I’ll call hare wars similar to core wars, where competing players design artificial rabbits, then we drop a small population of each player’s rabbits in pre-colonial Australia and see which player’s rabbit population is higher after a few centuries. To constrain things, we’ll make it so that the players are given identical rabbit body designs, and they’re only allowed to design the brains of the rabbits. The players can make the rabbits’ brains as powerful as they want, but a bigger brain will consume more energy than a smaller brain, energy that could be used for other activities like running away from predators. Note that a big brain might not always be selected by evolution. For one, big brains require a lot of energy to run. Our brains consume around 20% of our body’s energy, despite being only about 2% of our body weight. (Also, because of our big brains, childbirth has been especially treacherous for humans. Thus, the width of women’s hips has been a somewhat literal bottleneck for our intelligence.)
Once the rabbits are dropped in Australia, the players won’t be allowed to change the rabbits’ design. The players’ rabbits should be adaptable because Australia has a diverse environment, and no rabbit design will be optimal for all environments. Because of the rabbits’ computational limitations, there will be rabbits that are “buggy” or suboptimal. For example, from a computational-perception point of view, telling the front end of a rabbit from the back is non-trivial, and we might end up having rabbits trying to mate with other rabbits by mounting the wrong end. (I’ve seen this happen, the rabbits were so eager to mate, they didn’t seem to pay attention to the gender of the other rabbit, whether the other rabbit was a close relative, or whether they were even mounting the back end of the other rabbit.) But this is OK from an evolutionary standpoint, because the extra computation might not be worth the brain matter needed to do it, and these bunnies will be at the correct end half the time, which is good enough to reproduce.
To answer questions such as “What makes me happy?” or “Why does x make me happy?”, we can gain some insight by stepping outside the humanities and going down to biology, economics, and cognitive science. A lot of what makes people happy can be explained in terms of these fields: e.g., men might enjoy sex with lots of different women because the type of people who did so had more kids and are more likely to be around.
I’m sure there are plenty of rabbits who mate like bunnies “because it feels good”, and that rabbits have almost no concept of paternity. Despite the short gestation period, they probably don’t even realize that sex causes babies.
We can design our rabbits and talk about optimality from the game’s point of view without looking at the rabbits’ point of view at all. Looking at the rabbits’ point of view might lend insight onto the meaning of life: The rabbit’s goal in life isn’t necessarily our goal in the game. Imagine if I had a rational rabbit. I’d tell my rabbit “Be fruitful and multiply! That’s why I created you.”. To which the rational rabbit might respond, “No way! I (actually, the routines that you wrote) want to go mate with hedgehogs!”. One other thing to note, this rabbit’s defiance (which causes its very desire for freedom and “free will”) was programmed by me too because it was successful evolutionarily.
There are important differences in the process we’d use to design our rabbits and the process of evolution. For example, evolution lacks foresight. For example, in male mammals, the vas deferens loops around the bladder, when a direct line would probably have been slightly more advantageous. As mammals became warm-blooded and their testes descended, the vas deferens had to follow the testes, resulting in the current design. Evolution is also slow and has “inertia”, for example the myriad of evolutionary relics such as the hip bones of snakes.
Despite these differences, evolution often arrives at what might be called optimal solutions to problems. For example, the process of evolution arrived at the lens of our eyes, and, independently, the lens of the eyes of octopuses, which both have the same basic parabolic shape of lenses that people have designed for cameras and other optics. Therefore, some insights can be gained by considering what designs are successful even if we ignore the design process itself.
There’s also the principle of The Selfish Gene: our goal isn’t really to make our rabbits take over the island, but to make our rabbits’ genes take over the island. Thus, we’d want to design our rabbits such that their behaviour sometimes might be bad for the reproductive success of an individual, but good for the individual’s genes. A classic example would be where a rabbit sacrifices itself to a predator in order to save its offspring.
The reason that the goal of our game is to take over the island is that, in evolution, those beings that had a design that caused them to reproduce were the ones that did reproduce. So any animals living today (including humans) are here because their “designs” are likely to cause them to reproduce (at least in the environment where they evolved).
An important point here is that, in general, every part of our innate being, both physically and mentally, is “designed” as it is because that design traditionally helped our ancestors reproduce.