Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

820 Good

About GroZZleR

  • Rank
  1. I'm looking forward to post #3 where you post all your highly reputable sources to back up your claims.
  2. GroZZleR

    Anybody left from the 2003 crowd?

    I mainly lurk now.
  3. 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. 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. 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. GroZZleR

    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. 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. GroZZleR

    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. 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. 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. @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.
  12. Hey all, I'm plugging away at my new AS3 / Flash framework and I've stumbled upon a problem with my entity component system. I'll reference Marcin Chady's powerpoint presentation from GDC Canada to help explain. I refer to shared data as Attributes (as does Marcin) but you may know them as Properties too. In the presentation, Marcin says that any modification to an attribute must be broadcast to the entity (and therefore, all attached components). I agree with this behaviour... if your HealthComponent receives a TakeDamage component and your health drops below 0, all other components should know instantly (to change states or update graphics, whatever). Marcin presents this code for a HealthBehaviour component: [source] void HealthBehaviour::OnMessage(Message* m) { switch (m.type) { case APPLY_DAMAGE: Attribute<float>* healthAttr = GetAttribute(HEALTH_KEY); healthAttr->value -= m.damage; if (healthAttr->value < 0.f) mGameObject->SetLogicState(DEAD); break; case ATTR_UPDATED: if (m.key == HEALTH_KEY) { Attribute<float>* healthAttr = GetAttribute(HEALTH_KEY); if (healthAttr->value < 0.f) mGameObject->SetLogicState(DEAD); } break; } } [/source] Here's where the problem (at least for me) occurs. When a TakeDamage message comes in and the APPLY_DAMAGE case fires, the Health attribute is decreased by the amount of damage. This would, in theory, trigger an AttributeUpdated message which would turn around and repeat the same logic below in the second case for ATTR_UPDATED. That's pretty much the exact problem I'm having now. When a message is received that modifies an attribute, that attribute broadcasts a message that its values have changed and the same component basically repeats the same logic. Any ideas on how to overcome this? I like being notified of attribute changes because it lets me cleanly set certain object values without having to check them every frame (or if something happens out of order, say a collision moves the entity, my sprite component can adjust it's position without having to wait for the next update() call).
  13. GroZZleR

    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. 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. 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!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!