# GroZZleR

Member

2282

820 Good

• Rank
Contributor
1. ## Germany: Latest in a Series of Economic Super-Powers?

I'm looking forward to post #3 where you post all your highly reputable sources to back up your claims.
2. ## Anybody left from the 2003 crowd?

I mainly lurk now.
3. ## Parallax Positioning Problem

Hey all, I have a problem that I feel is either incredibly easy to overlook or is much more complicated than I'm giving it credit for. All I'm trying to do is align my backgrounds (which scroll in parallax both horizontally and vertically) to the foreground terrain so that you never see any gaps. I'm setting the y position of the background segments equal to the lowest part of the terrain (because I haven't figured out the trick yet). I build a test terrain and set the height for the segments to 0. I move the camera to 0, -240 (half the screen up) so I can see more than just terrain and voila: As you'd expect, the first background layer with a parallax factor of 1 (none) aligns perfectly and the second bakground layer with a parallax factor of 0.5 is a quarter of the way down the screen (-240 * 0.5 = -120 relative to the camera). Now I move the camera up to 0, -480 and get this: Now the second layer is taking up half the screen. -480 * 0.5 = -240 relative to the camera. So what's the trick to lining these up while accounting for the parallax scroll factor? Nothing I've tried has worked. Thanks for your input.
4. ## Generating downhill ski slopes for a 2d game

Hey all, What are some good techniques to generate a mostly downhill series of slopes for a 2D sidescrolling snowboarding game? I've google'd my butt off but everything is either about rolling hills or Scorched Earth style extreme peaks and valleys. Ideally, I'd be able to generate both easier bunny hills and more difficult mount everest super slopes with different weights of steepness. Another catch is that I do want some small upward trending sections to create ramps / jumps for performing tricks. Ideas? Thanks!
5. ## In game event messaging system.

I do more or less the same thing you do in my framework and I love it. I'm using ActionScript 3 so I have an easier time with reflection and what not: I use a message listener map just like you to register callback functions: public function addMessageListener(messageType : Class, callback : Function) : void { if (_messageListenerMap[messageType] == undefined) // only create the list if someone is interested in listening to these messages _messageListenerMap[messageType] = new Vector.<Function>(); _messageListenerMap[messageType].push(callback); } public function removeMessageListener(messageType : Class, callback : Function) : void { if (_messageListenerMap[messageType] != undefined) { var index : int = _messageListenerMap[messageType].indexOf(callback); if(index != -1) _messageListenerMap[messageType].splice(index, 1); } } I post Message objects that contain all of the relevant data in a nice type safe way (I pass the type with the Message because AS3 doesn't have a super quick way of getting the object type): public function postMessage(message : Message, messageType : Class) : void { if (_messageListenerMap[messageType] != undefined) { var callbacks : Vector.<Function> = _messageListenerMap[messageType]; var count : int = callbacks.length; for (var i : int = 0; i < count; ++i) callbacks(message); } } It's working great! The only thing I would say that a RatKilledMessage is probably a little overkill. I'd make an EntityKilledMessage and mark a "type" member as 'rat' and let the quest that's listening do a check like: if(entityKilledMessage.type == "rat") { ++ratsKilled; if(ratsKilled > 10) world.postMessage(new QuestCompleteMessage(this), QuestCompleteMessage); } I think you're on a great track -- only entities interested in specific messages receive them instead of shooting every message to every object.
6. ## Making a player change direction!

differenceX = targetPosition.x - currentPosition.x; differenceY = targetPosition.y - currentPosition.y; differenceAngle = Math.atan2(differenceY, differenceX); // in radians velocity.x = Math.cos(differenceAngle) * 100; // 100 is the speed you want to move towards the target point velocity.y = Math.sin(differenceAngle) * 100;
7. ## 2D Car Drifting

Hey all, I've got pretty much the most basic overhead 2d car physics going on: velocity.x = Math.cos(angle) * speed; velocity.y = Math.sin(angle) * speed; position.x += velocity.x * deltaTime; position.y += velocity.y * deltaTime; Pretty basic -- change speed to go faster / slower / reverse and increase / decrease angle to turn. Everything works, but it feels pretty boring to drive. How would I go about drifting? Nothing too realistic, just something fun and arcadey where the more you turn, the more you slide unless you counter-turn. Thanks!
8. ## Self set Challenge: 2 month dev cycle

Good luck! It's very doable. I do this with Flash games right now, for a living. Have you considered making them instead of downloadable games? You might find you can make quite a bit of money working on your hobby. It's also very satisfying to be able to upload your game to Kongregate / Newgrounds and get thousands (or millions if your game is good) of views, feedback and criticisms. Downloadable games generally aren't as easy to share.
9. ## Collision Filtering (by group?)

Hey GameGeazer, Thanks for your response -- I guess I wasn't super clear. In this case, defineCollisionMap() takes in an array of other groups that the group should check it's collisions with. Here's a more long winded example: Say I have four groups: playerGroup, playerProjectileGroup, enemyGroup and enemyProjectileGroup. I might define the "maps" as: playerGroup.defineCollisionMap( [ enemyGroup, enemyProjectileGroup ] ); playerProjectileGroup.defineCollisionMap( [ enemyGroup ]); enemyGroup.defineCollisionMap( [ playerGroup, playerProjectileGroup ] ); enemyProjectileGroup.defineCollisionMap( [ playerGroup ] ); But you can see later on when I call playerGroup.checkCollisions(), it'll loop through and check all the collisions against the enemyGroup. But when I do enemyGroup.checkCollisions(), it'll loop through and check all collisions against the playerGroup TWICE (since the playerGroup already checked those collisions). But if I don't add the playerGroup to the enemyGroup's collision map... it just seems so muddy. Perhaps I'm just over-engineering here.
10. ## Collision Filtering (by group?)

Hey all, I'm working on a shmup and I'm trying to filter out some collisions. Normally, in my framework, I just brute force through all the entities checking every other entity, but this is the first game I've made that has a whole mess load of entities. In this particular game, there's no reason for the enemy bullets to ever check against anything but the player's ship. A system of filtering seems to be the best / easiest fit but I'm looking to make it as extensible as possible for all future projects. At first, I thought a simple system of flags would be sufficient, a simple check like: if(entity1.flag == BULLET && entity2.filters.contains(BULLET) == false) (or something like that) That still leaves me iterating n^2 times and so that approach was out. Now I've devised a system of "collision groups" where when an entity is added, it's placed in a certain group. So the player goes in group0 and the bullets go in group1. That's all fine and dandy. Each group has a defined map of other groups it collides with like so: group.defineCollisionMap( [ array of other groups it collides with ] ); In my case, group0 has the player and group1 has the bullets, so it's: group0.defineCollisionMap([group1]); group1.defineCollisionMap([group0]); The problem, as I'm sure is quickly obvious, is that group0 checks against group1 and group1 checks against group0. That's double the amount of collision checks that's necessary. However, not defining the "collision map" for group1 because I've already defined a relationship in group0 just feels... dirty. Am I just being ridiculous or is there a smarter way to accomplish this?
11. ## Component Based Entity - Communication of Updated Attributes / Properties

@wqking That'd definitely work but not with two different components processing the same message. @ApochPiQ I think that'd work for health but not for other behaviours. @Antheus Thanks for the lesson. I think accepting the redundancy is my only option -- I guess it's just up to me to make sure the parts that'll be redundant are as optimized as possible.

13. ## Sprite Splicer

Hey all, I was in need of a tool to splice together multiple images into sprite sheets and I couldn't find one that would allow me to adjust the cropping or export to make sure there was no blank space... so I did the only thing a programmer would do, and made one! Instructions and details are on my site: http://www.grozzler.com/programs/sprite-splicer/ Screenshot: It needs AIR to run, link is on my site also.
14. ## GTA style buildings without 3d acceleration?

Sorry I posted before heading out -- I'm looking to implement something similar in a Flash game, specifically targeting Flash Player 9, which doesn't have any hardware acceleration at all.
15. ## GTA style buildings without 3d acceleration?

Hey all, This is the sort of effect I'm looking for, with the sides of the buildings being properly projected. Is this relatively quick enough to calculate in software? I'm more than willing to make a number of compromises regarding size, shape, anything really. I can't seem to find any articles on the subject, of course "GTA style buildings" isn't exactly the pinnacle of google fu. Thanks!