Haunted House

Origo is a funnyface (0,0)

Archive for January, 2008

Desprately trying to find other things than my homework to do.

Posted by Gasten on January 28, 2008

Mathemelodies or Melomathics?

Advertisements

Posted in Live coding, Music, Uncategorized | Leave a Comment »

Charles stross on the future of GNU

Posted by Gasten on January 17, 2008

I’m reading this book, Singularity Sky by Charles Stross (Great book. Read it!). It’s a Hard Sci-fi set in a distant future.

Stross have mentioned a number of brands, scientists and organizations that we have today – Einstein, IBM, Dion, the UN to name a few.

Today I stumbled upon a passage that indicated to the reader that one of the main characters were some sort of member or supporter of a organization called “Free Hardware Foundation” and were GNU Couturier number 15.6.

Apparently the software is free, and the FSF is unnecessary. They are still working on free hardware, though. Actually, in the beginning of the book, the Chief Engineer is a bit worried about a couple of black boxes that he isn’t allowed to take apart which’s being installed on his ship.

On the frist page you can read that the author got a grad in Computer science and have been working as a software engineer, so it’s not all that unlikely that he is a bit of a free software guy. Nice.

Peace!
Gasten

Posted in Books, Computers, Freedom, Sci-Fi | 2 Comments »

Soya-tastic!

Posted by Gasten on January 1, 2008

After discovering Fluxus, I’ve become more and more interested in 3D-graphics, been takin’ Blender for a spin and so on. This comes as quiet a surprise for me, since I’ve always thought that 3D was way hard (3 dimensions?! I’m struggling with only two!), and to use it, you had to implement garbage collection in C. Not my cup of tea, no.

Very well, I had some ideas that I wanted to try out that would be a bit inconvenient to do in Fluxus (bigger games), so I started to look for tools that could help me do what I wanted in Python, which is one of the only languages I feel really comfortable with, even if my biggest problem is that I haven’t worked with enough libraries yet.

After looking at python-wrappers for C-libraries like PyOpenGL and PyOGRE I found out about Soya. Absolutely amazing. I mean, Man…

You can do a simple 3d game in less than 300 lines of code. You can probably do a fun game in under 1 000. And when your project hits 10 000 lines, it still won’t feels scrambled and obfuscated (I believe – haven’t tried).

For those who think PyGame is easy – try soya. it’s way less difficult and focuses much less on boring things like micro management and rendering (It’s true!).

I took 15 minutes of my time to mod the “basic-5.py” tutorial to use my game controller instead of the keyboard. I really love my gamepad. The only thing I’m annoyed about is the lack of joystick standardness. Every application have to recreate some kind of joystick reconfiguration.

Oh well, I changed CaterpillarHead.begin_round() to:


for event in soya.process_event():
			
	# Check for joystick axis events.
	if event[0] == soya.sdlconst.JOYAXISMOTION:
						
		if   event[1] == 1: self.speed.z = event[2] / 160000.0	# Up/Down
		elif event[1] == 4: self.rotation_y_speed = -event[2] / 6000.0	# Left/right


		# Pressing the escape or 'q' key will exit the main_loop mainloop, and thus terminate
		# the program. soya.MAIN_LOOP.stop() is the right way to end your application, and
		# causes the MainLoop.main_loop() method to return.
			
	elif event[0] == soya.sdlconst.JOYBUTTONDOWN and event[1] == 16:
		soya.MAIN_LOOP.stop()

	elif event[0] == soya.sdlconst.KEYDOWN:
		if event[1] == soya.sdlconst.K_q:      soya.MAIN_LOOP.stop()
		elif event[1] == soya.sdlconst.K_ESCAPE: soya.MAIN_LOOP.stop()
				

	elif event[0] == soya.sdlconst.QUIT:
		soya.MAIN_LOOP.stop()
				
# Do the rotation.
		
self.rotate_y(self.rotation_y_speed)

By the way, round_begin() is the function that’s called on each tick, like a control rate for those who are into synth-development. There is also an advance_time() function which is called each frame.

Simple, huh?

(also, I’m not very proud of this implementation – in a real project I’ll process the joystick-value to have it in the range of -1 – 1, and not -30 000 something to 30 000 something. And I’ll make it less sensitive so whatever is controlled wont “nudge around” when an axis is on near-zero, but not zero-exact.

Posted in Computers | Leave a Comment »