Saturday, September 7, 2013

How to Test Blender GameKit on Real IOS Device Tutorial

Finally, I figured out how to test the Blender3D GameKit on Real IOS devices, such as iphone 5 and iPad 4 in the video. This is using latest xcode 4.6 and ios 6.1 build. Took a while to work out this.

1. go to gamekit on google code site to get the source. copy the svn script and run it in a terminal. It will download the whole package onto your hard disk.
2. go to apple developer site register yourself and pay $99 to get the iOS developer licence. So you can test applications on your iOS devices.
3. go to mac application shop download Xcode. Currently using 4.6
4. open xcode and go to preference -> download install the command tools.
5. search cmake and install.
6. search xquartz and install.
7. open cmake. point source to gamekit-read-only you downloaded before. point target to a folder under it. normally named build.
8. Click configure once. And wait for the settings to come up. Turn on OGREKIT_BUILD_IPHONE,Turn on OGREKIT_BUILD_GLESRS.Turn off OGREKIT_BUILD_GLRS
9. click configure again. only one red line. and then click again. there will be no red lines.
10. click generate. This will generate a xcode project for you named ogrekit.xproject in the build folder.
11. link your iPhone, iPad to computer and start Xcode. this will bring you to a button to set your device for development. click and finish the process.
12. copy your own blender file for testing into iphoneDemo folder.
13. open ogrekit.xproject in xcode and drag the file under iphoneDemo.
14. open main.mm under iphoneDemo folder. edit the name of the blender file to the one you just copied.

const gkString gkDefaultBlend   = "planeTouchMoveIOS.blend";

 go to screen size to annotate them. It is not needed and will mess screen settings. 

// iPad
    //m_prefs.winsize.x        = 768;
    //m_prefs.winsize.y        = 1024;
    // iPhone
//960x640, 480x320
    //m_prefs.winsize.x        = 960;
    //m_prefs.winsize.y        = 640;

//m_prefs.winsize.x        = 320;
    //m_prefs.winsize.y        = 480;

Also search scale. and go to a line that defines scale, annotate it. replace it with:

//CGFloat screenScale = [[UIScreen mainScreen] scale];
    CGFloat screenScale = 1;

15. change the target to buildAll->your device name. and Command + B to build. for the first time it will take a while. but afterwards will be much faster.
16. After succeed the build. Make sure you have your device connected. Change the target to IphoneDemo->your device and click run. 
17. wait for several minutes. the files will be compiled and uploaded on to your device. The App will start running by itself.
18. for ipad just go to the summary page and change the target device to ipad.


Friday, August 23, 2013

Blender 3d Gamekit Touch Move Android Tutorial


Following last tutorial, background moving, as moving direction is wrong, we need to fix it first.
1. Rotate camera and change motion direction in game logic editor.
2. Adjust plane shape.
3. Cut seam line on the plane model. And generate uv map.
4. Export uv map as image file.
5. Open uv map in gimp2 to paint the texture.
6. Save image and load into Blender
7. Apply texture to plane. And verify in 3d view.
8. Creat txt file. Name it OnInit.lua and put some global variables/parameters. So later on if we want to change something globally, we can easily find them. This script will be called automatically when game starts.

--Global variable
    --set touch move parameters
    Sensitivity = 0.005
    --invert = -1 -> is inverted
    Invert = 1


    Threshold=3.5

9. Create txt file called planeTouchMove.lua and put following code......
mouse=OgreKit.Mouse()
scene = OgreKit.getActiveScene()
play = scene:getObject("plane")
mouse:capture()

--display mouse movement for debug
--dPrintf("---xrel: " .. mouse.xrel)
--dPrintf("---yrel: " .. mouse.yrel)
--dPrintf("---xrel + yrel: " .. mouse.xrel+mouse.yrel)

--using threshold to filter out unwanted small touch movement
if ((mouse.xrel>Threshold or mouse.xrel<-Threshold)or(mouse.yrel>Threshold or mouse.yrel<-Threshold)) then
      play:translate(-(mouse.yrel) * Sensitivity * Invert,-(mouse.xrel) * Sensitivity * Invert,0)
      dPrintf("---xrel: " .. mouse.xrel)
      dPrintf("---yrel: " .. mouse.yrel)
else
     dPrintf("no movement")
     


end


What does this do is measuring mouse movement. And pass it to the plane. It uses sensitivity and invert variables defined in the onInit.lua file to adjust the movement. And use threshold to filter out unwanted tiny figure movement.

10. Go to plane game logic and create sensor mouse + movement and click the positive pulse "..." button, it is the first to the left.

11. In game logic link sensor with lua script.
12. Pack content and save file.
13. Test on desktop.
14. Copy the blender file into android project asset folder.
15. Open eclipse and android Gamekit file.
16. Refresh asset folder and goto main.java to change file name to the one just copied.
17. Connect android device to desktop
18. In eclipse save and run.

blender file is available at:https://docs.google.com/file/d/0B2dWucciRgDPUmFOc19ibFNYNmc/edit?usp=sharing

Tuesday, August 20, 2013

How to Test Blender 3D Gamekit on Android Device


You need to install adb on your computer and eclipse First.
The Android SDK contains the Android debug bridge (adb) which is a tool which allows you to connect to a virtual or real Android device for the purpose of managing the device or debugging your application. Check links below
http://developer.android.com/sdk/index.html
http://developer.android.com/sdk/installing/installing-adt.html


1. set your android device to debug mode, in the video is a google nexus 7
2.connect usb to your desktop
3.open eclipse and open the blender 3d gamekit android package, this package can be download at:
4.pack and save your blender file, test on desktop.
5.copy your blender file into the asset folder under the eclipse project
6.refresh asset to confirm you've got it.
7.go to main.java change file name to your blender file name
8.click run, the apk will be send to your device and should be running in several minutes.
The android package can be downloaded from:

Sunday, July 21, 2013

How to do Background Rolling On Mobile Device Using Blender & Gamekit

This demo showing how to create a rolling background as seen on arcade platform 2D/2.5D games using blender3D and gamekit. at the end test on a real android device Nexus 7.
Following are the Steps:
1. Create a 'mesh plane' rectangular as background
2. Move and Rotate Camera
3. Import pre-modelled Plane
4. Add shadeless material to background
5. Unwrap UV,1024 x 1024
6. export UV image
7. stitch background image on UV map in photoshop or gimp2
8. save the image
9. load image into texture under material
10. add game logic to camera and airplane
11. pack external data in file and save file
12. test on blender gamekit add-on using desktop
13. copy file into gamekit android package asset folder
14.open eclipse, change the file name reference in the main.java file
15. connect nexus 7 and run the test.

the blender file can be download at

Wednesday, June 19, 2013

ios 3D game Test on Simulator


  
ios game 'switch' using Blender 3D 2.6 and gamekit game engine
build iOS iPhone ipad game using free Blender 3D and GameKit,
Just a little programming knowledge required.

Game Engine iOS Build Tutorial


this video showing how to build blender 3d gamekit ( free game engine )iPhone ios application for running blender 3D game on iOS devices.
download cmake from cmake.org.in xcode project setting, change code signing to no, i missed that in the video.

The goal of gamekit is to create a basic game engine that allows fast prototyping build around open source software free for commercial use.

Using Ogre or Irrlicht for graphics, Bullet for physics, OpenAL for sound
OgreKit is most actively developed and in svn/trunk, the suspended Irrlicht version is in svn/branches/IrrKit.
Engine is written in C++ and the game logic can be done in C++, Lua scripting or logic bricks