Monday 21 September 2015

I'm sitting and wondering about my space game (Part 1)

I wonder if it ever be done.

But just now for some reason, I think it is more fun to think and dream about it than actually do it.

I don't know. I feel motivated about it now, but next week, or tomorrow it might be completely gone. The most important thing of all is to feel this happy and motivated about something. And don't loose that and get depressed. I don't want to think about how much time do I have left, before I am incapable of doing anything.

Another thing that is important to keep in mind is that, I am not doing this for other people. I am doing this for me. Because it is something that I think I will enjoy playing... The boring part though is that, I think my game idea needs other people for it to be enjoyable. And maybe I need to find a way to make that not so important. Make it a single player game.

And how do I keep motivated. I once asked Notch on Twitch. And he responded.. well, I don't know, just keep doing it anyway I suppose, even if it is boring. And that is exactly how I think as well. But a thing I notice about Markus "Notch" Persson when he has his little programming moments on Twitch, is that he is so fast at doing something playable and controllable that you can run around in and do stuff in. And maybe that keeps the motivation going to add more features later. Do the fun stuff first and the boring stuff later.

While I usually get stuck on the boring parts first, and adds the graphics and the controls much later. I might not even get to the parts with graphics and controls. Just a program that is a part of the game, or a tool that is used to help create the game. 

The game have to be in 3D. It would need to have some physics, that can be done with ODE. Open Dynamics Engine, I have programmed that before. I need to know how to use that



I think I will write it in C++, and not in C. Even though my experience in C++ is not as good as my experience in C.

Maybe I can even do it in C++11 ?

It depends on how well C++11 is implemented in GCC

https://gcc.gnu.org/projects/cxx0x.html

And how well it works with other libraries. I want to use.

I need to model stuff in blender, and I did write something to make C code out of blender models.





But also, I am afraid to do more bugs when using C++. Because I am so confident in C. Programming MCU's and being very close to hardware level most of the time in my work. I don't know. It does feel like C++ is the better choice anyway.

And I will  read this book "C++ Programming by Bjarne Stroustrup". That was free on Google Play. And I have read a lot of it already. I learnt a lot from that book. I learned to make pointers to functions in C. Something that I actually didn't know about C. Even after programming it so much, even saying that I feel confident in it. I remember that Donald Knuth wrote in the Art of Computer programming that pointers to functions is something a programming language has to have. otherwise it is quite useless... And I thought, I don't know if C has that. And he showed the qsort() example. And I didn't understand it. Not until I read Bjarne Stroustrup's book about C++.

Maybe pointers to functions is not something that is implemented in the HiTech or Microchip compilers that I have used so much. Anyway... Now I know how to use that confusing qsort() function that you can read about (man qsort). And I did implement it in my sudokuhelp program. Aswell in my objParser program I used it alot when building linked lists. To allocate memory and free() memory. I think that worked out very well. It almost made C, look and feel like programming an object oriented language when I did it that way... And now all those voices from "expert" programmers popped up in my head on how stupid this way to program is... yes yes. I don't care, shut up old voices.

The game would need a programmable computer. No, it is not 0x10c. I was not inspired by that. I had this idea before 0x10c. Don't believe me? OK then. Don't.

It would need a BASIC interpreter. And I have not decided if it is only going to read BASIC like a scripting language, or if it actually would implement an compiler and run the code as a virtual CPU.

TIS-100 was a fun little game, check it out.

I have been trying to make a BASIC parser in flex & bison, and I have been reading this book on google play. But I got stuck at the point where it kind of "recursively" parses programs.

Like for instance, it reaches a line like "IF A<5 THEN" block-of-code "ENDIF"

Where that block of code is, that would only be executed if A<5. But how to make a compiler for that? Well, if would need to compile something to check if A<5, and then compile the block-of-code, and then go back and make a JMP, to jump over the compiled block-of-code if A>=5... I guess. Don't make it too complicated.

The computer must have some functionality in the game. What will it do...
I guess it can't do much unless it is connected to some sensors.

My first inspiration to this game was that movie Silent Running. And while the computer doesn't play a big role in the game, other things do. Like the droids... I think the main character smashed the computer and the communication system.

But in my game, I would like the computer and the communication system be much more important and play a much bigger role.

And it would be fun to have those droids there as well.

A game needs some challange, otherwise it can get boring.

Maybe you can get hit by mini asteroids that would do holes in your ship and leak oxygene. You need your droids to fix this. you need your computer to tell the droids where to go and what to do.

There could be many ways to do this. Would you need "oxygen-level-sensors".. what is that excatly? I don't know. But I imagine that something like that might exist.

The computer needs to comunicate with the droid to tell it where to go ? How can this be done. Does the ship have X,Y,Z coordinates. Or can it be done even more simple maybe.

Or is that too much. Maybe it can be done without the computer, maybe it can be done manually aswell. But you could figure out that the computer is a good tool to fix these problems faster and automatically.

In Silent Running there was also a garden.

I think I would want that too... But that makes me think of two things, sunlight.
And actually electricity. The garden would need Sunlight, and the ship would need electricity. Solar panels.

And another thing. Materials, I mean, just things. In Homeworld you "mine" stuff from rocks, just do "mining"... I think you did that in Alpha Centauri aswell.

Maybe I could implement Mining in a more fun way, by mining individual atoms, from the periodic table. If you found a large rock in space, you could go there and "mine", to get iron and copper and gold and silver and coal, even helium and oxygen and uranium, and anything.

The garden would supply you with oxygene, as long as it gets light. But what if there is a hull breach. The droids would need material to fix that.

As I said earlier, the communication system would play a much bigger role in this game.

Who would you communicate with, earth?

I was thinking maybe earth is gone, maybe everyone there is dead. What if the ship you were on was supposed to have other crew members. But they died for some reason. Their hybernation chambers failed.

Don't bury the bodies the garden though.... If you've seen Silent Running.
You know what I mean.


So you're the only one left... or are you?
Maybe there is another sun out there with another person struggling to survive.

Because what is your purpose of surviving in the game if you're the only one left. There is no reason really. You might as well die.

Maybe there are people on earth, but you can't come back. You are stuck on this station. For some reason.

I would find it more fun, if you were able to leave rotation from the sun. And go somewhere else, maybe find another star to circulate around... What would happen to the garden during this time... Maybe the garden could be frozen down quicly, and and then unfrozen when you have reached another star.

You would need to save up an amount of food to do this trip... And you need to get into hibernation? But if it takes 100 years to reach another star with another person, that person would already be dead in 100 years... So you need.. hmm. I don't know yet  really.. There need to be some kind of unrealistic element in this to make it work.


I am too tired now to think more. I don't know how to get this game fun.
I really need to go to sleep. Goodnight.

No comments:

Post a Comment