Nice hot brew and to call my ISP and figure out why their automated system hasnt automated adding and configuring the website I registered yesterday, meh, I bet the support line isnt open till 9.
So I logged a ticket earlier, checked back at 11 for an update, but nothing. In the process though I found a bug on my ISPs management interface and have just reported it. Nothing like a good vulnerability to start the day. Think they’ll sort the hosting out this afternoon. 🙂
Just getting some advice on responsible disclosure from the 2600 bunch. Cant wait to do a little write up on what exactly was happening and how I came across it. A little bit gutted they don’t have an active bug bounty program.
Well fun over for the morning, back to preparing notes and research. I say research … I’m currently working on some game hacking lol which might involve some impromptu gaming. All the notes for the next hakology video are ready, looking for some new projects and interesting stuff for you lot.
Pic of the day today goes to … one of my old processors I’m trying to find my old DX33 but this is the oldest one I could find for the moment. 133Mhz of joy back in the day.
HACKS!!!! Hacks a plenty today. Just hacked my first game oh yea! Working on something that’s not been looked at before which is also fun 😀 https://en.wikipedia.org/wiki/ToeJam_%26_Earl In case you were wondering.
Enjoying a coffee and reflecting on the day.
No audio over HDMI on retropie? No problem, here’s your solution i’ve seen a few fixes on the web lots varied some were overly complicated so I decided to write up a really simple fix. Tested and working on the RPi3MB.
Go to the retro pie menu
Go to the audio menu and press ‘A’
Ensure HDMI is selected, also check the mixer volume is at 100%
Save settings and return to the retropie menu
Quit emulation station
sudo nano /boot/config.txt
uncomment the following …
so it looks like this …
also uncomment …
so it looks like this …
Press ctrl+x to save the file.
now run …
amixer cset numid=3 2
I would consider this my first proper post hehe … I started this blog to make life easier when doing videos about code sometimes the screen capture and editing that goes in to a short clip can be painful and consume a lot of my spare time. Here ill be able to waffle on about code and linux to my hearts content (with the ability to access the articles and update things after they have been published).
So this hopefully will turn in to some kind of archive generated by hakology plus various odds and ends I find lying about the interwebz.
I digress … keeping on point this is a python pygame introduction to simple 2D game engines (with a view to move on to opengl and 3D graphics at some later point) for this tutorial you will need the following:
Python- Pygame Librarys and Modules
IDE (It doesnt really matter what you use – at the moment I’m really enjoying ninja-ide)
This tutorial is for linux users, the development rig I’m using at the moment is Debian Jessie (Test/Dev Release)
Ok so down to business if your rocking debian jessie or similar you shouldnt have too many problems getting up and running.
First install python
sudo apt-get install python2.7
Now install pygame
sudo apt-get install python-pygame
Now install ninja-ide
sudo apt-get install ninja-ide
Hopefully that all went well 🙂 (if it didn’t please consult google.com/pygame/python/debian documentation)
Now in your home folder we need to create a folder to store everything so pop a terminal and make a directory
Now you should have created a folder and a file in the folder and opened that file with ninja-ide
This is where the fun begins.
Add the following to the first lines of your python file ….
from pygame.locals import *
The lines above tell the python interpreter to import and load all the librarys and variables from pygame.
Next we need to set some variable to store how big we’d like to make our game window.
wWIDTH = 640
wHEIGHT = 480
Right now were ready to add the first function that is called when the file is executed
if __name__ == “__main__”: # main function call
r = 1 # set variable for return value
pygame.init() # initialise python pygame
GCLOCK = pygame.time.Clock() # set game clock
GSURF = pygame.display.set_mode((wWIDTH, wHEIGHT)) # main game surface
while r != 0: # quit if return not equal to 0 (0 = game exit, 1 = restart main loop)
r = main() # get return value from main loop (1 == OK … 0 == exit)
Ok so lets explain the code … the first line of the above block is defacto python code you will find this in (almost) every python script you encounter, the second line defines a variable called ‘r’ and sets it equal to 1 this value is used later to determine if the game should continue or quit. GCLOCK is a variable used to store pygames clock which is used later for frame rate calculations and game speed. GSURF is the game surface ie. the area or the screen we are going to be drawing to notice we pass in the pre defined screen sizes we set at the top of the script. The while loop and main game call will not quit until the return value is equal to 0. The line within the while loop is the main game loop call when we call this function we expect a return value of either 1 or 0.
Right now to add the main game loop …
When you add this code it needs to go below the variables we created earlier but above the first function call.
r = 1
while(1): # do for a while (game loop)
for event in pygame.event.get(): # handle events
if event.type == QUIT: # ctrl+c
r = 0 # return 0 = (game is over)
elif event.type == KEYDOWN: # down arrow
if event.key == K_ESCAPE:
r = 0 # return 0 = (game is over)
if event.key == K_q: # q key pressed
r = 0
GSURF.fill((0, 0, 0))
if r != 1: #check value of r
break #exit main game loop
Ok so the above code basically runs and keeps the main game window open it loops forever until the escape key is detected if the escape key is detected or quit program event then the window will close.
You can now test the script by pressing play in the ninja-ide tool bar.
or entering the following in the command line …
Enjoy your nice blank window opening and closing.
Whoot well done you and stay tuned for part two coming very very soon 🙂