• 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

virtual d-pad in game

2 posts in this topic

i am making a basic soccer game and am planning to take input via virtual d-pad, like those in gameloft and gamevil games.
can anybody tell me how to code one of them??

Share this post

Link to post
Share on other sites
How I do mine is to look for the first touch within a given area of the screen. When that occurs, I mark that as the center point of the stick. I'll draw an axis at that location from then on.

As that touch moves, I simply subtract the new coordinates from the original to figure the amount of deflection of the virtual stick. You can scale these deflection values to whatever you feel will work best for you...left as -1.0 and right as 1.0, or percentage values...whatever works best for your purposes.

I render a blob of some sort at this point where the finger is so I can see how far it is deflected. The graphics of the virtual stick are therefore an axis and a point blob showing the deflection.

There is usually a limit to how far you can deflect any stick. A physical stick, will naturally have a physical barrier and this is not present in the virtual equivalent. Therefore, you must usefully account for this lack of feedback the player would normally have.

The most important thing to take into account is not to all of a sudden 'cancel' the input just because the finger has moved beyond the maximum deflection from the origin. If you're moving a player, the player will just stop if the input is cancelled. This could be argued as feedback, but this stop moving, correct your deflection and start moving again cycle is far too frustrating for many games and players. Therefore, let the finger go beyond the stick and simply clamp the deflection only, not disable it. The deflection should also follow the finger, even if it is moving outside of the graphic representing the virtual stick. The benefit of this is that you do away with the need for a player to receive feedback from what would normally be the physical constraint imposed on moving the stick to a maximum deflection.

Ideally however, you will still give the player some feedback regarding how far they are deflecting the stick. The axis is part of this, however this is not convenient to look at. Instead, focus on providing a visible response directly where the player is looking. The most convenient example of this would be moving the virtual player proportionally according to the level of stick deflection - exactly what an analog control is for.

In full, this technique allows for a virtual controller with a floating origin (wherever your put your finger down you'll get a virtual stick). A virtual controller just doesn't have the physical feel of the origin so the advantage of this is you don't have to remember or use 'muscle memory' in order to determine where the center of the stick was. If you wish to return the control deflection to the origin you simply lift your finger and replace it. You learn this little trick very easily and it quickly becomes natural.

Some argue that fixed origin is better for a virtual controller. The implementation for a fixed origin stick is not much different to the above - just fix the origin and never move it. Personally I find these to be a little annoying if only because a lot of them don't offer any configuration with regard to the location of the stick. This will mean the location may not be ideal depending on the size of your hand - typically you use your thumb so depending on the location, your thumb will be cramped or stretched to use it which is uncomfortable.

Of course the downside of the floating origin is that you have to keep your finger on the screen or the origin will reset and your deflection is lost. Also, with your first touch defining the origin then to deflect the stick straight away you have to put your finger down and then move it. You can't just put your finger down and have the stick deflected straight away, as you can with one of fixed origin.

I still prefer floating though. Tablets are large and despite being light, they are not light enough to hold easily for playing with virtual sticks while pressing on the screen. At least for even a small duration I think this is uncomfortable. Allowing the player to therefore re-position their hands as often as necessary helps them to constantly loosen their grip and flex the hand, which I think is essential. Requiring a fixed pose for the hand for the entire duration of play, even if it is minutes can be excruciating and this is a big problem for a fixed virtual stick.

Despite my personal preference however, I actually think games should support both fixed and floating types...it's almost no effort. I also think that given the sticks are virtual, it's also correct and almost zero effort to support left handed configurations. There is no physical constraint to this, so why not? Edited by freakchild

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