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


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


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


28

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.


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


25

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


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


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


19

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


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.


15

You seem to want to keep the same textsize/screensize ratio. Basically what you do is develop at one resolution and let that be scale 1.0. Then you divide the new screen width by the old width and that is your scale factor. For example. Developing on 2560x1440 with font size 16 and running on 1920x1080. Font size will be: 1920 * 16 / 2560 = 12 I do the ...


14

I can give some stat from AdMod for a long running game to give you some ideas. Last 7 days: eCPM $0.21, impressions 2.7M, fill rate 99% Last 90 days: eCPM $0.28, impressions 31.4M, fill rate 99% Last 365 days: eCPM $0.32, impressions 133M, fill rate 92% This is with AdWords enabled for when there are no graphical ads to show. You'll also notice that ...


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


14

One way you could solve this problem is not actually storing state on disk, but just setting up your generation code to use a seed for the random number generator, so it generates the same thing for a given area every time the area is generated, deterministically. Then you just keep the 1000 or so most recently visited areas in memory. When areas are ...


13

What would the W3C do? The internet has had this problem. The World Wide Web Consortium noticed. It has a recommended standard solution since 1999: Scalable Vector Graphics (SVG). It's an XML-based file format specifically designed for storing 2D shapes. "Scalable-what?" Scalable Vector Graphics! Scalable: It's meant to scale smoothly to any size. Vector:...


13

The approach you've described, using locks, would be very inefficient and most likely slower than using a single thread. The other approach of keeping copies of data in each thread would probably work well "speed-wise", but with a prohibitive memory cost and code complexity to keep the copies in sync. There are several alternative approaches to this, one ...


12

Since you can read the device density and render fonts during runtime in libgdx, I use this solution to achieve a density independent font size: float densityIndependentSize = origFontSize * Gdx.graphics.getDensity(); int fontSize = Math.round(densityIndependentSize ); BitmapFont font = generator.generateFont(fontSize );


12

The simple answer is: you'll have to learn both concepts and tools. First, you should learn the very basics of game mechanics and game design. Then you'll be able to decide, which direction would you like to go next. Keep in mind, that tools won't do any good without knowledge of the concept. To use your example: if a graphic designer doesn't realize, that ...


12

Find an engine that runs on all three platforms (i.e., is cross-/multi-platform) and meets your requirements. The latter will vary with time and only you know all the requirements you need, so finding the correct engine is left up to you.


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