• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0

Rotating Hitboxes, images and more

1 post in this topic

Okay, a few things to sort out. I am talking about a game called MapleStory, and an attacking skill in that game called Spectral Light.

I was wondering how the game handles the skill named Spectral light. It just boggles my mind at every turn, it seems like it'd be impossible to make.

This is the skill in question:

The skill works as follows: depending on the arrow key pressed, you can swivel the laser in nearly a 180 degree range about the player (who acts as the axis). The laser (and its corresponding hitbox) can then hit different monsters depending on its current position.

This is a video of how it works: [media]http://www.youtube.com/watch?v=5x7eGzIQ0IY[/media]

What I am curious about is how the hitboxes, rotation and animation loop code work.

For a better illustration of what I am referring to, here is a graphical representation of what I mean by 'points' at which the laser can be fired from. I will be defining this 'points' term within the context of this topic for easier discussion purposes.
The animation in question is rather smooth and as such I suspect a large number of points (perhaps around 15-20).

1) Hitboxes (obviously a normal rectangle isn't going to work for the various angles; is it more efficient for gameplay for the coder to plot a new polygonal hitbox that is associated with every 'point' of rotation, or are there other methods? If there are, what are they and how do they work?

2) Rotation- The actual 'loop' of the laser is 12 frames long. Is it possible that there are 12 individual pictures in the data for every single 'point' from which Spectral Light can be fired? If this were true, there would be a staggering number of images within the data just for this one skill. Won't the method simply refuse to run/crash/suck up immense amounts of memory and then cause a crash? Does anyone have information how this could be done in an efficient manner (fast loading, no memory leak, no crashing the program)?

3) Animation loop code- I understand that in Flash you can have an animated image that can be rotated while it loops its animation- however MapleStory is made in C++ and not Flash, so I was wondering how they accomplished this.
Say frame 1 plays at point x, when you swivel to point y, how did the coder do it such that the game knows it must play frame 2 of point y and must not start again from frame 1 of point y? From the videos I've watched, the frames are looping as they should as you swivel the laser, and the laser's animation does not re-start from frame 1 when it is swiveled to a new 'point' of firing. How could this have been accomplished?

I find this entire skill very puzzling. I've been trying to figure out how they did this. Edited by Kelsys

Share this post

Link to post
Share on other sites
It is a standard technique/feature that you can render your 2D sprite rotated to an arbitrary angle in realtime. They just use a rotation matrix that they apply to the sprite rectangle vertices when rendering, and the GPU deals with the rotation and filtering in realtime, no problem. Rendering a sprite axis-aligned versus rendering it in an arbitrary angle does not even carry a performance penalty, it's the same performance for the GPU. As for the assets, you only need a single animation sequence for the effect in the axis-aligned position. Googling for "2d rotating a sprite" finds some good hits, e.g. this is an example of [url="http://www.gaanza.com/blog/sprite-rotation/"]how to do it in SDL[/url].

For hitboxes, the case is the same. They probably have defined a rectangle, or a polygon that marks the hit area of the effect. This vector shape is rotated to the appropriate angle from its default axis-aligned orientation before testing for collision against the vector shapes of the other objects. Since there's only a very few points needed to represent such a shape (perhaps 10 at most?), it's very cheap and could be done in realtime without performance implications even on a mobile device.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0