datagod's Feed

datagod
08-19-2019 at 09:37 PM
2 Comments
Rate this Entry

Joys of Programming

Johnny was talking about his social network database project, and I had a long comment. Then I realized it might be a bit rude and I didn't want to hijack his thread. So I moved it here to its own thread. Wow, I feel like Alpigger all of a sudden.

=============================

I think that social network database project you were working is how we first met, before the drama wars disrupted the timeline.

All programmers have different skills and preferences. We find joy in different areas. I really enjoy building batch processes in the database world. How fast can you process 100 million records? Cool. Watch me do it faster and better. I love error handling, logging, etc.

Boss: Oh, your process has been running for 24 hours? How long till its finished? You have no idea?? Get Bill in here. He knows how to code this shite properly.

Boss: Bill? How long?

Bill: (pushes up nerd glasses) well good sirs it seems that the server is currently processing 4500 records per minute. At the going rate and the current records left, the systems projects that it will be finished in exactly 14 hours, just in time for breakfast.

T-SQL is a scripting language for a product built with C. No where near as close to the metal as ASM is, but in the database world people have been leveraging ORM's (object relational models) where they use .NET to say "write this to a table" and the ORM generates the SQL code for them.

My code to the generated code is like ASM to Basic. At least in my humble opinion.

HOWEVER, I truly enjoy programming the Raspberry Pi in python. I use the pimoroni library to turn on the individual lights, but everything else is all me. I looked up syntax, but all the structures and processing are all mine, and they are glorious.

Been coding for two years now off and on.

Here are some of the features that I coded, and am very proud of:

- floating sprites

- color animated sprites

- scrolling text

- screen can scroll in 8 directions

- a world stored in an object with all moving objects stored as objects mapped to the world

- a moving "camera" that can display any portion of the map / objects at speeds approaching 60 frames per second

- game play taking place off screen, only the portion we want to see is on the screen

- giving a primitive vision to the characters so they can see their surroundings and make decisions

- a playfield that supports hundreds of independent objects, interacting with each other


Some code samples:

I store my sprites and maps in simple one dimensional arrays. I was new to python and was not sure how to best store the information that would be pushed out to the display. Because of that my copy/display code is rather complex, but holy cow it is fast. I might re-write it some day, but probably only if I have to. These are now low level functions and I rarely have to look at them. They do the job and they work great.


Here is a sprite of a ship chasing a smaller ship. Visually the sprite is 36x8, but it is still just a long array of integers. Each integer represents a color that I have coded. 33 colors in all. The hardware can display millions, but that is overkill for a clock. :)



This is a simpler sprite, monochrome. 1 is on, 0 is off. It is the alphabet. I first coded this on a TRS-80 in 1984. I recreated my 5x5 font from memory.

Thanks for reading, will show more soon.



Thanks90skidJohnny thanked this post
LikesRiatoju, Rogerpoco, 90skidJohnny liked this post
Comments
  1. Riatoju's Avatar

    I loved Python, When I took on the Hector Telloc name my goal was to port my social network to Pyhton and rebuild it and combine it with Angular.JS or my own framework based on it that would be part of it. The system itself was called Enigma. It would have used a PostGres Database. The last version I was working on was built on PHP and MySQL. I liked MySQL fine, but PHP had to go. It was a poorly written language that has been build upon with layers and layers of bandaids. It wanted to be Pyhton without the strick syntax - Which I liked. But sadly I had a health scare in 2015, dumped all my projects and started doing art. I sort of fell apart over the years, distracting myself with the CAG wars.

    You know, now that I think about it, I can kind of see why you have an interest in the Pi. At first I didn't get it, but it's not really different from my reason of getting away from the PC. It doesn't require OS updates that overwrites old libraries with new ones. Everytime I'd write my game engine for a library, a new library would replace the old one. I started out using DirectX, tossed it aside, then coded it in HTML5 (abandoned that because I wanted more power) then the NES (I ditched it because coding in assembly took way too much time), then XNA which I really liked until Microsoft pulled the plug, then Flash which Adobe pulled the plug on, then finally I started coding it for OpenGL which I really liked because of the fact it was only updated when needed...but...I got screwed again, as they replaced it with Vulcan...I considered using Vulcan but the implementation wasn't ready yet, it was also extremely low level and no tutorials or how to's existed for it. So I said **** this I'm done....

    I was toying with the idea of programming the Genesis but like the NES there is no good documentation on how to do it from what I could find, just alot of notes from various people who tweaked it and figured things out. Also, I wanted everyone to be able to have access to my game, I wanted it to last forever and not break on an OS update.

    But I had spent more than a decade, nearly two, trying to build this, I was close to a perfect engine for a game....It was really well designed...but I also needed to design a level editor too. It really sucks I never completed these things...If I took them up again I'd have to rebuild them from scratch as they would need to be rethought out.

    Designing it for the pi wouldn't be a bad idea except I'm sure it relies on libraries that most OS's use, but...it would always be on that Pi, and I could sell the Pi's themselves as a portable one game unit, like the tiger electronics...

    But....I don't see it happening. If I do make my game, I may do it on a vintage computer....Or if good documentation exists for the Genesis that....And I'd probably do it in a combination of C and assembly.

    Likesdatagod liked this post
  2. datagod's Avatar

    The Pi can be very frustrating when trying to do simple things like set up wifi from the command line. Every OS release they seem to do things differently. OH! You put an entry in the config file over in /etc/blah.x. Nope. We moved it. Now you do it this way. Nope, that only works on release blah. Nope. Etc.

    The GUI of course is the easiest way to set up networking but on these little clocks I like to do everything from the command line, and the install is much smaller when no no GUI is involved. I bought a pile of cheap 4GB micro SD cards and they have more than enough space. Now you can't even find ones that small.

    I find programming my little project to be extremely satisfying and mood altering in a good way. While writing this post I was setting up a Raspberry Pi Zero W, which is a 12 dollar version that has built in wifi and bluetooth, 500mhz single core ARM processor and I think 256MB of memory. Massive overkill for a clock and cheaper than any other computer I can imagine. I went to sleep smiling. It really lifts my spirits.

    So I suggest that you pick a platform and go with it. Programming is fun. It is the work, the research, the puzzle solving that gives us pleasure. Dreams of fame and fortune? They are nice, but the goal should be the work itself.

    Please continue to share your work here. I see so much more activity on TG lately and with Jace's recent involvement I am getting excited once again. Not for high scores, but for community and a shared passion.

    Again what I love about our tools is that you can program your game for your favorite system then run emulators to test it out. There is a huge Retro Pi community that love home-brew games, as they (with permission) be legally distributed with the retro solution.


    LikesRiatoju liked this post
Join us