Alfonso Crawford, the Slackerjack

  • Random
  • Archive
  • RSS
  • Ask
  • Submit

How to Make an Alarm Clock in Windows 7

    • #PROTIP
    • #windows
    • #productivity
    • #video
  • 1 month ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+
Computers v. Developers
View Separately

Computers v. Developers

    • #code
    • #programming
    • #lol
    • #puppies
    • #animals
    • #pugs
    • #humor
    • #pictures
    • #java
    • #python
    • #c++
    • #c
    • #javascript
    • #linux
    • #open source
    • #windows
    • #cute
    • #seizure warning
  • 1 month ago
  • 13
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

So Everybody Knows

I’m working on Blender pretty hardcore, right now. To get the best performance out of the engine, I’ve had to scrap everything I knew about game-development and start from scratch.

Once I get to a point where I’m comfortable stopping, I’ll do some big write-ups for you all. Blender really doesn’t like to be pushed around, but it’s very cooperative when you give it the proper space to work.

    • #blender
    • #programming
    • #game design
    • #game development
    • #linux
    • #windows
    • #announcement
  • 9 months ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Good night~!

Here’s what I’ve got so far.

The Loader

def load(filename):
	ini_file = configparser.ConfigParser({'x':0, 'y':0, 'a':0})
	if not ini_file.read(filename): return

	try: name = ini_file.get('header', 'name')
	except (NoSectionError, NoOptionError): name = filename

	_FRAME_REPOSITORY[name] = ini_file

The Setter

def set(repo_name, num_str):
	if repo_name not in _FRAME_REPOSITORY: return
	rf = _FRAME_REPOSITORY[repo_name]

	self.clear()
	hb = 1
	while True:
		sect = num_str + '.' + str(hb)
		if not rf.has_section(sect): break
		hb += 1

		bpy.ops.object.add()
		box = bpy.context.active_object
		box.parent = self.origin
		box.select = False
		box.worldPosition = self.origin.worldPosition
		box.worldOrientation = self.origin.worldOrientation
		box.applyMovement((rf.getfloat(sect, 'x'),
		                   rf.getfloat(sect, 'y'),
		                   0), True)
		box.applyRotation((rf.getfloat(sect, 'a'), 0, 0), True)
		try:
			pass
			#box.dimensions[1] = rf.getfloat(sect, 'w')
			#box.dimensions[2] = rf.getfloat(sect, 'h')
		except NoOptionError:
			pass

Yeah; I mix tabs and spaces in multi-line statements. Wanna fight about it?

What’s Left

  • I’ve got to write a little something to allow for dimensions to be set: I’ll probably just hack the scale of the hitbox by leaving the depth at 1 (since this is for a 2D fighter) and using it as the base for multiplication or division or whatever the hell I gotta do to get the relative scale.
  • Set the rest of the hitbox-properties
  • load via os for multiplatform functionality
  • asd;fkldasfj;asogfhagfohaewrewragfr3eojirgfaefiroirgafert4kji

Dude, what?

I'm gettin' too black for this shit.

Fuck it, I'm out.

It’s beddy-bye time, bitches. I am out this piece.

    • #liveblogging
    • #programming
    • #python
    • #blender
    • #code
    • #game development
    • #game design
    • #games
    • #gaming
    • #linux
    • #windows
    • #collision
    • #data management
    • #pictures
    • #follow up
    • #todo
  • 9 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

I’m thinking of making a setup where loaded INI-files are used to hold the collision-frame data. It’d look something like this:

collibo.load('filename.ini')
body = collibo.Body()
body.spawn()
body.set('name specified in file', 1)

Here’s what the INI-file’d look like:

[header]
name: Bob Saget

[1.1]
type: cat
weakness: dog,water,noise
onhit: scratch
shape: square
solid: 1
x: 0
y: 0
w: 0
h: 0
a: 0
[1.2]
type: dog
weakness: water,newspaper
onhit: bite
shape: circle
solid: 0
x: 0
y: 0
w: 0
h: 0
a: 0

Collibo (“collision” + “[little black] box”) would have a global repository that it would keep to itself, to store these files, of course.

    • #python
    • #programming
    • #code
    • #games
    • #gaming
    • #game development
    • #game design
    • #data
    • #data management
    • #blender
    • #linux
    • #windows
  • 9 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Selecting Objects in Blender, from Python

I’ve been working on how to clear a body-origin of its child hitboxes, and encountered a weird error: the clearing-method would remove the hitboxes, but then the destructor wouldn’t delete the origin! What I discovered was that the one hitbox I was making took away the focus from the origin, and I never returned it. Luckily, there’s a boolean property in the body-object, select, that makes such work child’s play.

After some tweaking, here’s what the clearer looks like:

def clear(self):
	for hitbox in self.origin.children:
		hitbox.select = True
	bpy.ops.object.delete(use_global=True)
	bpy.ops.object.select_all(action='DESELECT')

The constructor has a fancy new line, too!

self.origin.select = False

And, lastly, the destructor has a little more bulk:

def __del__(self):
	self.clear()
	self.origin.select = True
	bpy.ops.object.delete(use_global=True)
	self.origin.select = False

The lesson here is to always be mindful of Blender’s selection-mechanic. I personally am going to make sure that every dynamic object I create is deselected from the get-go, and to use bpy.ops.object.select_all(action='DESELECT') to clean up massive operations.

I advise that you do the same.

    • #python
    • #programming
    • #code
    • #blender
    • #games
    • #gaming
    • #game development
    • #game design
    • #linux
    • #windows
    • #foss
    • #tutorial
    • #collision
    • #physics
  • 9 months ago
  • 2
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Baby Black Box, Revisited

Man, this feels so good. I’ve been thinking that it was impossible to make and control logic bricks from within Python for a while, but now I’ve got it figured out:

def spawn(self):
	bpy.ops.object.add()
	bpy.ops.logic.sensor_add()
	bpy.ops.logic.controller_add(type="PYTHON")
	bpy.ops.logic.actuator_add()

	self.origin = bpy.context.active_object
	c = self.origin.game.controllers['Python']
	c.mode = 'MODULE'
	c.module = ''
	c.link(self.origin.game.sensors['Always'],
	       self.origin.game.actuators['Motion'])

This is what I’ve changed since my previous post on the matter, hence the title. Since logic bricks exist within an object-bound namespace, I can run this little number as many times as I want. The shortcut, ‘c’, is just to keep inline with the Official Python Style Guide without having a mass of multi-line statements; also, I figured it’d be slightly faster than having the system run through self, origin, game, then search an index of controllers.

    • #python
    • #programming
    • #code
    • #games
    • #gaming
    • #game design
    • #game development
    • #linux
    • #windows
    • #follow up
    • #collision
    • #physics
    • #blender
  • 10 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Blender’s documentation isn’t for programmers.

I’m trying to write my little collision/physics-module, and figuring out how to create objects (and, currently, parent them to each other) from within Python is proving arduous.

Steady progress is being made, so hey. Whatever.

Update: Apparently, I just set the parent-variable in an object. Well.

    • #blender
    • #programming
    • #game design
    • #game development
    • #linux
    • #windows
    • #python
    • #PROTIP
  • 10 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Modular Physics and Collision

I know that I want to make a “little black box” for hitboxes to use Blender’s built-in physics-engine, but I’m not sure how I want to handle it. Here’s what I’ve got bouncing around in my head right now.

  • First, a sprite would request a main body, which’d be a sphere.
  • The sphere would have a fixed rotation.
  • What the sprite would handle is a Python-object written around the sphere, that would have functions to add/remove hitboxes to the sphere, and to poll them for collisions.
  • The sprite itself doesn’t give even the slightest damn about anything the main body does or what the hitboxes do: it just wants to mess with their indexing and ask ‘em what they’re touching.
  • If the body’s Python-object has a function that parses fighter-data about what shapes to load, I could just have the function parse a text-string that that sprite doesn’t even look at.

Here’s what I think the functions would look like:

  • collision.Body
  • collision.Body.add_hitbox(coord_string, hit_type, weaknesses, *affects)
  • collision.Body.reaction()→ returns the first hitbox with a collision it polls
  • collision.Body.flip()
  • collision.HitBox
  • collision.HitBox(coord_string, hit_type, weaknesses, *affects)
  • collision.HitBox.striking() → returns boolean
  • collision.HitBox.flip()

That’s where my thinking has brought me, thus far.

    • #python
    • #programming
    • #game design
    • #game development
    • #linux
    • #blender
    • #windows
    • #collision
    • #physics
  • 10 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Custom Python Packages in Blender

Always rely on relative pathing, at least in Windows. The dots, they are your friend.

    • #PROTIP
    • #programming
    • #blender
    • #game design
    • #game development
    • #linux
    • #windows
    • #games
    • #gaming
  • 10 months ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+
Page 1 of 2
← Newer • Older →

About

Avatar

Need help making games? websites? mafia hits? I'll help you do it more simply. There's a lot of nonsense out there in development, and I've got as little patience for it as you. My focus is, right now:

  • Blender / Python
  • HTML5 / JavaScript
  • PHP / Ancient Necromancy

On this site, you'll find a mix of detailed tutorials and quick tips to keep from losing nights to stupid hiccups. Along the way, I will spam fanart and digressions regarding modern survivalism, personal projects, and tales of my antagonizing the animal kingdom.

This blog is LGBT Friendly

WARNING: the author of this blog has an unhealthy interest in women, and it is periodically reflected in the content shared. Most of the sick displays will be safe for work.

Pages

  • An Important Sidenote
  • Fluffernutter Peanut-butter with a Slice of Cheese

Me, Elsewhere

  • @MadamLaunch on Twitter
  • My Skype Info
  • Linkedin Profile

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask
  • Submit
  • Mobile
Effector Theme by Pixel Union