Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Sunday, 27 September 2015

Thinking about my game

I just started doing something... And I can't even remember correct C++ syntax.

I wrote "namespace std;" and it didn't compile. And I did something else for a few hours. And looked ar my old code. And it is supposed to be "using namespace std;".. Oh. OK :)

Still not sure if I want to use C++ or just standard C. I am not so good at C++. 

But maybe that is good. I need to learn how to use it.

I felt it would be fun to try and make the game without graphics. Because that is how I like working anyway. I want to do the "boring" parts first. Like the BASIC parser and things like that. Back when I was talking on how Notch worked, that he made something playable first. With graphics, something you can run around in. And maybe that would boost the motivation to continue doing something.

But maybe I shouldn't do it like he does it anyway. But do it my way.
I would like to have something playable as well in the beginning. But the problem has been, I don't know what the game is supposed to be. I don't really know what the goal of the game is. I think that has been the problem.

I love thinking back at when my brother made a simple game on Amiga. Where you would have rooms that you could walk around in. But it was only textbased. It was a prompt that said "You're standing in a room with 4 doors, what do you want to do?". And you would write "Go left". And you walked into the door to the left. And if you were unlucky, there would be an enemy in there.

Everything was kind of random I think. So if you killed an enemy it would just be by luck. I don't remember what the goal was or anything. But anyway, we had a lot of fun with that game anyway.

Not that I want to do a game like that. I want to make a game with graphics. But I mean, I can wait with the graphics. And try to do a game without thinking so much about the graphics first, because I am bad at that. But  try to make a playable game, that has a goal and a meaning but without any advanced graphics.

Maybe just ncurses if enough.

I picked up reading the Flex & Bison book from where I left off.

I don't really have that 100% motivation to work on it for a long time without interruption.

I started to get an automake and doxygen enviroment working.. almost. I've done it with C before. Now it is going to be 100% C++

Monday, 21 September 2015

Thinking more about that game.

I still feel motivated write more about my game today. It was fun. I feel happy now 

"I it at sinendivlob9oofx x4..... actuslliy i elll asleoo abdrrease.. "  ... yeah Goof x4, that was the most accurate  I could write during that sudden micro-sleep I got just now, I have lbl decifrdd to notficävä any mistakes kn this sentance. I will keep writing no matter if i am slerpimg ot not. Snf then keep writing on my computer...

Anyway..back to games. I liked Fo3 very much. The atmosphere and feeling that it has. It is not just another shooter with some enemies thrown in in here. And why Fo3 popped into my head I don't know. But I guess it is similar in a way.

You're a lone drifter that scavenges for loot to survive. It also has robots and hackable computers. Though I would like my computer to be a 100% programmable computer. And if possible even be sensitive to a viruses if some might have written code with bufferoverflow bugs in them.

Anyway, as I was writing yesterday. You can easily see how my imagination just drifts off. And the game becomes so big that I eventually can't handle it.

One trick is to come up with as many ideas as possible. An figure out how it an be programmed to use less code, I mean use the same functions but just change the parameters a little.

....I am making breakfast now. This is an ugly picture I drew. It is inside a spaceship, and it has a computer screen with green background. A Window, and you can see stars outside. And that purple thing is a droid.

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.

Sunday, 23 August 2015

No cellphone

How strange it is living just one day without my cellphone. Reminds me on how addicted I really am to it.

Still have not found my original charger. But I have not looked very well either.

I have been so tired today, probably because I slept so bad last night.
I think I did fall asleep a little bit during the day. But I am still tired.

Everytime I sit infront on the computer I fall asleep much more easily. Than for example, if I lay down in my bed or sofa. That is strange, maybe it is something about using the brain a little bit more when I use the computer. I read and/or write or do something. So my brain is more active and does a little bit of work, so it makes it sleepy.

If I just lie down, I don't really do anything. So it is more difficult.

I've been watching Notch on twitch.tv, he is very social and he responds to my messages sometimes. I wrote to him that I had a game idea similar to his idea before I heard about 0x10c. And then wrote that I always loose motivation in the middle of a  project. Well, his response was kind of predictable, I guess just keep working anyway even if you don't have the same kind of motivation you started with. And I know this works well, that is what I learnt from my jobs also. You loose motivation to keep doing anything at all, but I have to finish it sometime.

When you see the game starting to get in a playable shape, it is a little bit more fun to keep programming.. or you can loose motivation at this state in the game developemnt too.
You just have to keep working anyway, I know this,

Look at this  ugly bug in my objParser program.
It cannot handle all types of polygons,
It was so long ago I actually did something in objParser. And still, that program is just a tiny tiny tool that I needed for my game.

I don't know how many times I've fallen asleep while writing this, 10 maybe, or 20. Maybe 30...

I feel like playing a little Rocksmith, and or Akiba's Trip. Or maybe Eternal Sonata.

I wish I had some good friends so we could help each oher to keep motivation up and the project keep moving. But maybe that won't work with me, I'm not very social,

And I see so bad. I reallt really need new glasses. That is so boring right now ;/
Usually I liked trying different styles of glasses that was new, but now I am more ugly than usual. so a pair of glasses wont make any diffence anyway.
I  should keep the ones I have now and just buy new lenses.
Sometimes I can't see my mouse pointer.

Oh, this tiredness I have is madness...

I can't remember if it was today I made pancakes or if that was yesterday?

Anyway, I need to make more food, so pea-soup maybe then. But now I'll take a risifrutti. And oh, a cup of coffee. But I don't think it will wake me up. I really need better sleep.

Wednesday, 19 August 2015

The space game idea

I have for a very long time, many years, wanted to do a game that takes place on a spaceship floating around in space.

And this spaceship would have a programmable computer as well as a radiotransmitter and reciever. Maybe some programmable droids.

Then Markus "Notch" Persson (creator of Minecraft) came with a very similar idea to mine. Though his game world was more developed, he is also a much better programmer. He called it 0x10c or Zero to the speed of light or something like that. Sadly the hype around this game grew so much that Notch didn't want to work on it any more. I can understand him, that must be a lot of a pressure to have all those people expecting you to do something.

And so many people had already made tools for programming the DCPU within the game that there wasn't much else to do on that I guess.
He often said that he didn't know what the game was about. Or how he could make it fun.

I haven't really seen anyone else doing a decent playable game based on 0x10c either. Even if the fans said with so much confidence, that they were going to do it themselves.

I kind of have the same problem. I want to make a game. I know the setting, it takes place in space, you are on a ship. The computer can be programmable. The radio-transmitter can send signals, and you can listen to signals.

So far, that sounds like fun to me.

But what are you supposed to do really. I don't know.

The game that I want to do reminds me a little of that movie Silent Running. Or it is very inspired by that movie you could say.

You would have a garden to take care of. Basically a survival game in space.
It would be fun if the computer could be hooked up to the radio. So that you would be able to communicate with others, even if they are too far away. Actually, you wouldn't really be able to know exactly where they are. But maybe able to figure out where they are.

You would be stuck circulating around a star. Because you need light for your garden and solar-panels to charge the batteries that gives you electricity.
So if you wanted to travel, you would have to take a risk. Going away from the sun/star and your garden would slowly die. It would get cold and dark. Your batteries would slowly drain. Until you can charge them again from another star.

The more I think about it the more ideas I get. So it becomes almost impossible to program.

And I am not really that good at game programming. If I did it, it would be in OpenGL. I would also need to have decent graphics. And I am not really good at doing that either.

I've tried doing some 3d graphics in Blender. But it doesn't look very impressive.
The project is just too big. I can pretty much forget to make something that others like. My idea was just to make a game that I wanted to play, and having fun while doing that. But it is just too big to ever get anything that is playable.
So far I've done the objParser program to export models that I've designed in Blender to c-code.

Then, I am not sure if I should use C. But rather C++. And I have not programmed much in C++. I downloaded the free C++ book on google play, it is really good!

I could just start doing something,  but it will end with some messy code that is impossible to continue to work on. And that is would be better to start from scratch.

I don't know. But it is fun to think about it sometimes. And come up with new ideas.

Someone else who is much better at programming than me would do it much faster. I've seen Notch work on smaller games on Twitch. And he is so fast! He does things in minutes, that would take md hours to complete. Either because I want it to be perfect, or because I want to take long breaks :)

Tuesday, 18 August 2015

Deepdreaming a shrimp


Using an image of my cat as a guide. I liked this guide-image (below). I'm going to experiment with it some more :)
The "guide" image used for shrimp #2

Monday, 17 August 2015

Playing TIS-100

This was really a game for me :)

TIS-100, I can sit with this for hours.

It is a game from the creators of SpaceChem.

You program a simple assembler language to solve problems, in what seems to be some kind of broken system. Some squares are red, they are broken. In the other squares you can execute assembler opcodes and move data up, down, left, right. And do various operations on the numbers, adding, subtracting, moving to the ACC or BAK registers.

It is quite limited what you can do. There is no MUL operation. There are some various jumping operations.

I suppose the game gets more complicated later.

Here is a screenshot of my program in the middle of a run.

There is a task description in the upper left corner.

Task description visible in the upper left corner
It says that this program is supposed to read a value from IN.A, then double that value, and output it to OUT.A.

I only played the first two levels. I didn't really feel like playing anymore today. I need to eat something soon and take a break from the computer and everything.

Maybe I'll play this more later, or I'll practise some more on Rocksmith.

Deepdreaming my breakfast

I need to learn how to make a network trained with my own set of images soon. It just seems so complicated.



I'll just save this link here for reading later.

https://generateme.wordpress.com/2015/08/12/training-own-dnn-for-deep-dream/

I feel so tired today.

Thursday, 6 August 2015

Just some random thoughts of whatever flows out of my mind

I started writing very fluidly on my phone, then my phone was being stupid getting stuck at 15% charged and kept jumping up and down from 14% to 15% and popping up that stupid message "you image upload have been cancelled for low battery" bla bla bla or "your drop-box account is full" bla bla... Yeah it was the phone that wanted me to have drop-box, stop complaining at me. I went to the computer to keep writing, but now I feel that the fluidity of this post is kind of lost. But I'll publish it anyway.

A friend of mine, or rather acquaintance maybe, just got this Corsair K70 with cool programmable RGB LED's. I have been looking at those before but was a little bit turned off because of the "gaming" sticker on there, and they are quite expensive. *Meh*. Whatever.

But now I really want one :)

I often feel my time is short, how much time do I have left. I want to have as fun as I can for as long as I can. And I often feel, what if I don't even live up until my next pay day, I keep using money from my savings account.

People probably think I am crazy. How can an RGB lit keyboard give that much enjoyment. But that is just who I am I guess. I love technology and toys, it can sometimes bring so much happiness. And this feeling of limited time also makes me feel I need things NOW, I can't wait two or three weeks.

I know, I am being materialistic. That is a bad thing that I have. I should find enjoyment being with my family and friends and and find happiness in that and work of those relationships. Especially with my father, where I have felt that the relationship between us has changed for the negative, a lot.

I have it too good here, I live in a wonderful apartment. I got things and electronics lab equipment that some people wish they had... I got everything, and still, I can get bored. It is the worst feeling, getting bored and unmotivated, when I have all this.

"Do not store up for yourselves treasures on earth, where moths and vermin destroy, and where thieves break in and steal. But store up for yourselves treasures in heaven, where moths and vermin do not destroy, and where thieves do not break in and steal." Matthew 6:19-20

Anything can happen in two weeks, or even just in one week, or a day. Suddenly an artery breaks or gets blocked by the tumour or I can't breath. I don't know what kind of problems can happen, the doctors don't really know either. I just got all these pills to help me from anxiety, and they work sometimes, sometimes not so much. Things like that scare me so much. I live for today and don't worry about tomorrow. Because tomorrow everything can be gone.

I just wish I could buy that keyboard today. But I have bought so many things I always wanted, I need to look at what I have. the Battlestar Galactica game still standing to be played, lol :) But I find no motivation for that right now. And I have the guitar now, that brings plenty and plenty of enjoyment :) It is so fun to play, even if it sounds like crap. I feel like playing later.

Anyway for the Corsair RGB keyboard, I had to check up first so that it works in Linux. Because I run nothing else than Linux on my computers. It is a rule that I have set up for my self between 10 or 15 years ago or so.

Almost like becoming a vegan or something like that. Yes, with the lifestyle you choose there comes limitations. I can't do everything on my computer that most people can with Windows, I can't run those expensive software that people use (that they probably acquire illegally anyway, together with some viruses along with it).

I have to stand being ridiculed over and over, hearing bitchy comments about my choice of operating system is wrong. "Why can't you be like everyone else", "Why do you use Linux? what is the point?" etc etc, I think it's most common, and the bitchy comments like "Wanna play a game? Oh yeah forgot, you can't do that on your computer you have to write the software first, LOL".

But being like everyone else or not, that is not what it is about, everyone is missing the point completely.

I choose Linux, because of freedom. I'm not handcuffed by my operating system. Because that is how I feel when using Windows. It puts me in a locked up situation where the operating system tells you how to use it, and then it doesn't work anyway.

And how do I fix it? Calling customer support? "Did you plug in thw power cord". How can I figure out in a deeper, down to hardware specific information what errors might have happened.

Microsoft wants their operating system to be easy to use for the user, I get that, that is a good thing!

But with it, comes for some reason (like watching a TV commersial based channel) all these things like "Please install our search bar", or "please install our product it will increase performance", etc etc etc. You know how it is. You need to filter all that out when using Windows. Once you learn that it works a little bit better. Sometimes, when you press "NO, I don't want it" and then give you some mind bending questions and you get that dirty search bar anyway that increases the load time of your browser 50%.

The computer always seems to get slower and slower in time anyway. Non-technical people seem to believe that computers gets slower in time. They don't, new computers are faster yes, yes. But the computer you bought 2 years ago is just as fast now as it was 2 years ago. But Windows makes it sure to install more and more software and drivers and fixes until it gets to a point where it seems like 90% the computer seems to do is use it's power to run background processes that comes from software "needs" to have this background program running, or just unnecessary programs that you never really needed in the first place.

Of course there are sometimes problems with Linux as well, it is not perfect, far from perfect. Sometimes things just stops working after an upgrade for example. But the more problems that arise, the more I learn how to fix things. The more I learn how the OS works. I still don't know after 10 years how Linux works 100%, but I have never been able to NOT resolve a problem. If something doesn't work, I can figure out the problem and fix it, by googling or just reading the man pages. And the OS doesn't seems to get slower and slower no matter how much new stuff I get installed, because all that stuff doesn't need background processes taking up memory etc. I don't need to worry about "search bars", or other completely unnecessary "clean you disk" software that gets thrown in my face. If I want to clean my disk with some certain software, I look up the software I need and get it, I don't want my operating system tell me what I need.

It is also so simple to get started programming in Linux. Just like back in the Amiga and C64 days. You get all the software you need to just start practising. Of course you don't get a manual with the PC explaining programming in Linux. These days you need to search online for tutorials. I think it would be fun if someone made a PC, with a decent distribution pre-installed, and a programming manual with it. My taste would be C or C++. Or if that is overkill as a beginners language, there are 100's out there to choose from, Some people will probably say Python. Personally I think Python is a mess of spaghetti and noodles of libraries and yada-yada. But so many people say it is good, so I trust them, just never got into it myself so much.

Oh, and back to gaming...

I love games, but PC gaming has become such a far away thing for me. I have of course mostly used computers as gaming machines in the past, first my brothers C64, then the Amiga where I learned to program in Basic a little.
But when I got my first PC in 1997 I think, a 133MHz, don't think it even was called Pentium at that time. I don't remember, or it was the very first Pentium maybe.
I had Windows 95 back then. Then I started programming in QBASIC, and later Turbo Pascal and trying to make my own things, very slowly. Took some years for me to figure out Mode 13h, but then it became much more fun to try and program my own games. You can read about that in an old post I did a few years back. Still, I was never good at finishing a project. I never came to a position where I felt something was complete.

At this time when I started doing more programming, I also started change my point of view on computers, that the computer is more of a tool than an entertainment machine. It is a tool for computing and crunching numbers. And I got more and more interested in Linux and programming after that.

On my PC I played Quake and Day of the Tentacle. Two of my favourite games back then. I also got Riven, the sequel to Myst. Oh, and Dungeon Keeper, I absolutely loved that game. Both 1 and 2. I think EA Games bought the rights for those games and just threw them in the trash, like "nope, there's no market for this". So we will never see another Dungeon Keeper 3. Like a lot of games I liked went into the "no market" bin.. Ignition, whatever happened to that? A fun little Swedish game.

However there was this kick starter project making a very similar game to DK. I have it but I haven’t played it much. It was just basically like DK2 and the graphics wasn't really better, didn't introduce much new stuff so I got bored of it pretty quickly.

I know, it's not easy to compete as an indie game developer against those large game company beasts. Trust me, I've tried making games on my own, just look back in my blog, those projects pretty much died after a week or so. You really need the motivation, skill and creativity to do it. You really need to work hard, and that might not even be enough some times.

I really look up to those few that had managed to do it, Marcus "Notch" Persson for example. When he started the 0x10c project, I was so excited because it was so very close to an idea of a game that I wanted to do for some time.

My phone has also become so weak and stupid after installing WhatsApp. I have a completly stubborn friend who cannot, over his dead body adapt to others. I've always used Viber without any problems whatsoever. I refused to install WhatsApp because I did it once and it just slowed down my phone, I hated it. I told him, just tru Viber for f**k sake. But no, it is purple or it is "gay" or it is something else that doesn't work for him. We just use it to send messages ffs, I cannot simply understand what the big deal is. We HAVE to use the worst program because it fits his needs, and 5 other people must follow him and do the same thing, and they do, of course.

But when I want my friends to try something, try this app or look in this store it's cool, nope, it is more or less f**k off. we don't care. Sometimes I feel it is a good thing that my life is short now. There are things in life that is just problematic and makes me angry and upset.

Friday, 10 April 2015

Millennium Falcon in OpenGL using objParser

I dowloaded a Millennium Falcon model from blendswap and used my objParser program to convert it into OpenGL C code.

I used this Millennium Falcon model by KuhnIndustries http://www.blendswap.com/blends/view/48469

This is a rendered image of the model, rendered in Blender


Export the model into .obj in Blender. And this is a video of the GUI mode in objParser.

Friday, 27 March 2015

Convert Blender models into OpenGL code

I have been trying to make games lately, my first attempt was to try and make a 2d game by rendering a character model I made with an Orthographic camera in different angles. The result was this



I didn't really know what to do with that though..

But I also wanted to try and convert my Blender object into c-code. There are probably lots of scripts to be found out there. But I want to do something on my own.

I made a wavefront .obj parser in Flex and Bison that I used to convert the file into c code.

https://github.com/Spekkio/objParser

I made this spaceship in Blender



Then I converted it into c code using objParser and implemented that code into a program.



There are lots of things that can be done with the objParser tool, for example texture locations can be exported, colors etc. I've been thinking about implementing LUA support, to be able to write scripts for the export routines. To make it possible to output to any type you wanted to, VBO's, JavaScript, etc. It would also be possible to implement it as a loader.
I am a little bit worried about the linked list that I wrote though, I don't know how well that will work on very large scenes. Pre parsing a file to check how much memory a file needs before maybe a good thing, I don't know ?

Sunday, 30 March 2014

Petit Computer 3DS

Nintendo DSi/3DS has the coolest app, Petit Computer. It is a BASIC interpreter, and has some simplified functions for drawing graphics on the screen. It is very fun!

Here is my first thing


Sunday, 16 June 2013

GLSL Programming

I went to Dreamhack today, I live nearby so I only bought a one day pass and looked around a little. I was mostly interested in looking at the GLSL Introduction, they showed some simple stuff to get started. So I've been playing around on shadertoy.com

Here's a munching squares example I just did.

Rotating munching squares:
https://www.shadertoy.com/view/4df3WM

Electron field (Coulumb's Law):
https://www.shadertoy.com/view/4sf3DM

Mandelbrot:
https://www.shadertoy.com/view/4dX3W7 

It was really fun to do. In the old days the fun part would be in getting these things to render fast, but you don't really have to worry about that now. :)

Friday, 14 June 2013

My old Turbo Pascal programs and games

I found most of my old programs and games that I did in Turbo Pascal, up to around 2003. 10 years ago :)

Even though I only had a 200MHz Pentium computer back then, the programs ran much more smoothly that they do in DosBox on a Xeon 3.3GHz computer ;)


I did not try all programs here. I did not have more time. Most of these programs make use of Mode 13h in DOS. I had so much fun playing around with that.

Here are some more programs, I especially like the 3D program FL.EXE.



There are four games that stick out, the Pong game, Knight game, Space and Snake games .

The Knight game, I took one sprite from Final Fantasy, the other I drew myself. I also had a map editor, but I was not able to run it. I got runtime error 200, that I remember I struggled alot with. I think it had to do with the CRT library, maybe. It could sometimes be fixed with TPPATCH.EXE, but I later found it was much better to not include this certain library at all, and I found ways to make my own procedures instead of using the ones in CRT.

Knight changes to night and day. There was a bug where the black color turns blue. I remember I fixed this, but sadly all of the newer versions of my programs was lost in a hdd crash. These programs I have here are backups, so they are a little bit older.

I had to alter day/night procedure when I filmed this because, usually the game only changes to night if time is between 21:00 to 06:00. So it stays in sync with computers clock :) I changed it for this video, so it changes between day and night every 30 seconds.

I also had a version of the Knight game that had an encrypted MAP file for some reason, this version was a little buggy.

The Pong game isn't much, it's basically just a nice intro screen :) But I was able to do a ball and a paddle, but not much more function than that.

Mode 13 only had a 8bit color table, 256 possible colors. The color table in Mode 13 was programmable, I could set any index in the table to a 24bit RGB color. I used Photoshop to generate the best possible color table for a certain image . I stored that in a file, and I saved the image as a RAW image. Then I wrote a program in Pascal that read these two images and combined them into one that I call DAT file. I had a DAT file reader, but I did not try it in this video, there are many DAT files to look at in future videos :)

The Snake game, I played that alot myself. This game originally also had music, but it did not work in DosBox. I will experiment with settings to see if I can get that working also.
It was possible to increase and decrease the speed of the snake, higher speed and you got more points. I did not find the button to increase the speed, I could have checked the code but I gave up :P

Not much to say about the silly Space Invaders game. It's kind of lame :) You cannot die, you can only loose points, and the game never ends.

I also did some programs in assembler using Mode 13. I was trying to be within the 256b limit. There was a page called 256b.org where people could upload small programs with a 256 byte size limit. Some other guy made a tube demo, that was totally impressive. My programs was not that impressive, these are some of my creations. But these are around 512byte large. :)


Friday, 21 December 2012

Simple CMS Systems

I used to work as a webprogrammer, and every time we made a new website. I created a simple CMS system from scratch in PHP for the website owner to manage their information. It was different every time, it could be anything from a webshop to an ordinary blog-type website. But almost always there was some speciality function that was not in the CMS from start. Like being able to create a poll and manage the results, uploading pictures and having them scaled in different sizes, etc..

But also always keep it as simple as possible, so that any newbie could get into it easily. I wanted to take away as much useless information as possible, like edit slugs, features to create categories and other things that only looks too abstract for a new CMS user.

So I got an idea that I wanted to create a CMS for creating CMS systems, but still keep it extremly simple and clean.
It became this: http://sourceforge.net/projects/mikkrocms/

But still, this is not for the normal user. It it more targeted towards programmers. I used it many times as a base to start from, without having to rewrite the same code over and over. It uses TinyMCE which I found to be very very nice.

It is not exactly what I wanted, but still it can do what I wanted anyway, almost.

The idea is that the CMS system's look, and what functions it has depends on how I create my database for it. So for example if I want to be able to create and edit a menu for my website, I want to have a table in my database for that menu. So I just simply create that table, with id, name varchar(255), timestamp, for example...

Then I want to be able to create and manage different pages, and also link them to my menu. So I create the table named "page", with id, name, menu_link and timestamp. The menu_link should be the same type as id in the "menu" table ofcourse.

When I connect MikkroCMS to this database, it will look at the tables in there, and automatically build up the tool for it. You can almost say it does the exact same thing as PHPMyAdmin does, but much more simple. And not to scribbly looking for the user with strange buttons everywhere.

It is also possible to create radio buttons, by naming a position within your table something like "foo_radio_choice1_choice2". MikkroCMS will look at the name of that row and create a radio button in the CMS system with the two choices. This maybe sounds abstract, a visual example is needed.

Later ofcourse, all the programming for the specified website is up to the programmer to create, and the CSS script for the CMS could be shared with the website afterwards to keep the same look and feel. The CMS system is almost already complete when the database has been made, but the website is not. This takes away alot of work if you want to create a CMS system + website.

Saturday, 20 October 2012

Generic Assembler

This is an assembler I made for developing my own CPU, I can use this program to define what I want my opcodes to look like and make simple test programs with it. It is not really complete, I cannot use #define for example, but it is supposed to support #define, to use macros like you can in C.

And for some reason opcodes looks like they are shifted one bit to the left. I noticed this when I was recording this video, it was over a month ago I worked on this project so I really don't know why right now. Even though the assembler has this bug the .set file I wrote for DCPU-16 seems to assemble the correct opcodes so I really don't know what happened.

Also opcodes are limited and locked to 16 bits, but that should be configurable in the future, but still the maximum size of an opcode is 64 bits.

Be sure to look at this video in 720p

http://youtu.be/ejKyaFMzhNM?hd=1

You can check out the source code here:
https://github.com/Spekkio/spekkio_asm

Wednesday, 3 October 2012

Hide email addresses from email scanners

I have always wondered how spammers can find my email adress. Do they just send mail to random adresses and hope it will arrive. My idea was that there were scanners that search the web and find e-mail adresses on random web sites.

So I wanted to hide the e-mail adress in the HTML code somehow, but still keep the original function of a mailto: link.

Take this simple Javascript.

function mejl(adress) {
window.location = "mailto" + unescape("%3A") + decode(adress);
}

It can be used on a normal link like this:

<a href="javascript:mejl('znkv.sbb@ubzr.fr')">mail me</a>

As you can see there is my e-mail adress encoded using ROT-13, znkv.sbb@ubzr.fr. It also looks like a working e-mail adress. So an e-mail scanner might pick it up and think it is a real adress. The decode() function can be replaced with any de-randomizing function you can come up with yourself. But here's the ROT-13 decoder.

var rot13map;

function rot13init()
{
  var map = new Array();
  var s   = "abcdefghijklmnopqrstuvwxyz";
 
  for (i=0; i<s.length; i++)
    map[s.charAt(i)]            = s.charAt((i+13)%26);
  for (i=0; i<s.length; i++)
    map[s.charAt(i).toUpperCase()]    = s.charAt((i+13)%26).toUpperCase();
  return map;
}

function decode(a)
{
  if (!rot13map)
    rot13map=rot13init();
  s = "";
  for (i=0; i<a.length; i++)
    {
      var b = a.charAt(i);

      s    += (b>='A' && b<='Z' || b>='a' && b<='z' ? rot13map[b] : b);
    }
  return s;
}

function mejl(adress) {
    window.location = "mailto" + unescape("%3A") + decode(adress);
}

Thursday, 7 June 2012

FFT Animation

I played a little with the FFT I wrote in C which I showed in my previous post. My program transforms chunks of data from a soundfile, prints it in text files. Then plots are plotted with gnuplot and assembled into a video with mencoder. Source code of the program used can be found here

https://github.com/Spekkio/dig_filter/tree/master/fft/complex_builtin

Thursday, 31 May 2012

FFT

I have wasted to much time trying to write a DFT algoritm in C, source code can be found here. It's not very good, but it computes correctly. Here is an example, where I put in a noisy signal, it contains three sine signals, with frequencies 2Hz, 17Hz and 401Hz with different amplitudes and some noise. It looks like this

And after the Fourier Transform i get this data
In the code I simply checked which frequencies was larger than 0.35 in amplitude, and saved them. The other ones was zeroed. After and inverse fourier transform with the ifft() function. The output was this.
Pretty :)

Tuesday, 8 May 2012

Discrete low-pass filter in C

I was interested in trying to make a discrete low-pass filter in C, also make it so that it can take data from from the pipe maybe. Anyway, the filter_rc() function can take data by keep pushing in new values and it takes care of everything.

One problem that my program has is that it cannot run forever, it can only take a limited amount of samples till the buffer is full. I think it is possible to check the value with the first index in the buffer (the last_value[] buffer), and if it is zero the buffer can shift down, I think this will work. Since the zero values in the sum isn't necessary anymore.

Here is a plot of the output, the input is a Sine Wave with 1 Amplitude, and 42Hz. It's plotted over 0.1s. And the filter is C=4.7uF, R=5k. The program can take any input, it doesn't have to be a sine wave. The red curve has 20 samples over 0.1s, and the green has 100 samples over 0.1s.
The Program can be found here https://github.com/Spekkio/dig_filter/blob/master/main.c