Animated creature in Castle Game Engine with normalmaps baked from Blender Sculpt

Posted on

You can use Blender “Bake” feature to bake normalmaps from a high-poly model to be applied on a low-poly model. You can create the high-poly model e.g. using the “Sculpt Mode” in Blender.

Such normalmaps can be immediately used as the “normalMap” texture for Castle Game Engine.

The resulting model reacts nicely to lighting. It has a detailed shading, just like the high-poly version. But the geometry comes from the low-poly version, so it’s still very fast to render. This technique is 100% dynamic: both the creature, and the light, may be animated in any way, and the shading changes correctly.

The sample model is available in https://github.com/castle-engine/demo-models/tree/master/bump_mapping/lizardman . You can open it in view3dscene, and use the “Edit -> Lights Editor” to move the light’s location, and use the “Animation -> Named Animation -> …” to run a particular animation. For now, use the view3dscene version from snapshots or GitHub sources.

To use this technique in your own models, you need to use the “normalMap” field of the Appearance.

  • You can add it by manually editing an .x3d or .castle-anim-frames file, after exporting if from Blender.
  • You can specify normalMap in the material_properties.xml file.

See the “normalMap” documentation and the material_properties.xml documentation. And see the examples in demo-models/bump_mapping/ from demo models.

Comment on this post ➤

Castle Game Engine 5.2.0 release

Posted on

Enemies and Shadows - screen from Web3d 2015 tutorial
Texture memory profiler in action
Hydra Battles, an isometric RTS game using Castle Game Engine
Dragon Squash - Android game integration with Google Games (title, sign-in)
Dragon Squash - Android game integration with Google Games (leaderboards)
Dragon Squash - Game Over screen, with some new font features

We’re proud to present new Castle Game Engine release 5.2.0!

Be sure to also check out the slides and examples (data and code) from a tutorial about our engine given during the recent Web3d 2015 conference. They show (from the ground up) the creation of a simple 3D FPS game and 2D game.

The 5.2.0 release brings various improvements to the engine capabilities and API:

  1. GPU texture memory profiler is now available. This tells you exactly which textures are worth optimizing (maybe scale them down, maybe compress for GPU, maybe remove alpha channel or convert to grayscale…). See TextureMemoryProfiler documentation.
  2. Many improvements related to texture GPU compression (especially important on mobile platforms, where texture memory is precious):
    • New compression formats available: ATITC, PVRTC, ETC (in addition to previous S3TC formats).
    • Many more functions now accept GPU-compressed images.
    • LoadImagePreprocess allows to replace image URLs at runtime, to switch uncompressed texture files with compressed.
  3. New capabilities for font rendering: scaling: TCastleFont.Scale, outline: TCastleFont.Outline, TCastleFont.OutlineColor, print in rect: TCastleFont.PrintRect, TCastleFont.PrintRectMultiline, TCastleFont.PushProperties, TCastleFont.PopProperties.
  4. TUIState to help implementing simple UI mode switching (with possible stack).
  5. New option android_project was added to our build tool to support custom Java and manifest code in your Android project. This allows to integrate your Android game with Google Games (leaderboards, achievements, save games…), biling, ads, analytics and anything else you want:)
  6. Getting and setting fields of X3D nodes has now clean API. Just use LightNode.Intensity := 0.5 instead of ugly LightNode.FdIntensity.Send(0.5).
  7. By default we use fcl-image built-in handling of PNG format. This removes the need to use/distribute extra libraries for handling PNG on any platform.
  8. On Windows GUI applications, we will log to the xxx.log file by default, instead of trying to log to unavailable stderr. See the updated tutorial link about logging for details.
  9. TCastle2DControl component for easily creating 2D games. Already contains a ready T2DSceneManager.
  10. Encrypt/decrypt XML data using BlowFish. In the simplest case, just set TCastleConfig.BlowFishKeyPhrase property. This allows to encrypt your XML data, for example to prevent cheaters from easily modifying your game configuration variables in XML. It assumes that the particular value of BlowFishKeyPhrase you use is kept secret — e.g. it’s compiled and maybe obfuscated.
  11. Numerous smaller new features: TGLImage.Draw3x1, TGLImage.Rect, TGLImage.ScalingPossible settable, TCasScriptExpression.AsFloat, TFramesPerSecond.MaxSensibleSecondsPassed, TCastleConfig.GetMultilineText (plus a few helpers for TCastleConfig to get/set RGB and RGBA colors), TRectangle.Align (plus related THorizontalPosition, TVerticalPosition), TCastleSceneCore.AnimationDuration .
Comment on this post ➤

Castle Game Engine 5.1.2 release (fixes to TCastleControl, tutorial, more)

Posted on

"Dragon Spine" running in an Android emulator

Castle Game Engine version 5.1.2 was just released! This release brings a couple of fixes and improvements to the engine.

  1. New useful events are published on TCastleControl:
    OnOpen: TNotifyEvent
    OnClose: TNotifyEvent
    OnBeforeRender: TNotifyEvent
    OnRender: TNotifyEvent
    OnResize: TNotifyEvent
    OnPress: TControlInputPressReleaseEvent
    OnRelease: TControlInputPressReleaseEvent
    OnMotion: TControlInputMotionEvent
    OnUpdate: TNotifyEvent
    

    These should be used to watch open/close of context, to watch key/mouse events and to perform continuous updates. For detailed documentation of them, see TCastleControlCustom reference.

    Some previously published stuff on TCastleControl is deprecated now and will be removed in next release (sorry, we have to break compatibility — this old stuff really doesn’t make much sense, all new code should use new events). Also, the deprecated OnPaint was fixed — just in case you’re using it (but please switch to using OnRender soon!).

  2. The beginning of the tutorial was much streamlined. We fixed some wording, removed a lot of useless info, and made the beginning of the tutorial really smooth. Now, you really quickly get to the “I made a 3D game!” stage 🙂

    Also, the tutorial chapter “Adding a simple moving object” was added.

  3. Also, as you probably see, the website got a total facelift, using HTML5 and Bootstrap style. Various pages and menus were rearranged to be more helpful. I hope you enjoy the new website — please leave a note in the comments 🙂
  4. You can save almost 0.7 MB from exe size by undefining CASTLE_EMBED_ALL_3D_FONT_VARIATIONS in some cases, see src/base/castleconf.inc for comments.
  5. Various testsuite fixes and improvements.
  6. Improve CastleCurves API, and also mark most of it as deprecated.
Comment on this post ➤

Castle Game Engine 5.1.1 release (Spine, build tool, more), view3dscene 3.15.0 release

Posted on

Spine animation with female skin
"Dragon Spine" running in an Android emulator
GUI in Spine
Various Android applications developed using Castle Game Engine
Text with shadow
"Little Things" game on Android'
"Tasty Reflections" game on Android
Named animations on example Spine model
Named animations on Venice character
New selection indicator

We proudly present, after 7 months of work, the next official release of our engine:)

As usual, we also release view3dscene 3.15.0, our 3D/2D model browser and converter.

New features of the engine and view3dscene:

  1. Extensive support for Spine 2D models and animations. Spine is a great program to design 2D skeletal (but not only) animations for games. It can be used to design animated characters, backgrounds, GUIs… Our engine and view3dscene can now effortlessly load and play Spine JSON format.
  2. New build tool of Castle Game Engine, able to easily compile and package programs developed using our engine. Especially useful for Android, where it hides a lot of complications related to creating Android apk from your code.
  3. X3D Text node gets a new implementation, very fast, portable to OpenGLES (Android/iOS), and easy to use (shares tools and classes with 2D text rendering). You can also control whether it uses alpha blending or alpha test.
  4. Text can now handle international text (in UTF-8). texturefont2pascal can read font with extra international characters.
  5. Many improvements for 2D games. Besides Spine support, there’s also a comfortable T2DSceneManager and T2DScene. See castle_game_engine/examples/2d_spine_game/ for example of use.
  6. Many improvements for Android. See new tutorial page about developing mobile games. Try our “portable games skeleton” code in castle_game_engine/examples/portable_game_skeleton.
    Also Android emulator is working now with our programs.

  7. New X3D extensions (used by our Spine loader, but may also be useful for other purposes too):
  8. High-quality image scaling, using interpolation modes like Mitchell, Blackman, Lanczos, Gaussian. See TCastleImage.MakeResized and TResizeNiceInterpolation. The implementation uses excellent fcl-image library underneath.
  9. Named animations: Our engine detects named animations by looking at X3D TimeSensor node names. Name starting with “Animation_xxx” indicates an animation, with name “xxx”. Some converters (right now, our Spine to X3D conversion) follow this convention, so our engine immediately “knows” the Spine animation names and can play them. The benefits:
    • view3dscene displays a user-friendly menu in “Animation->Named Animations->…” to run animation by name.
    • TCastleScene offers a simple API for programmers to browse and run animation by name, see TCastleScene.PlayAnimation.

Also be sure to install on your Android device a demo of Castle Game Engine + Spine. It’s completely free of course, and the source code is one of the examples in Castle Game Engine sources.

“Dragon Spine” is also available for Windows or Linux. You can also watch the video!.

Check out also some games using Castle Game Engine:

Comment on this post ➤