• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By DecoDy Studio
      Hello all
      I am currently, and after long time thinking and planning, looking for enthusiast people to be part of a team to develop games, my idea is to build a game studio although I am in a very early stage. As a lot of work is needed to be done I need people to participate and be part of this long term project, I can't do everything and I don't have the knowledge to complete all the work needed for games.
      My first idea is to develop Mobile Games and in particular VR / AR games, I've built a prototype in ARKit with Unity and I have also a couple of games ideas which could be the first games to be released. To do that, I am looking in the short term for developers and creative people (designers, concept artists, etc.) and in the long term musicians, marketing, business development, etc. It is not required a previous experience as I am planning to release first small games while the team is learning and getting the experience to do make bigger games every time we do a new one.
      If this sounds interesting to you and you want to know more, send me a private message and I will be more than happy to talk.
      DS
    • By Cahit Karahan

       
      Hi, I'm new in this forum. It is honorable to see such communities exist. I would like to share my new game. I did for android with unity. I know the game is a little awkward , but you have to know that this game is from the time when Unity's name is Unity3D  I have made my first game when I was 12. Now I am 22.  I have taken a lot of experience in this process and I can make better games nowadays. I have published this game nowadays but actually this game is very old but also it is very special for me :))
      I have just wanted to retouch and share this game, because it has a very important place for me.
       
      DESCRIPTION FROM GOOGLE PLAY STORE

      It's a special free 3D horror adventure action game for the halloween. Fun with scary sound effects and musics, 3D realistic graphics, you will feel the horror in the deep of your heart. Use your reflex. Totally free adventure. Totally scary horror game. 

      Tamarra, she is a beast from our world. She needs to consume souls from innocent people to stay alive. Story begins, the old Elaris tribe had lost their everything because of this beast who lived in the well. Araknas was the most powerful warrior of the tribe. One day, Araknas's mother was killed by the servant beasts of Tamarra. That's how Araknas's journey to the well begins. Tamara's well is guarded by horrible beasts. Araknas has to pass all servant beasts until he reaches Tamarra.

      Even death at the end is worth the revenge. 
      Are you brave enough to jump into Tamarra's well?

      Survive from witch attacks, clown attacks and many scary creature.

      - Realistic 3D graphics.
      - Scary sounds.
      - Scary musics.
      - Best experience with headphones.
      - A demon cage where you can imprison all the demons one by one
      - The witches do not like help, but they love blood stone. Witch store where you can develop your abilities and get new abilities.
      - Countless beasts.
      - At the end of the well there is a hidden surprise for you.

      *We do not recommend this game to people with clown phobia, spider phobia, or panic attacks.*

      **!!!**Note : This game is an early-access game, we are upgrading new features every day, new beasts, new improvements, as an example online 1vs1 fall on the list, so stay on connect and follow Halloween : Horror Well on Google Play.**!!!**

    • By Kristiyan21
      Hello guys,i am writing this topic to get to the opinion of more people.I have just released my first game for android(worked on it for about 5-6 months in my spare time) i used Unity framework and i am planning to make it a big project but i had to release 1.0 version so i am 100% sure i wouldn't quit the project at some time.What i am asking any of you guys is to give me your opinion about the game. What do you like,what you don't , is the ad too irritating?is the GUI okay?any information you might consider usefull for me would be helpful,thanks in advance!
      the game on google play:
      https://play.google.com/store/apps/details?id=com.KindieGames.PlaneDash
    • By fleissi
      Hey guys!

      I'm new here and I recently started developing my own rendering engine. It's open source, based on OpenGL/DirectX and C++.
      The full source code is hosted on github:
      https://github.com/fleissna/flyEngine

      I would appreciate if people with experience in game development / engine desgin could take a look at my source code. I'm looking for honest, constructive criticism on how to improve the engine.
      I'm currently writing my master's thesis in computer science and in the recent year I've gone through all the basics about graphics programming, learned DirectX and OpenGL, read some articles on Nvidia GPU Gems, read books and integrated some of this stuff step by step into the engine.

      I know about the basics, but I feel like there is some missing link that I didn't get yet to merge all those little pieces together.

      Features I have so far:
      - Dynamic shader generation based on material properties
      - Dynamic sorting of meshes to be renderd based on shader and material
      - Rendering large amounts of static meshes
      - Hierarchical culling (detail + view frustum)
      - Limited support for dynamic (i.e. moving) meshes
      - Normal, Parallax and Relief Mapping implementations
      - Wind animations based on vertex displacement
      - A very basic integration of the Bullet physics engine
      - Procedural Grass generation
      - Some post processing effects (Depth of Field, Light Volumes, Screen Space Reflections, God Rays)
      - Caching mechanisms for textures, shaders, materials and meshes

      Features I would like to have:
      - Global illumination methods
      - Scalable physics
      - Occlusion culling
      - A nice procedural terrain generator
      - Scripting
      - Level Editing
      - Sound system
      - Optimization techniques

      Books I have so far:
      - Real-Time Rendering Third Edition
      - 3D Game Programming with DirectX 11
      - Vulkan Cookbook (not started yet)

      I hope you guys can take a look at my source code and if you're really motivated, feel free to contribute :-)
      There are some videos on youtube that demonstrate some of the features:
      Procedural grass on the GPU
      Procedural Terrain Engine
      Quadtree detail and view frustum culling

      The long term goal is to turn this into a commercial game engine. I'm aware that this is a very ambitious goal, but I'm sure it's possible if you work hard for it.

      Bye,

      Phil
    • By tj8146
      I have attached my project in a .zip file if you wish to run it for yourself.
      I am making a simple 2d top-down game and I am trying to run my code to see if my window creation is working and to see if my timer is also working with it. Every time I run it though I get errors. And when I fix those errors, more come, then the same errors keep appearing. I end up just going round in circles.  Is there anyone who could help with this? 
       
      Errors when I build my code:
      1>Renderer.cpp 1>c:\users\documents\opengl\game\game\renderer.h(15): error C2039: 'string': is not a member of 'std' 1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\ucrt\stddef.h(18): note: see declaration of 'std' 1>c:\users\documents\opengl\game\game\renderer.h(15): error C2061: syntax error: identifier 'string' 1>c:\users\documents\opengl\game\game\renderer.cpp(28): error C2511: 'bool Game::Rendering::initialize(int,int,bool,std::string)': overloaded member function not found in 'Game::Rendering' 1>c:\users\documents\opengl\game\game\renderer.h(9): note: see declaration of 'Game::Rendering' 1>c:\users\documents\opengl\game\game\renderer.cpp(35): error C2597: illegal reference to non-static member 'Game::Rendering::window' 1>c:\users\documents\opengl\game\game\renderer.cpp(36): error C2597: illegal reference to non-static member 'Game::Rendering::window' 1>c:\users\documents\opengl\game\game\renderer.cpp(43): error C2597: illegal reference to non-static member 'Game::Rendering::window' 1>Done building project "Game.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========  
       
      Renderer.cpp
      #include <GL/glew.h> #include <GLFW/glfw3.h> #include "Renderer.h" #include "Timer.h" #include <iostream> namespace Game { GLFWwindow* window; /* Initialize the library */ Rendering::Rendering() { mClock = new Clock; } Rendering::~Rendering() { shutdown(); } bool Rendering::initialize(uint width, uint height, bool fullscreen, std::string window_title) { if (!glfwInit()) { return -1; } /* Create a windowed mode window and its OpenGL context */ window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); if (!window) { glfwTerminate(); return -1; } /* Make the window's context current */ glfwMakeContextCurrent(window); glViewport(0, 0, (GLsizei)width, (GLsizei)height); glOrtho(0, (GLsizei)width, (GLsizei)height, 0, 1, -1); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glfwSwapInterval(1); glEnable(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_TEXTURE_2D); glLoadIdentity(); return true; } bool Rendering::render() { /* Loop until the user closes the window */ if (!glfwWindowShouldClose(window)) return false; /* Render here */ mClock->reset(); glfwPollEvents(); if (mClock->step()) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glfwSwapBuffers(window); mClock->update(); } return true; } void Rendering::shutdown() { glfwDestroyWindow(window); glfwTerminate(); } GLFWwindow* Rendering::getCurrentWindow() { return window; } } Renderer.h
      #pragma once namespace Game { class Clock; class Rendering { public: Rendering(); ~Rendering(); bool initialize(uint width, uint height, bool fullscreen, std::string window_title = "Rendering window"); void shutdown(); bool render(); GLFWwindow* getCurrentWindow(); private: GLFWwindow * window; Clock* mClock; }; } Timer.cpp
      #include <GL/glew.h> #include <GLFW/glfw3.h> #include <time.h> #include "Timer.h" namespace Game { Clock::Clock() : mTicksPerSecond(50), mSkipTics(1000 / mTicksPerSecond), mMaxFrameSkip(10), mLoops(0) { mLastTick = tick(); } Clock::~Clock() { } bool Clock::step() { if (tick() > mLastTick && mLoops < mMaxFrameSkip) return true; return false; } void Clock::reset() { mLoops = 0; } void Clock::update() { mLastTick += mSkipTics; mLoops++; } clock_t Clock::tick() { return clock(); } } TImer.h
      #pragma once #include "Common.h" namespace Game { class Clock { public: Clock(); ~Clock(); void update(); bool step(); void reset(); clock_t tick(); private: uint mTicksPerSecond; ufloat mSkipTics; uint mMaxFrameSkip; uint mLoops; uint mLastTick; }; } Common.h
      #pragma once #include <cstdio> #include <cstdlib> #include <ctime> #include <cstring> #include <cmath> #include <iostream> namespace Game { typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; typedef float ufloat; }  
      Game.zip
  • Advertisement
  • Advertisement
Sign in to follow this  

C++ Android NDK logging (with SDL)

Recommended Posts

Hi everyone,

I'm having some issues adapting my C++/SDL framework to use on Android.  I'm using the NDK and installing directly onto my tablet via the command line and normally it works fine but sometimes of course it does nothing and it's a pain to debug.  So I thought about adding some simple logging functions so at least I can get some basic idea of what happens.  But it seems creating logs in Android is tricky also.  So a couple of questions.

1) Is it correct that you can only use a predefined set of Android logs (i.e. an info, debug, verbose, etc.. log)?  So it's impossible to make your own log-file just from your application and dump all output there to analyse?  Or did I miss something?

2) Since I was using SDL, I tried using their log functions but it seems to dump direct to one of the main logs (containing basically everything) so it was not much help.  SDL also has functions to generate internal files for game save data, etc..  So I hoped I could adapt this to make my own log except these files are private and cannot be read, at least not in the default mode.  Is there any way around this that anyone knows, where I can download an internal private file to my laptop to analyse?

3) Is there an easier solution I've missed?

Thanks in advance :-)

Share this post


Link to post
Share on other sites
Advertisement
53 minutes ago, sergamer1 said:

1) Is it correct that you can only use a predefined set of Android logs (i.e. an info, debug, verbose, etc.. log)?  So it's impossible to make your own log-file just from your application and dump all output there to analyse?  Or did I miss something?

Android development is a pain, no doubt.

There isn't a standard output you can log to. Logcat is the general method to get logs, but I would recommend using the tag for your app name so you can easily filter. I would also recommend just living with Logcat unless you're willing to put in the time for one of the below.

Other ways, at least until Google further locks Android down:

  • Log to a file in /data/local/tmp. This won't work in recent Android versions.
  • Write a logging app on your PC that connects to a socket opened by your app and log to the socket. You'll need to setup adb port forwarding and make sure your app has INTERNET permissions. Lots of work just to see logs.
  • Create an in-app/game console that you can log messages to. Drawback is having to see them on the device.
58 minutes ago, sergamer1 said:

2) Since I was using SDL, I tried using their log functions but it seems to dump direct to one of the main logs (containing basically everything) so it was not much help.  SDL also has functions to generate internal files for game save data, etc..  So I hoped I could adapt this to make my own log except these files are private and cannot be read, at least not in the default mode.  Is there any way around this that anyone knows, where I can download an internal private file to my laptop to analyse?

Those files will be in the app's data directory, assuming the writes worked. You can access it if you root your device, but you won't be able to see them on a standard commercial device. Aside from adding some file transfer mechanism (see 2nd option in bullet list above), the only other option I can think of is to redirect SDL output to logcat.

1 hour ago, sergamer1 said:

3) Is there an easier solution I've missed?

With all the above I'm assuming you don't want to root your device, so in that case the easy solution is Logcat. Unfortunately it's the best option for Android logging, especially as Google continues to lock-down Android even further. I recommend reading up on the options and parameters so at least you can filter the output. Otherwise you'll need to do extra work for logging files to the app data directory and transferring them back to your PC.

I don't know SDL well enough, but I'd also recommend hooking into the logging system and redirecting output to Logcat.

Share this post


Link to post
Share on other sites
6 hours ago, khawk said:

There isn't a standard output you can log to. Logcat is the general method to get logs, but I would recommend using the tag for your app name so you can easily filter. I would also recommend just living with Logcat unless you're willing to put in the time for one of the below.

Ahhh, ok.  I've been trying with Logcat and the problem I said was it just tells you everything you didn't want to know what is happening.  But if there's a way to tag and filter the messages, then I think this solution alone would be good enough for my purposes.  Thanks for the suggestion :-)

Is it simple enough to describe here what to do?  Or are you talking about really basic stuff, like adding a string/tag directly to the output and then grepping the file for the tag?  :-)

 

6 hours ago, khawk said:

With all the above I'm assuming you don't want to root your device, so in that case the easy solution is Logcat.

No, definitely not.  The tagging solution (whatever form it takes) will be simple and workable enough for me (assuming I can get it to work).

 

6 hours ago, khawk said:

I don't know SDL well enough, but I'd also recommend hooking into the logging system and redirecting output to Logcat.

I saw one or two examples on stackoverflow where using the Android log directly via NDK (so avoiding SDL completely) seemed relatively straightforward.  I'll give it a go if SDL gives me any (more) trouble with this.

Thanks :-)

Share this post


Link to post
Share on other sites
2 hours ago, sergamer1 said:

Is it simple enough to describe here what to do?  Or are you talking about really basic stuff, like adding a string/tag directly to the output and then grepping the file for the tag?  :-)

Yes, pretty simple. Here's a more complete answer for anyone else who might be wondering this.

Logcat is basically like stdout, but since a mobile app doesn't have a console/terminal it can open, logcat redirects output through the adb/USB connection.  

The second parameter to __android_log_print() is the "tag". Typically you would use your app name, but I've also used it for individuals modules or components within the app.

Then when you run adb logcat, use the "-s" parameter. For example:

#include <android/log.h>

...
  
__android_log_print(ANDROID_LOG_DEBUG, "MyAppName", "This is log output");

Then on command line:

adb logcat -s "MyAppName"

Quite a few other parameters you can play with to get what you want too.. like filtering the log level.

One thing I would recommend for anyone is to create macros around __android_log_print(). This is a common form:

#include <android/log.h>

#define  LOG_TAG    "MyApp"

#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
#define  LOGW(...)  __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
#define  LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)

Then you can use printf() style output:

int hitpoints = 100;

while (hitpoints > 0)
{
	LOGI("Hitpoints: %d", hitpoints);
  	hitpoints--;
}

LOGD("We killed it.");

The Hitpoints lines will be with the INFO filter, and the last line will be with the DEBUG filter, both of which you can filter with the logcat command line parameters.

 

Share this post


Link to post
Share on other sites
3 hours ago, khawk said:

Yes, pretty simple.

Yes, it worked first time!  Brilliant! :-).  Thank you for your help with that.

 

3 hours ago, khawk said:

One thing I would recommend for anyone is to create macros around __android_log_print().

Yes, I already had some logging macros exactly like this but wrapped around the SDL_log functions instead so it was pretty trivial to exchange them for the Android log functions.  I rather suspect the SDL_log functions are probably wrappers around this android function also in some way but wasn't clear getting them to work as I wanted.  Anyway, thanks again :-)

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  

  • Advertisement