Profile

Cover photo
28 followers|22,611 views
AboutPostsPhotosVideos

Stream

 
Hi :) Many news from last month's developments:

* Fog works on OpenGLES (Android, iOS) now. This includes simple linear/exponential fog using Fog node in VRML/X3D, and FogCoordinate, and volumetric fog (see http://castle-engine.sourceforge.net/x3d_extensions.php#section_ext_fog_volumetric) .

* We have created an extensive documentation about developing for Android https://sourceforge.net/p/castle-engine/wiki/Android%20development/ and iOS https://sourceforge.net/p/castle-engine/wiki/iOS%20Development/ . They contain detailed instructions how to install everything necessary, how to compile, where are the examples... The Android docs contain also a section about "Debugging running application (on an Android device) using ndk-gdb" --- yes, it works flawlessly :) Finally, there's also a document summarizing currently missing features from OpenGLES renderer https://sourceforge.net/p/castle-engine/wiki/OpengLES,%20Android%20and%20iOS%20TODOs/ .

* Many improvements to the Android done, in particular everything is now ready for the fact that the we may loose OpenGL context at any time (as it can happen on Android). In new "Darkest Before the Dawn" http://castle-engine.sourceforge.net/darkest_before_dawn.php version you will be able to switch from/to the application at any time, even during the loading progress (so we can loose OpenGL context during preparing of OpenGL resources; they'll be prepared later on-demand in this case), and things will just work.

* Saving / restoring of the activity state is now done. We simply save/load the XML data from CastleConfig, so you just use Config.GetValue, Config.SetValue, Config.SetDeleteValue to save your state. Just like on standalone, but on Android we just load/save config automatically. See https://sourceforge.net/p/castle-engine/wiki/Android%20development/#saving-state .

* Multi-touch is implemented :)

Note: it does break compatibility. I initially implemented multi-touch keeping backwards compatibility, but then I decided to fix the issue with mouse/touch Y coordinate (99% of the engine considers "0 is bottom", mouse Y was considering "0 is top"; this inconsistency is now fixed, with mouse Y=0 meaning "bottom" everywhere). This means that compatibility break is unavoidable, otherwise we would have a real confusion which is which.

1. There is an example program in castle_game_engine/examples/android/drawing_toy/ where you can draw on the screen, with each finger index drawing with a different color. Try drawing with 2-5 fingers simultaneously :) It's pretty fun, and allows you to test the multi-touch support on Android :)

2. TCastleTouchControl now uses multi-touch. Cameras drag, and capture mechanism in TCastleUIContainer, were also updated to fully work with multi-touch.

3. API:
3.1. Press/Release:

TInputPressRelease structure (which is a parameter for OnPress/OnRelease events) has a new field FingerIndex. On devices with a single normal mouse (no touch), like on desktops, FingerIndex is always 0.

Notes:
- If hardware configurations that have both mouse and touch devices, or that have many mouse devices, will ever become popular, we can support them. Each mouse just reserves one FindexIndex value. (You can e.g. connect usb mouse to Android, so it actually already works on Android, although in that case Android hides it from us completely, mouse connected to Android usb simply simulates touch.)

- TInputPressRelease.MouseButton field is independent from TInputPressRelease.FingerIndex. For a single mouse, FingerIndex is always 0. For a touch, MouseButton is always mbLeft. We do not try to "merge" these 2 fields into one, as it would not be useful --- UIs do not generally react to pressing a second finger the same as pressing a right mouse button.

Internally (in castlewindow_library.inc) the DoMouseDown/Up and LibraryMouseDown/Up get now extra FingerIndex parameter.

3.2. Motions:

TUIControl has new method Motion, and TCastleWindow/TCastleControl have new callback OnMotion. They get a parameter TInputMotion, that contains new and old position, a FingerIndex, and Pressed describing which buttons are pressed (for mouse, this corresponds to actual buttons pressed, may be [] if none; for touch device, it is always [mbLeft]; this way you can just detect any dragging by Pressed <> []). Using a structure TInputMotion, and a generic name, will hopefully make it forward-compatible, like current OnPress and OnRelease.

The old MouseMove/OnMouseMove symbols are now removed. Since we change the API anyway (Y goes up, position is floats...), keeping compatibility for them was too much hassle.

3.3. Current state:

TCastleWindow and TCastleControl have a list of Touches, listing current state of the touches. It's length varies (can be zero if not touching). Right now, the state of touch is just it's position in 2D and FingerIndex, but we may extend it in the future. See comments at CastleUIControls.TTouch type.

You can use MousePosition to get position of touch with FingerIndex = 0, if any (will return zeros if no such touch). Consistently, the state of mbLeft in MousePressed says whether the touch with FingerIndex = 0 currently exists. The effect is that code that looks only at MousePosition/MousePressed will somewhat work with touch devices, treating them as a device with a mouse with a single (mbLeft) button (that mysteriously doesn't report move events when button is not pressed).

Oh, and the touch positions are floats, not ints, to support devices with sub-pixel precision.

Oh, and the touch position has Y going from bottom to top, just like our 2D drawing routines. No more the need to invert MouseY.
1
Add a comment...

Castle Game Engine

Shared publicly  - 
 
And here are some screens from our engine running on iOS, big thanks to +Jan Adamec :)
1
Add a comment...
 
Android and OpenGLES renderer (Android, iOS) improvements :)

1. Android supports now Application.ProcessMessages method. This means that you can use modal functions, that inside run the message loop and return only when some state finished --- for example, various modal boxes of CastleMessages like MessageOK and MessageYesNo.

2. OpenGLES renderer supports now most texture generation modes. This includes the default generation of texture coordinates when they are not specified.  And it includes "COORD", "COORD-EYE", "SPHERE".  And it includes modes for cubemaps in camera-space and world-space. Generating cubemaps at runtime was already working. So we can fully use cubemaps for mirrors on OpenGLES, just like on desktop OpenGL.

3. TextureTransform and friends (TextureTransform3D, TextureTransformMatrix3D) work now on OpenGLES too.
2
Add a comment...
 
New example fonts/font_from_image.lpr in the engine SVN, showing how to use a font prepared as an image. Nice for fancy and colorful game fonts. Test font images by http://opengameart.org/users/asalga .
1
Add a comment...

Castle Game Engine

Shared publicly  - 
 
http://castle-engine.sourceforge.net/darkest_before_dawn.php Michalis is proud to present a small game called "Darkest Before the Dawn". It was done during http://tensquaregames.com/ "game jam" last weekend --- literally 35 hours of programming (and designing in Blender), and the game was created by a one man :) The game is my first game done specifically for Android, of course using our Castle Game Engine. It was meant as a testbed to see in practice the limits of OpenGL ES renderer and to push further the Android port. It turned out really good IMHO :) But judge for yourself.

The game is available as .apk for Android. The full source code and data is of course 100% open, on a mixture of GPL and CC licenses, see the engine SVN repository.
1
1
Castle Game Engine's profile photoMichalis Kamburelis's profile photo
 
Update: the game is available now on Google Play: https://play.google.com/store/apps/details?id=net.sourceforge.castleengine.darkestbeforedawn :) The webpage http://castle-engine.sourceforge.net/darkest_before_dawn.php contains also precompiled versions for Linux and Windows.
Add a comment...
Have them in circles
28 people
 
Screenshots from "Little Things", a tiny game done by Michalis during last weekend's TSG gamejam ( https://www.facebook.com/tsgcompo ). It was the best weekend ever, as it always happens during TSG compo! :)

The game was done using our Castle Game Engine ( http://castle-engine.sourceforge.net/ ). Of course open-source (code and data are available in SVN on http://svn.code.sf.net/p/castle-engine/code/trunk/little_things/ ). The binaries (for Windows, Linux) will be uploaded soon, for now you can just compile it yourself :)
1
1
Michalis Kamburelis's profile photo
Add a comment...

Castle Game Engine

Shared publicly  - 
 
Screen effects, including Screen Space Ambient Occlusion, work on OpenGLES now too :)

- All screen effects predefined in view3dscene, including the ones using depth textures, work.
- ScreenSpaceAmbientOcclusion (built inside our SceneManager) works, although it's somewhat slow (but correct!) on my device.
- All custom screen effects, defined in VRML/X3D, work --- see demos in demo_models/screen_effects/ from http://castle-engine.sourceforge.net/demo_models.php .
- android_demo example (in castle_game_engine/examples/android/android_demo/ in SVN) contains a simple screen effect, to test that it works.

Also generating depth textures for other purposes, like in demo demo_models/rendered_texture/rendered_texture.x3dv , works on OpenGLES :)
1
Add a comment...
 
We have a new font loading and rendering method :)

We now use the FreeType library (and FreeType FPC unit) for loading fonts, which allows us to load at runtime a ttf font, and use it with any size, and with or without anti-aliasing. For rendering, we convert this font into a texture, and we render text by rendering a quad for each letter. This makes the font rendering modern (no display lists, just a single texture), and working with GLSL and OpenGLES20 (Android, iOS), and suitable both for anti-aliased and non-aliased text (resulting in alpha blending or alpha testing).

It is also possible to convert ttf font to a Pascal code, to easily embed the fonts inside Pascal program, and avoid the need for FreeType library at runtime (which also avoids the needs to worry about linking with FreeType). The program do it is texturefont2pascal (see castle_game_engine/examples/fonts/).

Important font classes are called now TTextureFont and (abstract) TCastleFont. TTextureFont is either loaded from ttf or from prepared data (when TTextureFontData was converted to a Pascal code). There is also new TSimpleTextureFont to draw a colorful text from glyphs in an image, like the ones by http://opengameart.org/users/asalga .

For a simplest example, to change the standard UIFont (used by default by various 2D controls) to a custom ttf font (file "MyFontFile.ttf" within your game data) you would do this:

  UIFont := TTextureFont.Create(ApplicationData('MyFontFile.ttf'), { size } 20, { antialiasing? } true);

Check out new example castle_game_engine/examples/fonts/font_from_texture.lpr  :)

We also have new property TGLImage.Color, to easily color the rendered images. Useful for fonts, but also useful for general image rendering.
1
Add a comment...
 
Latest news about the engine development - progress in Android and iOS support, new game, AWSD inputs by default, and more :)
1
1
Matteo Salvi's profile photo
Add a comment...
 
Our engine is now working on iOS (iPhone, iPad) too :) Rendering, interactivity, everything works :) Thanks go to +Jan Adamec for work on iOS! It uses the same OpenGL ES rendering as Android. The video is below :)

Android port is also moving forward fast. We have a ready Android version using NativeActivity (100% of code in Object Pascal, no need to maintain a Java wrapper), initializing the context using EGL. Besides OpenGL ES rendering, we also have basic interactivity (motions are translated to mouse down/move/up events). Much more should come very soon :)

We also have a plan to make a build tool for the engine, to make it possible to build cross-target games with ease (with a single source code that can be compiled into various platforms, like standalone, Android, iOS etc.). Interested people can read castle_game_engine/scripts/README.txt . I would like to make this "the most comfortable way to compile programs using our engine" --- so your comments about this are much appreciated.
1
1
Jan Adamec's profile photo
Add a comment...
People
Have them in circles
28 people
Contact Information
Contact info
Email
Story
Tagline
3D game engine for modern Object Pascal. Focused on X3D and beautiful graphic effects. Also home of view3dscene - full-featured VRML/X3D browser.
Introduction
Castle Game Engine is an open-source (LGPL) 3D game engine for modern Object Pascal (using Free Pascal Compiler / Lazarus). We have many advanced graphic effects, like compositing shaders, shadows by various algorithms, advanced bump mapping, mirrors, screen effects by shaders, custom viewports and much more. Many 3D formats are supported, so you can use any 3D modeler to create game assets --- in particular we have an excellent support for an open X3D (VRML) data format.

The engine includes high-level 3D resources management (player, levels, items, creatures with ready AI) and low-level (so you can build, load, save and animate 3D objects however you like). We also have a sweet 2D API for drawing controls and for 2D games.

The engine website also hosts view3dscene - our full-featured VRML/X3D browser and a viewer for other 3D models. And various small games/demos using our engine.