For previous discussions please refer to this thread.

Deactivating the includes for libsndfile solved my issue with sound on linux. big_smile

In trunk/dev/var/scons/thirdparty/libsndfile.py at line 23:

replace:

    params['includePath'].append('libsndfile/include')

by:

    if sys.platform!='linux2' and sys.platform!='linux3':
        params['includePath'].append('libsndfile/include')

NB: indentation is made with some blankspaces, not tabs.

File libsndfile.so must be renamed libsndfile.so.1

If a linux user who has no problem with sound could try to build with this modification would let us know if this is a generic fix or a custom fix.
Linux users who have no sound are encouraged to try this fix and report feedback.

52

(56 replies, posted in Editor)

zester wrote:

Static linking is only for special cases on Linux and in many cases won't work correctly.

In fact it seems that all errors are due to the fact that with GCC, the linker searches and processes libraries and object files in the order they are specified. So if the order is incorrect, "undefined reference" errors pop up, even though everything else is set correctly.

For example, if library B depends on library A, linking them with -lA -lB will cause an error.

53

(56 replies, posted in Editor)

Hey Anaël,

Finally got it to work! big_smile

Concerning the premake4.lua script, some links are not required on linux:

    -- MEngine
    project "mengine"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MEngine/**" }
        defines { "MENGINE_STATIC" }
--        links { "mcore" }
    

    -- MGui
    project "mgui"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MGui/**" }
        defines { "MGUI_STATIC" }
--        links { "mengine", "mcore" }
    

    -- MCommon
    project "mcommon"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "Common/Contexts/GL/**" }
        files { sourcesDir .. "Common/Loaders/FreeImage/**" }
        files { sourcesDir .. "Common/Loaders/Freetype/**" }
        files { sourcesDir .. "Common/Renderers/**" }
        files { sourcesDir .. "Common/GUI/**" }
--        links { "mgui", "mengine", "mcore", "glfw", "glee", "freeimage", "freetype", "tinycthread" }

Can you please check if they are required for building on Mac.

54

(18 replies, posted in Engine)

For Windows users:
- Put premake4.exe in the main Maratis folder
- Put these 2 lines in a .bat file:

.\premake4 vs2010
pause

Replace vs2010 with:
- your version of visual studio
- if you're using Code::Blocks, replace with codeblocks

NB: if you're using MinGW or Cygwin, append 'minGW' or 'cygwin' to the IDE, for example:

.\premake4 codeblocks minGW
pause

Double-click on the .bat file

This will generate a "Maratis.sln" solution ready to compile in visual studio or a "Maratis.workspace" for Code::Blocks.

55

(18 replies, posted in Engine)

Comparison between Scons & premake builds on linux:

File size for MaratisEditor, MaratisPlayer, libMCore, libMEngine:
premake:    9.86 Mo (player=2.59)
Scons:       15 Mo (player=3.76)

This file size reduction is achieved by passing '-s' (strip symbols) to the linker, so we could do it with Scons too.

Sound doesn't work with Scons, works with premake.
To fix sound issue on linux using Scons, go there.

56

(18 replies, posted in Engine)

----- EVERYTHING WORK !!!! ----- big_smile

If someone could test it on Mac would be great...

57

(18 replies, posted in Engine)

Premake script for building regular Maratis

-----------------------------------------------------------------------------------------------------------------------------
-- Maratis premake build
-----------------------------------------------------------------------------------------------------------------------------


    --------------------------------------  SETUP the PATHS  ----------------------------------------

    rootDir = "./"
    sourcesDir = rootDir .. "trunk/dev/"
    thirdPartyDir = rootDir .. "3rdparty/"

    -- zlib & freetype includes are set aside because they are conflicting with each other -- TODO: try "-Wl,--allow-multiple-definition" instead
    zlib_includes = thirdPartyDir .. "zlib/"
    freetype_includes = { thirdPartyDir .. "freetype/", thirdPartyDir .. "freetype/include/", thirdPartyDir .. "freetype/include/freetype/", thirdPartyDir .. "freetype/depend/" }


    -------------------------------------  SETUP THE SOLUTION  -------------------------------------

solution "Maratis"

    -- Get arguments passed to the command line
    for i=1, #_ARGS do
        if _ARGS[i] == "cygwin" then cygwin = true print("*****  Build using cygwin  *****") end
        if _ARGS[i] == "minGW" then minGW = true print("*****  Build using minGW  *****") end
    end

    -- Setup configurations and platforms
    configurations { "Debug", "Release" }
    platforms { "x32", "x64" }

    if os.is("windows") then
        defines { "_WIN32", "WIN32" }
        if minGW then defines { "__MINGW32__" } end
        if cygwin then defines { "__CYGWIN__" } end
    elseif os.is("macosx") then defines { "__APPLE__", "MACOSX" }
    elseif os.is("linux") then defines { "LINUX", "linux" } end

    configuration "Debug"
        defines { "DEBUG" }

    configuration "Release"
        defines { "NDEBUG" }
        flags { "OptimizeSpeed", "EnableSSE2" }

    ------------------------------------  INCLUDES DIRECTORIES  ------------------------------------

    includedirs {
        thirdPartyDir .. "lua",
        thirdPartyDir .. "libpng", --+ zlib
        thirdPartyDir .. "libjpeg",
        thirdPartyDir .. "devil", thirdPartyDir .. "devil/src-IL/include", thirdPartyDir .. "devil/src-ILU/include", -- + png, jpeg, zlib
        thirdPartyDir .. "glee",
        thirdPartyDir .. "tinyxml",
        thirdPartyDir .. "bullet",
        thirdPartyDir .. "npk/include", -- + zlib
        thirdPartyDir .. "assimp", thirdPartyDir .. "assimp/include", thirdPartyDir .. "assimp/code/BoostWorkaround", -- + zlib
        thirdPartyDir .. "openal/include",
        sourcesDir .. "MSDK/MCore/Includes",
        sourcesDir .. "MSDK/MEngine/Includes",
        sourcesDir .. "MSDK/MGui/Includes",
        sourcesDir .. "Maratis/Common"
    }

        if not os.is("linux") then includedirs { thirdPartyDir .. "libsndfile/include" } end -- if you get no sound, comment this line 
        if os.is("macosx") then includedirs { thirdPartyDir .. "freetype/mac" }
        elseif os.is("windows") then includedirs { thirdPartyDir .. "dirent/include" } end


    ---------------------------  PREBUILT External libraries (lib, dll, a, so, dylib)  ----------------------------

    if os.is("windows") then libdirs { thirdPartyDir .. "libsndfile/win32", thirdPartyDir .. "openal/win32" }
    elseif os.is("macosx") then libdirs { thirdPartyDir .. "libsndfile/osx"  }
    elseif os.is("linux") then libdirs { thirdPartyDir .. "libsndfile/linux", thirdPartyDir .. "openal/linux" } end


    -----------------------------  BUILD EXTERNAL LIBRARIES FROM SOURCES -----------------------------------

    -- lua
    project "lua"
        kind "StaticLib"
        language "C"
        files { thirdPartyDir .. "lua/*.h", 
                thirdPartyDir .. "lua/*.c" }

    -- zlib
    project "zlib"
        kind "StaticLib"
        language "C"
        files { thirdPartyDir .. "zlib/*.h", 
                thirdPartyDir .. "zlib/*.c" }

    -- libpng
    project "png"
        kind "StaticLib"
        language "C"
        includedirs { zlib_includes }
        files { thirdPartyDir .. "libpng/*.h", 
                thirdPartyDir .. "libpng/*.c" }

    -- libjpeg
    project "jpeg"
        kind "StaticLib"
        language "C"
        files { thirdPartyDir .. "libjpeg/*.h", 
                thirdPartyDir .. "libjpeg/*.c" }

    -- devil
    project "il"
        kind "StaticLib"
        language "C"
        includedirs { zlib_includes }
        files { thirdPartyDir .. "devil/**.h", 
                thirdPartyDir .. "devil/**.c" }
        defines { "IL_STATIC_LIB", "IL_NO_UTX" }
        --links { "jpeg", "png", "zlib" } -- for SharedLib builds

    -- Glee
    project "glee"
        kind "StaticLib"
        language "C"
        files { thirdPartyDir .. "glee/**.h", 
                thirdPartyDir .. "glee/**.c" }
        if os.is("macosx") then links { "OpenGL.framework" } end

    -- freetype
    project "freetype"
        kind "StaticLib"
        language "C"
        includedirs { freetype_includes }
        files { thirdPartyDir .. "freetype/**.h", 
                thirdPartyDir .. "freetype/*.c" }
        defines { "FT2_BUILD_LIBRARY" }
        if os.is("macosx") then links { "Cocoa.framework" } end

    -- tinyxml
    project "tinyxml"
        kind "StaticLib"
        language "C++"
        files { thirdPartyDir .. "tinyxml/*.h", 
                thirdPartyDir .. "tinyxml/*.cpp" }

    -- bullet
    project "bullet"
        kind "StaticLib"
        language "C++"
        files { thirdPartyDir .. "bullet/**.h", 
                thirdPartyDir .. "bullet/**.c*" }
        if os.is("linux") then buildoptions { "-fpermissive" } end  -- CFLAGS

    -- npk
    project "npk_dev"
        kind "StaticLib"
        language "C"
        includedirs { zlib_includes }
        files { thirdPartyDir .. "npk/**.h", 
                thirdPartyDir .. "npk/**.c" }
        --links { "zlib" } -- for SharedLib builds

    -- assimp
    project "assimp"
        kind "StaticLib"
        language "C++"
        includedirs { zlib_includes }
        files {thirdPartyDir .. "assimp/**.h", 
                thirdPartyDir .. "assimp/**.c*" }
        defines { "ASSIMP_BUILD_BOOST_WORKAROUND", "ASSIMP_BUILD_NO_OWN_ZLIB" }
        --links { "zlib" } -- for SharedLib builds


    -----------------------------------  BUILD MARATIS LIBRARIES  -----------------------------------------

    -- MCore
    project "MCore"
        kind "SharedLib"
        language "C++"
        files { sourcesDir .. "MSDK/MCore/**" }
        defines { "MCORE_DLL" }
        --linkoptions { "-Wl,--as-needed", "-Wl,--allow-multiple-definition", "-Wl,-rpath,." }

    -- MEngine
    project "MEngine"
        kind "SharedLib"
        language "C++"
        files { sourcesDir .. "MSDK/MEngine/**" }
        defines { "MENGINE_DLL" }
        if os.is("windows") then links { "MCore" } end

    -- MGui
    project "MGui"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MGui/Sources/*" }
        if os.is("macosx") then files { sourcesDir .. "MSDK/MGui/Sources/COCOA/**", sourcesDir .. "MSDK/MGui/Includes/COCOA/**" }
        elseif os.is("linux") then files { sourcesDir .. "MSDK/MGui/Sources/X11/**", sourcesDir .. "MSDK/MGui/Includes/X11/**" }
        elseif os.is("windows") then files { sourcesDir .. "MSDK/MGui/Sources/WIN32/**", sourcesDir .. "MSDK/MGui/Includes/WIN32/**" } end

    project "MaratisCommon"
        kind "StaticLib"
        language "C++"
        includedirs { freetype_includes }
        files { sourcesDir .. "Maratis/Common/**" }
        defines { "M_PACKAGE_WRITABLE", "IL_STATIC_LIB" }
        --links { "npk_dev", "bullet", "tinyxml", "freetype", "glee", "il", "lua", "sndfile", "openal" } -- for SharedLib builds


    ----------------------------  BUILD MARATIS BINARIES (Editor & Player)  ---------------------------

    -- MaratisEditor
    project "MaratisEditor"
        kind "ConsoleApp"
        language "C++"
        files { sourcesDir .. "Maratis/Editor/**" }
        links { "MaratisCommon", "MGui", "MEngine", "MCore", "assimp", "npk_dev", "bullet", "tinyxml", "freetype", "glee", "il", "jpeg", "png",  "zlib", "lua" }

        if os.is("macosx") then
            links { "Cocoa.framework", "OpenGL.framework", "CoreServices.framework", "Foundation.framework", "IOKit.framework", "OpenAL.framework", "Sndfile" }

        elseif os.is("windows") then
            links { "User32", "Shell32", "Gdi32", "Comdlg32", "Winmm", "libsndfile-1" }
            if cygwin then links { "opengl32", "openal" } else links { "Opengl32", "OpenAL32" } end

        elseif os.is("linux") then
            links { "sndfile", "openal", "X11", "Xxf86vm", "GL", "dl" }
            linkoptions { "-Wl,-rpath=." }
        end


    -- MaratisPlayer
    project "MaratisPlayer"
        kind "ConsoleApp"
        language "C++"

        files { sourcesDir .. "Maratis/Player/**" }
        links {
            "MaratisCommon", "MGui", "MEngine", "MCore",
            "npk_dev", "bullet", "tinyxml", "freetype", "glee", "il", "jpeg", "png", "zlib", "lua"
        }

        if os.is("macosx") then
            links {
                "Cocoa.framework", "OpenGL.framework", "CoreServices.framework",
                "Foundation.framework", "IOKit.framework", "OpenAL.framework", "Sndfile"
            }

        elseif os.is("windows") then
            links { "User32", "Shell32", "Gdi32", "Comdlg32", "Winmm", "libsndfile-1" }
            if cygwin then links { "opengl32", "openal" } else links { "Opengl32", "OpenAL32" } end

        elseif os.is("linux") then
            links { "sndfile", "openal", "X11", "Xxf86vm", "GL", "dl" }
            linkoptions { "-Wl,-rpath=." }
        end

------------------------------------------------  THE END  ------------------------------------------------

Instructions:
In the main maratis sources folder (containing branches, trunk...):
- put the above script in a premake4.lua file
- put the libsndfile file (from the sources or from the binary distribution)
- put the font and gui folders  (from the sources or from the binary distribution)
- build

LINUX
- build using make & GCC 4.6.3 on Ubuntu Precise tongue
- build using Code::Blocks 12.11 & GCC 4.6.3 tongue

- binaries on Ubuntu Precise tongue
- binaries on Slackware 14 tongue (may require libopenal.so.1)

WINDOWS
- build using vs2010 tongue
- build using Code::Blocks minGW tongue
- build using Code::Blocks & Cygwin sad (cf issue #6 in the bug tracker)

- vs2010 binaries on Windows using Wine tongue
- codeblocks minGW binaries on Windows using Wine tongue

TODO: fix assimp for cygwin

Looks great and low poly, excellent job!

59

(56 replies, posted in Editor)

Update:

For linux, I've added a few links to the main premake file (Xrandr, Xi and rt) :

links { "X11", "Xxf86vm", "Xrandr", "Xi", "GL", "dl", "pthread", "rt" }

I've also got rid of the "undefined reference" errors.

Now, the project compiles OK. big_smile

But launching the "Test" binary, I get nothing to display in the 800x600 window named Test1.

You're right 255, always export issue.
But by checking the materials and textures in the mesh file you can quickly identify the exporting issues and fix them.

Tutorial Doctor wrote:

Now, if only I can find a software that automatically makes a texture a SEAMLESS TEXTURE

You can simply achieve this with GIMP, see "How to make a tileable texture with the GIMP" at
http://en.wikibooks.org/wiki/Blender_3D … e_Textures

Did you check the mesh file?

Zester wrote:

I was going to post a tutorial on painting bump maps, but it appears maratis only supports normal maps.

Bump maps are altering the underlying geometry at rendering, I think that's why they are not supported.
Insanebump does a good job, there's also xNormal for more advanced tasks (setting the lights, baking textures from high poly to low poly...). And maybe Blender can do it either!

Edit: confused bump maps and displacement maps, thanks Zester for correction.

64

(56 replies, posted in Editor)

Hey 255,

Thanks for contribution.
Did you finally get it to work using premake to generate your VS project ?

65

(6 replies, posted in General)

Tutorial Doctor wrote:

I have been looking at the Special Effects demo to see what is wrong with it (it crashes Maratis if I hit the space bar too close together.)

TD, the crash is due to a small bug in the activate()/deactivate() functions that Anaël has fixed in r204.
If you don't use an up to date build, I've posted a turnaround here:

http://forum.maratis3d.com/viewtopic.php?id=757

Basically you ensure that an object is active before deactivating it or that it is inactive before activating it.

Zester, it's trully awesome to have you back in the community ! big_smile

Anaël,

The segmentation fault reported by SadWolf is related to this one.
This bug is already fixed.

For those who are not using svn, this issue can be fixed by not using the deactivate function :


Replace :

    if isAnimationOver(particle) then
        deactivate(particle)
    end

By:

    if isAnimationOver(particle) then
        clearForces(particle)
        initParticle(particle)
    end

68

(11 replies, posted in General)

Using Make & GCC

Create a "makefile" containing this code:

SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:.cpp=.o) 
CFLAGS= -O2 -fPIC
LDFLAGS= -s -shared

#Set path to MSDK (MCore & MEngine from ../trunk/dev/)
INCLUDES = -I../SDK/MCore/Includes/ -I../SDK/MEngine/Includes/

all: $(OBJS)
    @g++ $(LDFLAGS) $(OBJS) -o ../Game.so

.cpp.o:
    @echo "( Compiling $^ )" # debug output
    @g++ $(CFLAGS) $(INCLUDES) -c -o $@ $^

NB: "@" lines are indented by a tabulation, not spaces

Instructions:
In your project folder (containg the .mproj file):
    - put a copy of the SDK folder (or use a symlink)
    - put the plugin sources+includes and the makefile into a new folder

Run the makefile using make.
The plugin is created in your project folder

69

(13 replies, posted in General)

Unfortunately it happens all the time, and furthermore the spam detection requires clicking (doesn't support enter key).
Copy/paste is your best friend for this...

70

(20 replies, posted in Scripting)

The duration list contains the duration of each of the 3 walk sounds. It's not a speed parameter.

As there isn't a isSoundOver function,  duration is used so that we can guess when the random sound is over and trigger the next one.

So this sound list must remain constant, or the sounds will be trucated (if duration is set below the real duration) or there will be gaps between sounds (if duration is set above the real duration of the track).

71

(17 replies, posted in External Tools)

The export panel is located at the bottom-left side of the workspace once you've clicked File > Export > Collada.
You might need to move the scrollbar down if you can't see it.

72

(20 replies, posted in Scripting)

Try this:

walkSound = {getObject("walk1"), getObject("walk2"), getObject("walk3")}
duration = {10, 9, 11}

isPlaying = false
walkSpeed = 10


function onSceneUpdate()

    if isKeyPressed("W") then

        addCentralForce(player, {0, walkSpeed, 0}, "local")

        if not isPlaying then
            timer = 0 -- reset timer
            randomSoundID = math.random(#walkSound) -- select a random sound
            playSound(walkSound[randomSoundID]) -- start playing the sound
            isPlaying = true -- update status
        else  -- check for termination of the current sound
            timer = timer + 1
            if timer == duration[randomSoundID] then isPlaying = false end -- trigger new sound when current ends
        end

    else isPlaying = false end

end

NB: adjust durations to match your sounds' lengths

73

(17 replies, posted in External Tools)

Does it appear with other exports, for example wavefront obj ?

74

(20 replies, posted in Scripting)

argoon wrote:

i don´t know what (#walkSound) does

#walkSound returns the length of the walkSound list, approximately the number of sounds in this list.
math.random(#walkSound) generates random integer numbers between 1 and #walkSound, so your code translation is correct.

Did you check the Maratis wiki ?

@TD: your randomSound is not called by the onSceneUpdate function, so it is set once and is never updated.

75

(5 replies, posted in Gossip)

Drivers and constraints (including IK) work perfectly fine.

I'm currently modifying the Blender export addon so that we can optionaly skip the "control" bones (all bones that are not part of the main basic armature) at export. And It works perfectly either.

Now I just have to make it more versatile, as it doesn't work if one bone of the main armature is parented to a skipped bone (I never use this kind of rigg, but some people do).