Hot answers tagged

36

I think you're after Application querying switch(Gdx.app.getType()) { case ApplicationType.Android: // android specific code case ApplicationType.Desktop: // desktop specific code case ApplicationType.WebGl: /// HTML5 specific code }


36

First of all, are you sure you really need that? Have you calculated the memory footprint? A small back-of-the-envelope calculation: A single mob and its state should fit into 100 byte of data. Let's give it a whole kByte, in case you are doing something extraordinary. When a cell has 1000 such entities, it requires a MByte. If your world is 100x100 cells, ...


31

Welcome to open source! As most developers will tell you: "What documentation?". Documenting code is probably the least fun developers have when creating a project. So what do you think is often severely lacking when the developer isn't even getting paid for their creation? Documentation of course! (Even fully paid programmers will often leave out the ...


31

First things first: ideas are worthless. Nobody is going to steal your idea, because everybody comes up with them all the time. Get that into your head. Here's a flow chart: Come up with an idea for a game. Discuss it with everyone you know, especially its flaws. Summarize your idea in a single sentence without comparing it to other games. Bad: "Like ...


30

I think you've answered this question yourself already. You said "I'm just a beginner in 3D games". Further you said "... Unity3D and using it's built in features and tools, which I would have to code myself if I were to use OpenGL". Essentially this means if you're using OpenGL alone, you're going to be writing a game engine, then, potentially years later,...


30

PlayerPrefs will work cross-platform, but it's not recommended for gameplay progress save files because it's insecure. As a plaintext file, a player can easily open it up and change the contents to cheat, or make your game behave unpredictably. It's also not guaranteed to stay around. PlayerPrefs is intended for non-essential preference information, like ...


29

Android is an open platform, so you are free to exchange APKs by other means—for instance by email. The Android Development Center discusses this. The caveat: App installation from non-marketplace sources is disabled by default in the security settings of most Android distributions. Users must manually enable the option first.


28

Because beginners, by definition, don't know what they're doing. OpenGL has a huge learning curve. Sure, you can issue a few glBegin commands, get all excited about putting some triangles on the screen, then go off the deep end with something more complex that you're nowhere near ready to take on yet. That's not a great way to learn. An analogy (slightly ...


27

Sounds like the scaling algorithm you're using isn't interpolating pixels. Pictures are best explained with pictures: It's the Major, first in full, then scaled down with Lanczos (left) and nearest-pixel (a.k.a. no interpolation) (right) to two sizes. The same comparison, in 3x magnified: Make sure the scaling you're using is resampling sensibly. For ...


26

I'm the developer of an extremely portable mobile game that runs on everything from PCs, to TVs, to even the Black & White Amazon Kindle (Smiles HD - http://smileshd.com - More devices and platforms than you see there). The best way I've found to support any device is to pick a base resolution, then scale up (or down) to the current screen. If you want ...


24

It's not clear by your question if you really want to know techniques that allow games to save disk space even when having large amounts of heavy image/resource files (that's what is in the body of the question), or if you just wanna know if there are less disk-space hungry ways of doing animation for your buildings (that's what is implied by the title of ...


22

It really depends on what you want to get out of this project. If your main goal is to focus on game design, then you're probably better off with a pre-built engine, because that will get you to the game-making part a lot quicker. If your goal is to learn about the programming portion of making games (especially if you're trying to prepare for a job in the ...


22

This answer relies heavily on Android's official documentation (the quoted parts, specifically). How to setup Multidex Support for Unity Project What is Multidex: Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable ...


21

Popups suck, people dislike them. That you've even thought to ask the question should pretty much give you a sense of that. For the following, I'm assuming that you're making a game which is relatively short, which players play over and over again (Minesweeper, Solitaire, etc). Minor adaptations would be necessary to these comments for long-form games. ...


20

As Byte56 said, in libGDX you cannot play videos :( so i did this: I created a new activity "SplashScreen" public class SplashScreen extends Activity implements OnCompletionListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); String ...


20

Demo GameDev Meta: Henshin Main!! :D The code uses a canvas clip region and requestAnimationFrame for maximum quality and efficiency. (It's better live.) I assumed you meant HTML canvas! Even if you didn't, other rendering engines (such as Android's 2D rendering pipeline, which you might have meant) also support hardware-accelerated clip regions. The ...


20

I would suggest writing your save state in a double-buffered way, as was common for console titles in the past (where you had to cope with the memory card being removed mid-write and writes were slow). Save: If no files exist, write state to file A If A exists, write to B If A and B both exist, find which one is older, delete it, and then write to that one ...


20

How can I target API 26+ while utilizing Android's adaptive icons? In your Player Settings under Android on Unity 2018 or higher, there is a spot in the Icon's section to set your icons. You can set Legacy, Round, and Adaptive icons. The Legacy and Round icons are for API 25 and lower. Just add the icon you want, alpha and all, and you're done. The ...


18

It defaults to locked on "landscape" mode in a libGDX project. You need to go into your "AndroidManifest.xml" and change android:screenOrientation="landscape" too android:screenOrientation="sensorLandscape" There are more options - http://developer.android.com/guide/topics/manifest/activity-element.html#screen Just replace "sensorLandScape" with the one you ...


17

Pools are used when the number of objects will fluctuate dramatically and are used to reduce the amount of memory allocation and garbage collecting. Using a pool the standard new Object() which allocates new memory is replaced with pulling an already allocated object from the pool. This is much faster even if you go though and reset every variable in the ...


16

Open Source C++ 3D Engine available for Android: Ogre3D: the best open source 3d engine but it is a large framework Irrlicht: good performance, light framework. I use it libgdx: Java API with NDK code


16

You are looking for the wondrous atan2. // v1 moving object float boxX = this.mScene.getLastChild().getX(); float boxY = this.mScene.getLastChild().getY(); // v2 user touch float touchX = pSceneTouchEvent.getX(); float touchY = pSceneTouchEvent.getY(); double theta = 180.0 / Math.PI * Math.atan2(boxX - touchX, touchY - boxY); Normally it is used as ...


15

It sounds like your goal here is just to make games. Use LibGDX. With this Library you can test it and deploy it to Windows/Linux/Android/HTML5. It's also free.


14

I agree with @Byte56 that you may be better off with something a bit simpler than Android game development, however for completeness (if other people would like to know where to look): http://steigert.blogspot.com.au/2012/02/1-libgdx-tutorial-introduction.html Steps through several different aspects of development with libgdx, from setting up your project, ...


14

The best short answer I can give you is: T = guesstimate how long it is going to take. M = Check what is the average monthly pay for a programmer in your country. P = Amount of people on your team. Your offer to them should be: T * P * M * 3 This advice of course is not offered as professional counseling and not intended to replace it. They will likely ...


14

You'll be okay to ship your game to majority of your users with a configuration like that. Even the fairly old (nearly 3 years now) old Samsung Galaxy Captivate will run with a texture resolution of that size. You won't have too many issues supporting almost any device like that (I can't think of any off the top of my head. Okay, that's a lie... maybe the ...


14

A two step check process On the first step, you check the bounding box, and if there is no collision there, then the test is over. If there is collision, you move over to the second pass On the second pass, if you want more precision, and you want a true pixel perfect solution, then you can do just that, a pixel perfect check pass Since your image is a ...


14

You should definelty use multiple smaller images. However, smaller images doesn't necessarily means something like this: (source: refrag.com) You can just have few map parts that fit together nicely. When the player arrives in a new zone you check the collision for this new part. For example you have tiles like this (they can/should be larger): 1 ...


Only top voted, non community-wiki answers of a minimum length are eligible