A QUOTE

My first jump was off by a factor of 100, so I flew against a cliff and blew apart. I’m still working on it.

A TEXT POST

Little things I hate #1

Life is full of little annoyances - hopefully it helps to write about them.

Presumably not, but here we go:

What is it with people still writing “first” in Comments? Why hasn’t this died out by now? You can’t make more clear that you don’t care about the content of the message - be it video, text or what have you. The only thing you care about is yourself being faster than every other Human on the Internet. But you can’t take the simple fact of live, that by chance alone there are no other people who have considered to make a useful commend yet (most likely because it takes at least a minute to read/view the thing), can you. You have do quickly announce the fact by typing a five letter word, because every other reply would take to long. And even than there are a hundred comments saying “first”, because you are not faster than every other Human.

I don’t know what’s going on in the mind of other people. Do they expect a gold medal? Is there some kind of online game out there for which these people try to score points? Well, I have an idea: Instant ban them. They are clearly not fit to understand the medium they are using and are as useless and annoying as advertising spam for the enlargement of extremities. We have no need for these people.

Boy, I miss George Carlin right now…

A TEXT POST

[Hexaverse] Unlikely Chances

A game needs to be unpredictable or else it will be only about remembering the right moves to win. Most programming languages give you an algorithm that produces pseudo-random numbers which you can start with the current time or the time since the computer booted. This is well and good but it’s not much more than a big bucket of dice – every number has the same likelihood of coming up.

BlitzMax Code:

SuperStrict

AppTitle = “A bucket of dice”

Global gfx_w:Int = 256, gfx_h:Int = 256
Graphics(gfx_w, gfx_h)
SeedRnd(MilliSecs())
SetClsColor(255, 255, 255)

Local DiceCount:Int = 100 ‘* number of dice
Local DiceResult:Int[6] ‘* how often did that number come up?

‘* dump the bucket and count…
For Local i:Int = 0 Until DiceCount
DiceResult[Rand(0, 5)]:+1
Next

‘* make a chart:
Cls
For Local i:Int = 0 Until DiceResult.length
If i Mod 2 = 0 Then
SetColor(128, 64, 64)
Else
SetColor(64, 128, 64)
EndIf
DrawRect(i * 32, gfx_h, 32, -DiceResult[i] * 8)

SetColor(0, 0, 0)
DrawText(i + 1, 12 + i * 32, 8) ‘* number
DrawText(DiceResult[i], 12 + i * 32, gfx_h - 16) ‘* frequency
Next

Flip()
WaitKey()
End

What if you want to simulate a lottery draw? Get a random number, write it in a list and add only numbers that are not on the list? Possible, but not very elegant. Better: Make a list of all numbers, pick a random entry of that list and remove that entry – no double checking necessary.

BlitzMax Code:

SuperStrict

AppTitle = “6 out of 49”

Global gfx_w:Int = 256, gfx_h:Int = 256
Graphics(gfx_w, gfx_h)
SeedRnd(MilliSecs())
SetClsColor(255, 255, 255)

Local AllNumbers:Int[49] ‘* List of all possible numbers
‘* Enter numbers:
For Local i:Int = 0 Until AllNumbers.length
AllNumbers[i] = i + 1
Next

Local Numbers:String[6] ‘* Space for the six numbers that be pulled out

‘* draw numbers:
For Local i:Int = 0 Until Numbers.length
Numbers[i] = GetRandomFromArray(AllNumbers)
Next

‘* print numbers:
Cls
SetColor(0, 0, 0)
DrawText(“Drawing: “, 8, 16)
DrawText(” - “.join(Numbers), 8, 32)
DrawText(“Remaining numbers (49-6): ” + AllNumbers.length, 8, 64)

Flip()
WaitKey()
End

Function GetRandomFromArray:Int(_N:Int[] Var)
Local rp:Int = Rand(0, _N.length - 1) ‘*Select a random location of the array
Local rn:Int = _N[rp] ‘* Determine the number at this position
_N = _N[..rp] + _N[(rp + 1)..] ‘* Cut the number from the array (Slices)
Return rn
End Function

Alright, but that is still not what we (and most games) need. We want probabilities with a percentage attached. What would Diablo be if all Items had the same drop chance?
We now use two lists: One stores the objects, the other a numeric value which is the weight of the probability.

BlitzMax Code:

SuperStrict

AppTitle = “Weighted probability”

Global gfx_w:Int = 256, gfx_h:Int = 256
Graphics(gfx_w, gfx_h)
SeedRnd(MilliSecs())
SetClsColor(255, 255, 255)

Local Item:String[] = [“A”, “B”, “C”]
Local ItemWeight:Int[] = [15, 10, 5]
Local weightMax:Int
For Local i:Int = EachIn ItemWeight
weightMax:+i
Next

‘* Statistical distribution:
Local Zufall:Int[3], Maxcount:Int = 1000
For Local i:Int = 0 Until Maxcount
Select String(GetWeightedRandom(Item, ItemWeight))
Case “A”; Zufall[0]:+1
Case “B”; Zufall[1]:+1
Case “C”; Zufall[2]:+1
End Select
Next

‘* Show result:
Cls
SetColor(0, 0, 0)
DrawText(“One object: ” + String(GetWeightedRandom(Item, ItemWeight)), 8, 16)
DrawText(“Statistical distribution:”, 8, 32)

For Local i:Int = 0 Until 3
DrawText(Item[i] + “: ” + Zufall[i] + ” - ” + Int(Zufall[i] * 100.0 / Maxcount) + “% (” + Int((ItemWeight[i] * 100.0) / weightMax) + “%)”, 8, 64 + i * 12)
Next

Flip()
WaitKey()
End


Function GetWeightedRandom:Object(_obj:Object[], _weight:Int[])
Local weightMax:Int, r:Int, Z:Int
‘* Determine total weight:
For Local i:Int = EachIn _weight
weightMax:+i
Next

‘* Generate a random value
r = Rand(0, weightMax)
For Z = 0 Until _weight.length - 1
‘* An object with a higher weighting is often issued
If _weight[Z] > r Then Return _obj[Z]
r = r - _weight[Z]
Next
Return _obj[Z]
End Function

Great! Now, we can finally generate a galaxy with different star types. The bright O class stars are rare (1 in 10 million stars) and the cool, red M class stars are the most common ones (1 in 8).

A TEXT POST

[Hexaverse] The smallest structure of space

As you might have guessed already, Hexaverse is named after the most prevalent feature: The hexagonal tiles.
Normal quadratic tiles are a simple grid which is easy to render and mouse coordinates are calculated by dividing by the tile size. Hex tiles are not that different – you can transform the one into the other:

The y-axis isn’t straight anymore and what tile the mouse is over isn’t two lines of code, but there are big up sides:
The distance from one field to another is constant. Moving diagonal has no advantage (or even meaning) on these fields – exactly like it should be in space.
Every direction can be expressed as a coordinate pair – and there is no need to differentiate between even or uneven coordinates!

Then, there is the matter of horizontal or vertical and regular or compressed representation of the tiles.

I like the compressed H-tiling the most – it looks nice and is easy to construct.

A TEXT POST

[Hexaverse] The structure of the universe

I needed a new long term project. Something to be working on now and then. I was seriously damaged a long time ago; I played Elite on my father’s PC, watched Star Trek TNG whenever it came on TV and read Perry Rhodan (the silver ones). I want to make a game in which the player has a variety of possibilities to choose from. Trade with different alien civilizations, explore the galaxy and – of course – blast your enemies into tiny, glowing bits of metal.

What kind of universe should I create? 2D or 3D?
I think 3D is overrated. It’s really hard for humans to navigate in 3D – we are accustomed to live on a 2D Plane. Even in Buildings or high mountains you really can only move in two directions most of the time.
Most games work perfectly good in 2 dimensions as they do in 3. Some would be even better in 2D - monkey island 4 for example. I like the pixel look from 1 & 2 the most, but the comic style in the third game was okay as well… but I digress… 3D would mean I had to make 3D models with appropriate textures. And figuring out the right sizes for things can be a pain to. In conclusion:
2D is easier to make, better to navigate and has no big disadvantage. Of course, it will be rendered with a graphics card with 3D acceleration – blitzmax supports opengl and directX 9 – but much like Diablo 3 is the user basically limited to two dimensions.

The next big decision: real time or round based?
Real time action could be fun, but I rather like the style of roguelikes. Not that I am good at them, but the premise is: you can think as long as you like about your next step, but if you die, you are dead – one live and no continues or saves (more casual players may choose a simpler difficulty setting, not that sure about that). Round based would mean discrete positions (now, that I think about it: not necessarily…). Quadratic tiles would have been simpler to work with, but more interesting are six sided Tiles.

But more about that at another time…

A PHOTO

Plays: 1462

Deaths: 1460

Wins: 2 [NEW]

I recommend a gamepad if you play Spelunky.

A TEXT POST

Mint Meat

Always try out new things. Especially if you can’t die from it.

Since i mostly eat spicy / tomato based dishes and my mom dropped off some Mint, i tried something with it. No preliminary research - where’s the fun in that?

I used the following:

- Mint, full leaves and lots of it

- Some meat, pig

- Potatoes, Onions

I finely chopped the mint and dropped it into rapeseed oil (good for roasting and it’s tasteless) and added some garlic.

Maybe a water based solvent would have been better. Anyway: Wash the Pork with cold water and dry it.

And mix both together!

Neat.

This is the right time to heat the oven to 180°C (356°F, 453.15 K). Grab the potatoes, slice them simply in half (maybe wash them first if needed) and put them on a sheet. Add oil, salt and thyme with a brush.

Put the potatoes in the oven and keep track of the time - they need about 45 minutes.

Cut the onions and sear them in an big pan. I added mint also.

If they are to your liking, make room for the meat. I put the onions in a separate bowl.

Do not move the meat around and make sure the pan is hot - the Maillard reaction will start at 140°C (284°F, 413.15 K) and makes the meat tasty. Too cold a pan and the meat will be bland.

When the meat is done, we switch places with the onions again. To get a Sauce, we mix in some water and starch. 

To avoid lumps you could use a blender (other brands are available).

I used a little too much starch, but it’s mostly tasteless… Mix with onions and gravy:

That looks… wrong somehow, doesn’t it? Well, stir!

Better! After it’s gotten hot, it will get thick and you can turn off the heat.

The potatoes should be ready by now.

Those are always good! Put everything together while it’s hot.

Well, the sauce still looks weird, but how does it Taste?

The Pork is alright. No new revelation, but edible. The mint probably needs to be fresh - there is no spike one would expect. Still - there is minty aroma in meat and sauce. Could use something else, it is a bit bland.

Needs work, but it is a nice meal nonetheless.

A TEXT POST

Comments!

I don’t really get why tumblr does not allow comments by default, but using Disqus should work just fine. Installing was easy - a little too easy - but it seems to work.

Spezific questions, suggestions or requests are welcome.