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

redw0lf

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

334 Neutral

About redw0lf

  • Rank
    Newbie

Personal Information

  1. I have published this article to my blog before, but because it is not so frequently visited and I did not find much advice for this subject I am writing the same article down here to share with everyone. This article is about porting a game written in python with pygame to Android. To do so we will use the pygame subset for Android, which can be obtained here. The pygame subset for android has ported a subset of the pygame architecture to the Android architecture. Hence it allows us to easily program games in python and port them to an Android application. This article will explain how to do so by using the breakout game, programmed by myself and obtainable here: In the end we will have a breakout game on our Android device which can be controlled by swipe gestures or by tiltingA the android device itself. If you want to rebuild what we will build during this article you will need the following programs: A Java Development Kit e.g. via OracleA or OpenJDK Python 2.7 and pygame obtainable here and here Device Drivers for your Android device, if you are using WindowsA and a little help for Linux here pygame subset for Android (PGS4A), obtainable here These programs are more or less needed if you want to run the breakout game itself and then later port it to your Android device. If you plan to skip this part and simply run the game on your local PC, the pygame library is not needed. The whole porting and programming is just one more click apart. Setting everything up The first three parts just need to be installed, either via a package management system if you are using Linux or by downloading and installing them if you are using Windows. PGS4A just needs to be extracted in a folder of your choice. As far as my project setup is concerned this looks like the following and can be viewed on github: ./pgs4a/ directly containg all PGS4A stuff ./pgs4a/breakout/ containing all the python source code and our main.py ./pgs4a/breakout/data/ containing all images and so on for our game This structure needs to be like this because PGS4A will only work this way. Now mostly everything is set up, except PGS4A - we will start with this. First you should test if everything is up and running for PGS4A by running: cd pgs4a ./android.py test This should return green text stating All systems go!A This basically means that we met all prerequesits. After this we need to install the corresponding Android SDK which can be done by executing ./android.py installsdk This should start the installation of the needed Android SDK. During this installation you are asked to accept the TOS of the Android SDK and if you would like to create an application signing key, which is needed if you want to publish your application on the Play store. You should answer both questions with yes. The key is needed later on for some signing purposes and the installation process. But be warned if you want to sell the application in the Play store you will need to recreate a key, because the key created during this process uses no password. If you have finished successfully you will be rewarded withA It looks like you're ready to start packaging games. Important: At this point you must make sure that you actually installed an SDK! You may get an error or a warning that the filter android-8 is not accepted. If you received such an error you need to manually install the Android 8 sdk. This can be done by running ./android-sdk/tools/android Now the Android SDK manager should come up. You may need to update Tools before you actually see the same content as in the window above from there you can now install the Android API 8, which is needed to port pygame to Android. This will install the required API manually, which is needed because PGS4A has long not been updated. After this we are nearly ready to start porting our breakout pygame to Android. Adding Android to breakout In this part we are going to actually add the android device stuff to our game. For this purpose I would recommend you read through and download the source code. Now you should be capable of running the code within your python environment and be able to play the breakout game. If not make sure you have done everything right regarding the setup of your python and pygame. All modifications, and we do not have much modifications, are performed in the main.py, which includes the main function of our game. The modification includes importing the Android stack of PGS4A,A initializingA the Android stack, map Android-specific keys and adding some Android-specific stuff. Afterwards we should be capable of playing without further modifications to our game. Importing the Android package should be done below our standard imports in the main file. Hence we need to change the header with the imports to something which looks like this: import pygame, sys, os, random from pygame.locals import * from breakout.data.Ball import Ball from breakout.data.Bar import Bar from breakout.data.Block import Block # Import the android module. If we can't import it, set it to None - this # lets us test it, and check to see if we want android-specific behavior. try: import android except ImportError: android = None Now we have imported the Android-specific commands and are able to ask if we can access them or not via the android variable. The next step would be to initialize the Android environment and map some keys, we do this after we initialized pygame and set some parameters: def main(): """this function is called when the program starts. it initializes everything it needs, then runs in a loop until the function returns.""" # Initialize Everything width = 800 height = 600 pygame.init() screen = pygame.display.set_mode((width, height)) pygame.display.set_caption('break0ut') pygame.mouse.set_visible(0) background = pygame.Surface(screen.get_size()) background = background.convert() background.fill((0, 0, 0)) # Map the back button to the escape key. if android: android.init() android.map_key(android.KEYCODE_BACK, pygame.K_ESCAPE) At the bottom of the above code we checked if the Android package was loaded, if this is the case we initialize the android subsystem and map the back key of our Android device to the Escape key. So if we wanted to add a menu to our application which is normally called with the Escape key this would open the menu. In this particular example of breakout the Escape key will exit the game. Next we have to react to some Android-specific stuff, which is needed in each game. The game may be put into a pause mode, e.g. when the application is switched or the user tries to go back to the home screen. To react to this kind ofA behaviorA we have to add the specific code to our game loop: # main game loop while 1: clock.tick(60) # Android-specific: if android: if android.check_pause(): android.wait_for_resume() This would wait for a resume of our application if our game application was set in the pause mode. Due to the checks for the android variable we are capable of playing the same game on the PC as well as on our Android device. If you want to start the PC version simply run the main.py and you are ready to go. With these last additions to our main source code, we are now capable of porting our breakout game to an Android Application and develop on the PC using our standard setup. The porting process Now we have reached the point were we want to put everything we have created so far to our Android device. To do so we need to configure our setup, which is easily done running the following command: ./android.py configure breakout Make sure that the breakout folder exists before you execute the command otherwise you will get some errors. After you have executed this command you will be asked several questions including the name of the application and the package. As far as the package is concerned make sure not to use any special characters including -, _ and so on, otherwise you will get errors later in the process. As far as the rest of the questions are concerned I have stuck to the default answers. After you have finished you should be able to see a file called .android.json in the breakout folder, which should look like this: {"layout": "internal", "orientation": "landscape", "package": "net.sc.breakout", "include_pil": false, "name": "breakout", "icon_name": "breakout", "version": "0.1", "permissions": ["INTERNET", "VIBRATE"], "include_sqlite": false, "numeric_version": "1"} The next and last step before we can play our game on our Android device is the compilation and the installation of the apk on our phone. Both is handled by the following command line: ./android.py build breakout release install Before you execute the command make sure you have created an assets folder. If you have not the execution will fail and you are not capable of compiling the application. I guess the creator of the PGS4A forgot or did not implement stuff to create folders. Also as I mentioned before PGS4A is an old application and therefore may not work very well. If you have done everything correctly you should be able to play the game on your android device or the emulator you have connected or started. It should look very similar to the picture below. You should now be capable of porting any game created with pygame to android.
  2. I'd like to also mention Unity, it allows fast game development without much knowledge and in addition there are a lot of tutorials. Besides this I like the python + pygame thing, but you still need to do a lot on your own there.
  3. What may be helpful here is the composite pattern http://en.wikipedia.org/wiki/Composite_pattern   Here you have an abstract class/interface which is the base of everything else, e.g. an item. You can then have base items (leafs) which cannot be deconstructed further e.g. spikes or cores. You then can have some kind Weapons or other stuff, the components. You can also only see these components as groups and can go further down the path and just make ThrowableWeapons and maybe let a shuriken be a ThrowableWeapon.   The recipe could be defined by a hashmap or a table in the class saying for building you will need x spikes and so on. When you're building/crafting the stuff, check if the required items are in your inventory ( which may also be a component) if so remove them from there. If you're trying to decompose an item just add new instances of the items in the table to your inventory.
  4. You may also start by trying to remake already known games. E.g. start with a tetris or a breakout and continue with something more complicated. By doing this you can derive a lot of techniques needed for a proper game.
  5. I've done something similar to this for smaller dots in an microscope image. What i've done first is using a graphic programm like gimp or photoshop to change the image to a full greyscale image, then toying around with the contrast, brightness and edge detection filter settings. After I have found a setting or a procedure which suited my needs I tried to recreate the process in a programming language of my choice (it was. Matlab, R, java or python don't really remember) afterwards applying a cluster algorithm in my case dbscan http://en.wikipedia.org/wiki/DBSCAN to find the different "holes" in a membrane in my case. If you do it right you may receive something like an O shaped cluster, where you can caculate the center and the radius to one of the outer pixels, which defines you the circle you may try to find. That would be the way I would try to solve this problem
  6. I have not much knowledge of gaming AIs but as far as I think, what an AI basically does as mentioned in RedBaron5 example is calculating some kind of possibility either for defensive situations or offensive situations. Like e.g. how high is the possibility to lose health during the next turn, if it is high you either either try to dodge or block depending on whether the chance for blocking or dodging is higher. To model these states and dependencies you can use a state machine or some kind of tree. But this is calculated only for one move, the next may look totally different. Finding a good strategy here may be difficult   If you take a look at chess, a computer calculates x moves ahead, giving each move a score of 1 for a move where his situation will get better or a zero for where the situations gets worse. He can now sum up the scores for each path and choose the path with the highest score. This an easy task because you know each position and the possible next tasks for each figure. If you want to increase/decrease the difficulty of the AI in a chess game you could easily limit the moves which are calculated ahead.  In a fighter you could also think of such a way to calculate a strategy, e.g. using the elements move, fight, dodge, block and then search for the path yielding the maximum of hp loss for the player.
  7. For beginners, who start learning a language i would suggest to use the language with the most examples and documentation available. In this case java is often a good, maybe not he best way, to go.  As far as the rest is concerned I agree with tisdad and warnexus. The big issue with programming is only to understand the logic behind it, once the logic is clear you need to express yourself using some kind of language, which then can be nearly everything after some hours of training.
  8. In my opinion there is not a general answer to this. Use what you like the most or what you are most experienced with. Also I think the answer to the question highly depends on what you are doing with the data and what kind of data you are using. Another question would then be if it there is an easy API to support the programming.    As far as I'm concerned I like to use of database especially the nosql databases are quite handy to store data fast. E.g. MongoDb or djondb. You have the benefit that you do not have to think about on how  to structure your data as you would have in an sql database you can easily store and restore them.
  9. Learning the A* algorithm, right from beginning can be very confusing. If you haven't used/programmed similar algorithm. What helps to understand this kind of algorithms is to actually USE the algorithms, but do not program it our implement it, rather draw it with pen and paper. E.g. draw some points and connect these points with lines. Then add some numbers to the lines, they will be the distances or the actual costs, which are needed to travel from one node to the other. Then select a start node and a finish node. Try to find the shortest path between start and finish node. Write down the paths and your thought progress in a format like: Start at Node 1 go 25 to Node 2 and so until you reached your goal. Then think on strategies, e.g. on how to select the shortest path, a simple method would be to only use the shortest distance which is available, if you do so you may end up at the start or taking loops, then you may think of something like, i do not want to visit nodes again i have already visited and so on. Think of more different methods to improve your path, e.g. look a step a head and  calculate the minimum distance for two steps. If you think you have found a good strategy to do so you have created some kind of heuristic. Then try to implement the stuff you have created with the help of your favourite programming language, you should come close to the solution of the a* algorithms.  Learning by doing is always the best method but to know what you are doing, you should at least have a little knowledge about what you are doing.   Also as far as the different complex data types are concerned, they are basically derived from more simpler ones. E.g. a queue is a list where you always read the first element and store items at the end. A map is more or less something like a dictionary, where you have a key, e.g. a string and an attached value to the key. This value could be a string as well, if you may think in localization you could have one map for every language. In this case the key may be only a simple string e.g. BTN_FIGHT_TEXT and the value would then hold the string "Fight" for the english version... At least for this basic knowledge books are very good, because they explain this stuff in detail they also allow you to peak at them if you are uncertain. As far as the knowledge on the handling goes the best thing is to just use these data structures.
  10. My tips as a beginner in game development, but have an advanced knowledge in programming and reading. My personal opinion is to just start programming, developing the game because otherwise you will not be able to create/learn something. Develop your skills as needed e.g. start with a simple game whac a mole like game start with just one mole than go on and add more moles. Also I used python and pygame as the language to begin game develop with, which is a lot very easy and gives an programmer a lot of simple tools at hand. But for definite beginner maybe engines like Unity give an easier way to start