Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Mussi

Member Since 12 Oct 2004
Offline Last Active Yesterday, 10:07 PM

#4956834 Platforming Game Level Programming

Posted by Mussi on 07 July 2012 - 11:53 PM

I appreciate both responses, though they seem a bit conflicting. Many of the sprites will be the same. Similar to Terraria, there will only be a few different types of blocks, which will be repeated several times.

They seem conflicting because it's situational. I'm not sure how efficient Processing is in rendering a large amount of tiles, but it wasn't good enough in my situation. You're not using Processing, so you might not run into the same problem. I actually used a tileset from Terraria btw.

It sounds like I can always go back and find more efficient methods of displaying many sprites later on, if it comes down to them causing too much of a problem, so perhaps I can just see what happens when I place all of them, and change it if needed.

I'd suggest you do that, don't need to fix what isn't broken. However, If you do find it to be insufficient, the solution I posted is probably as efficient as it can get.


#4956800 Platforming Game Level Programming

Posted by Mussi on 07 July 2012 - 09:03 PM

I recently made a platformer using Processing(Java) and for simplicity's sake I rendered each tile individually. It turned out to be too slow so I rendered the static parts of the world into much larger sprites(512x512), which reduced the amount of draw calls from about 800 to 2. I know that you can destroy/build tiles in Terraria, so if you're going for something like that you'll have to update the larger sprites when necessary.

As for keeping track of the entire level, I'd advise you to only render what's on screen. It's fairly easy to implement.


#4917463 How would a filling clock drawing algorythm work?

Posted by Mussi on 28 February 2012 - 12:46 PM

Is this thread of any use to you?


#4899759 check if enemy is in range to fire.

Posted by Mussi on 04 January 2012 - 05:38 PM

That is not what you're looking for. You want the tower to shoot when the enemy is in range of the tower right? To calculate the distance between two positions you'll have to use Pythagora's theorem. To keep things simple, to calculate the distance from point A to point B you get this:
D = A - B;

distanceSquared = D.x*D.x + D.y*D.y;

distance = sqrt(distanceSquared);


Now if you want to check if something is in range, you don't need to calculate the actual distance, you only need to compare the squared distances. In your case you only have to check whether distanceSquared <= radius*radius.

If any of that is unclear, let me know and I'll try to explain in more detail.


#4899748 check if enemy is in range to fire.

Posted by Mussi on 04 January 2012 - 05:13 PM

Why do you think this is the correct way to check if something is in range? Try looking at your if statement and interpret what it actually is that you're checking for.

A hint for the correct way to approach this problem: check if the squared distance to the enemy is smaller or equal to the squared bullet radius.


#4896612 Generating animations at runtime

Posted by Mussi on 22 December 2011 - 01:20 PM

You could map the creature partially to the skeleton, ignoring the leg bones or you could map it fully and it'll look...weird I guess. You could also allow the user to set how much the bones actually influence the doodle.


#4896547 Generating animations at runtime

Posted by Mussi on 22 December 2011 - 09:30 AM

In 3D games creatures of different shapes and sizes often share the same skeleton, allowing one skeletal animation to be applied to different models. This works because the models are, so to speak, mapped to the skeleton.
I think you could something similar in 2D: create a 2D skeleton with animations and map the doodle to the skeleton and then deform it accordingly during animation. Mapping the doodle could be done manually or by some algorithm.


#4893478 3rd person camera collision response

Posted by Mussi on 13 December 2011 - 06:59 AM

Yes that's correct. Another option is to temporarily change the camera angle so that the camera goes up, in most games there's hardly any obstacle that prevents the camera from going up. I went with 'first person view' when the camera gets too close because the camera angle is of significant importance when using the mouse, sudden changes would be very annoying to play with.


#4893282 3rd person camera collision response

Posted by Mussi on 12 December 2011 - 04:33 PM

Im leaning towards option B. I think thats how most game cameras deal with intersections. Either way im doing a swept rectangle test. Except for option B i use the furthest position instead of closest.

What do you guys think? Would this produce satisfactory results? Is there a more efficient way?

From what point are you intersecting? I'd start from the player and backup until an intersection occurs, that'd be the nearest intersection. I use a sphere instead of a rectangle, easier to handle for me.


#4887042 How to call NPCs?

Posted by Mussi on 23 November 2011 - 05:00 PM

Joe, Sam, Margret etc.? You can throw in a prefix or suffix if you want to make clear what they're for.


#4885323 Cant get object to move at variable speed toward point [C++]

Posted by Mussi on 18 November 2011 - 08:52 AM

float s_s = r / WellStrength;

Acceleration.X -= ( dir.X * ( ( WellStrength * s_s ) - distance ) ) * DeltaTime;
Acceleration.Y -= ( dir.Y * ( ( WellStrength * s_s ) - distance ) ) * DeltaTime;

WellStrength is never used. s_s = r / WellStrength, then you multiply s_s by WellStrength again. WellStrength * s_s = r / WellStrength * WellStrength = r.

If you want strength to be equal to 0 on the edge of the radius and linearly increase to WellStrength when getting closer to the centre, you can use the following equation: strength = (1.0f - distance / radius) * WellStrength.

Does that answer your question?


#4883885 Cut triangle with circle

Posted by Mussi on 14 November 2011 - 01:11 PM

I'm not sure, but from looking at your picture I think a good place to start would be:

  • For every edge of the triangle, intersect the n-gon for the first vertex to the second vertex and the other way around. If there's an intersection and the intersection point does not overlap with an existing vertex of the n-gon, add the intersection point to the n-gon.
  • For every edge of the n-gon that lies within the triangle, look for a triangle vertex that makes up a non-intersecting triangle.
  • For every edge of the triangle that does not intersect with the n-gon, look for a n-gon vertex that makes up a non-intersecting triangle.
Let me know if you find a flaw in there :lol:.


#4872793 Beautiful code

Posted by Mussi on 15 October 2011 - 05:22 AM

Sometimes when I write a complex piece of code that's easy to reuse and loose coupled or something along those lines I can't help but think it looks beautiful :lol:. How many of you occasionally think their code looks absolutely beautiful?


#4872123 Using f10 keys in the game :(

Posted by Mussi on 13 October 2011 - 01:55 AM

Try adding this to your window procedure:

[source lang=cpp]case WM_SYSCOMMAND: switch (wParam) { case SC_KEYMENU: case SC_SCREENSAVE: //optional, prevents the screen saver from popping up return 0; } break;[/source]


#4863378 Getting variable address with the source code given

Posted by Mussi on 19 September 2011 - 09:40 AM

1. Can I calculate stuffs / do anything to get a variable address given a source code for that program? (I make a simple program that looks like this)

int dummy = -1; int main(int argc, char** argv) {   return 0; }


can I calculate the address of the 'dummy' global variable? (without helper tools like memory scanner, but just by reading its source code? I know it sounds stupid but meh)

You can create a pointer to store the address of the variable:
int dummy = -1; int* dummyPtr; //pointer that will hold the address dummyPtr = &dummy; //assign address to pointer

More on pointers here.

That means you'll have to recompile the program though, not sure if that is what you meant. If not, I think Antheus just gave you the answer to that.




PARTNERS