251

(16 replies, posted in Engine)

Hi, sorry I missed this post.

First, here's how you will send the video data to a texture in C++ :

MEngine * engine = MEngine::getInstance();
MSystemContext * system = engine->getSystemContext();
MRenderingContext * render = engine->getRenderingContext();
MLevel * level = engine->getLevel();

// get a texture reference that will receive the video stream
char globalFilename[256];
getGlobalFilename(globalFilename, system->getWorkingDirectory(), name); // "name" if a local path like "maps/dummy.png"
MTextureRef * texture = level->loadTexture(globalFilename, 0, 0);

// send the video clip data to the texture
TheoraVideoFrame * f = clip->getNextFrame();
if(f)
{
    unsigned int textureId = texture->getTextureId();
    if(textureId == 0)
    {
        render->createTexture(&textureId);
        texture->setTextureId(textureId);
    }

    render->bindTexture(textureId);
    render->setTextureFilterMode(M_TEX_FILTER_LINEAR, M_TEX_FILTER_LINEAR);
    render->setTextureUWrapMode(M_WRAP_CLAMP);
    render->setTextureVWrapMode(M_WRAP_CLAMP);
    render->texImage(0, clip->getWidth(), clip->getHeight(), M_UBYTE, M_RGB, f->getBuffer());
}

252

(33 replies, posted in General)

Thank you, I'll try again.

ps : your signature made me smile, I myself followed a very similar path :
Amstrad CPC BASIC, C/Allegro/DJGPP and C++
(it was just interlaced with learning drawing and 3d modeling/animation)

The first version of the engine that evolved into Maratis was using Allegro and it's software rendering smile
I looved Allegro...

253

(33 replies, posted in General)

For iOS I got this error :

CMake Error at CMakeLists.txt:42 (IF):
  if given arguments:

    "CMAKE_GENERATOR" "NOT" "Xcode"

  Unknown arguments specified

Separately, the non-ios mac Xcode generation goes further but stopped :

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FREETYPE_LIBRARY
    linked by target "MaratisEditor" in directory /Users/anaelseghezzi/Downloads/Maratis-ios/M/Maratis/Editor
    linked by target "MaratisPlayer" in directory /Users/anaelseghezzi/Downloads/Maratis-ios/M/Maratis/Player
ZLIB_LIBRARY
    linked by target "MaratisEditor" in directory /Users/anaelseghezzi/Downloads/Maratis-ios/M/Maratis/Editor
    linked by target "MaratisPlayer" in directory /Users/anaelseghezzi/Downloads/Maratis-ios/M/Maratis/Player

254

(33 replies, posted in General)

I will test your iOS build tonight.

Awesome job on the wiki Dahnielson !
So much clearer and organized ! cool

255

(13 replies, posted in Scripting)

Hi Vegas,
yes, thank you for adding the technique to the wiki.

For your game, was the pre-allocation of clone enough
or did you also use the simpler collision detection describe above ?

256

(6 replies, posted in Plugins)

what does your data looks like ?
and how do you get the data ?

257

(6 replies, posted in Plugins)

Yes pushFloatArray require a float array.
There is no string array method implemented, you have the choice between :

pushIntArray(const int * values, unsigned int valuesNumber);
pushFloatArray(const float * values, unsigned int valuesNumber);
pushString(const char * string);
pushBoolean(bool value);
pushInteger(int value);
pushFloat(float value);
void pushPointer(void* value);

258

(6 replies, posted in Plugins)

A simple way is to create a function and send the array to the script context :

In your c++ plugin :

float myArray[100];

int getMyArray(void)
{
    MEngine * engine = MEngine::getInstance();
    MScriptContext * script = engine->getScriptContext();
    script->pushFloatArray(myArray, 100);
    return 1;
}

void StartPlugin(void)
{
    MEngine * engine = MEngine::getInstance();
    MScriptContext* script = engine->getScriptContext();

    script->addFunction("getMyArray", getMyArray);
}

In lua :

myArray = getMyArray()

259

(33 replies, posted in General)

Thank you,
it's worth considering an official move to CMake in the near future,
let's see how the experimental branch is moving, I didn't find time to update Maratis editor with the new MGui.

260

(14 replies, posted in Gossip)

that's cool smile

261

(33 replies, posted in General)

Hi, thank you for the feedback !
are you very familiar with CMake ? What is your opinion about it, compared to Scons and premake ?

There is some thoughts about moving from Scons, but it's hard to see which system is better, active or fully multi platform (ideal would be a unified windows/mac/iOS/Android and linux x86 + linux ARM building system).

Technically everything can be done,
there is a lot of creation work thought, story/writing, 3d and voice recording.
Interesting approach and I like the concept of the inside voice-over.

263

(13 replies, posted in Scripting)

To add to the point of pre-allocating memory; are there ways for users to get more control over the heap? Or to be able to create our own?

It's a natural bottleneck, specially for fast game like this shooting game where hundred of objects are created in a single frame. It's not just the memory allocation, but the fact that a new object need to be added to the scene description, some object data need to be initialized (matrices, references, parenting).

Also, it's possible that the slow down in this example is more related to the physics than a pure memory allocation bottleneck, in an indirect way, like above, because the collision object need to be added to the physics scene, the scene octree probably need to be updated because of that, etc.

264

(13 replies, posted in Scripting)

The radius is just a value you have to choose.
Sphere to Sphere collision works like that :
https://community.aldebaran-robotics.com/doc/1-14/_images/motion_collision_sphere_2.png
when D is inferior than r1+r2 it means the two sphere are colliding.

Let's say the object Enemy1 has a radius of 10 units and that the object Bullet1 a radius of 2 :

Enemy1 = getObject("Enemy1")
Bullet1 = getObject("Bullet1")

Enemy1_radius = 10
Bullet1_radius = 2

function onSceneUpdate()

    Enemy1_pos = getTransformedPosition(Enemy1)
    Bullet1_pos = getTransformedPosition(Bullet1)

    distance = length(Enemy1_pos - Bullet1_pos)

    if distance < (Enemy1_radius + Bullet1_radius) then -- collision !
        -- do something
    end 

end

(the radius don't need to be the exact same size of the mesh, in shoot game it's usually smaller to reduce difficulty, choose the best value for the gameplay)

265

(13 replies, posted in Scripting)

Hi Vegas,
your video looks quite interesting, waiting to see more !

About the frame drop, there is some concept that need to be understood :

1 : dynamic object creation is not fast, for multiple reasons :
  - memory allocation : each cloning allocate new memory, fast games usually pre-allocate memory.
  - when using physics, the new object need to be also allocated to the physics world
  - when using sound, the source need to be also allocated to the sound context

2 : collision need to be optimized for your need

There is two things I suggest :

1 : pre-allocate the projectiles :
  - clone a list of each object at the beginning of the scene, think about how much of each projectile
    would be used at max at the same time (let's say 32 of each)
  - when you shot a projectile, use one of the object from the list and turn with this 32 objects

2 : if it's still slow, try to not use physics where it's not necessary :
 
for example, use a simpler collision test for the projectiles :
(if the distance between object and projectile is less than a certain distance, there is a collision)

distance = length(projectilePos - objectPos)

if distance < (projectileRadius + objectRadius) then
  --do something
end

266

(16 replies, posted in Engine)

it looks quite good, BSD is more adapted to commercial purpose,
and there is even support for H.264 on ios and mac !

OpenGL ES 1 and 2 contexts are already done, but right now they are only used by the iOS port.

You can totally help with the ARM linux, I don't have any ARM hardware to test it, do you ?
The first thing is to see if the scons building system can work on an ARM linux system.

268

(16 replies, posted in Engine)

The down side of liboggplayer is the GPL license, it's not a huge problem but it's not the best in case of commercial game,
I think theora is more permissive, but I checked it long ago.

The video player would work good as a plugin.

About ARM, it won't be a plugin but more a build setup, by default all source should compile for ARM without modification, but might require some optimization or build settings (Bullet for example compiles as-it for ARM but got some ARM specific code for speed).

And for specific platform like Raspberry, it might also need build options for example to force the use of OpenGL-ES instead of OpenGL.

Hi,

a video player would be great indeed, I made some tests with libtheora one time, but never manage to start some real work,
we also started a discussion here if you are interested :
http://forum.maratis3d.com/viewtopic.php?id=536

A study of ARM devices would be also very useful, there is probably some work that can be re-used from the iOS port, iPhone actually uses ARM if I'm not mistaken.

271

(13 replies, posted in Engine)

Hi sunnystormy, I don't know what is included in the debian installer.

if it's not included in the package you need :
- the headers from the MSDK/MCore and MSDK/MEngine
- the libraries mcore.so and mengine.so (it could also be named libmcore.so and libmengine.so)
there should be next to Maratis application

from codeblocks, you just have to specify the path where the headers and libraries are

Better to check with Sponk.

272

(5 replies, posted in General)

Hi,
from what I see in the mesh file,
your normal is not in the good texture slot,
in Blender use the third slot for normal map,
if you don't have a specular map, leave the second slot empty.

slot 1 : diffuse
slot 2 : specular
slot 3 : normal
slot 4 : emit

ps : the last supported blender is Blender 2.67
I didn't try Blender 2.69 yet, they may have broken some script compatibility.

273

(6 replies, posted in General)

ok, the use of "stopSound" seems to relieve the system ?

274

(6 replies, posted in General)

You are probably saturating the sound buffer,
because you just duplicate and duplicate sound sources, and they are never deleted (as delete is not available yet from script).

You should use the same source for a specific sound if you don't need to play it simultaneously in different positions.
Or use a fixed number of sources (2 or 3) that you turn with.

Other temporary solution is to add a custom script to delete objects from a c++ plugin and call this script from lua when the sound finished playing. We can add this script to the trunk later.

275

(3 replies, posted in General)

Yes, you can use a network library and write custom script functions or custom behaviors
or even a custom MGame class that handle the update of your game with network.