You are not logged in. Please login or register.
Active topics Unanswered topics
Search options
Maratis forum » Posts by Aikon
I'm planning make game for Android. Yeah, Maratis is not ready for Android yet, but I'm wait and hope
Standard two-circles controll (one for direction and one for look) is stupid.
I realized controls throught single touch (only forward move support).
Example project here - https://dl.dropboxusercontent.com/u/241
lerFPS.zip
It's a dirty code. I need dostring-function to make its better.
I suggest a new type of behavior.
In common, behavior is
variables + type
update procedure
It can be realized in lua
// behavior_lookat.lua
// pseudo-code
behavior_lookat.vars = {var => type}
behavior_lookat.object_depended_vars = {}
behavior_lookat.update = <function code here>
In editor add lua-behavior by filename.
Editor parse vars-table and show var-list.
Editor values stored in object_depended_vars-table with object-name as table-index.
In main loop
get next object lua-behavior
get object name
execute <behavior_name>.update with vars from object_depended_vars.objectName-table
The lua function list is short, so lua-beheviors will be scant. But it's simple way to extend engine
What do you think about this?
Example: if we want to create FPS then add player, head and camera on scene, add behavior_controllerFPS.lua to player-object, define vars "head" and "camera". This is all you need to do.
1. debug (text) - write "text" on screen/console. If lua file contains errors then error text display on same place.
2. dostring (str) - execute lua string, e.g. dostring("On"..<getObjectUnderCursorName>.."Click()")
3. I think that GetSystemTick is not necessary function and can be replaced by os.clock() (standard lua function).
4. timer(msDelay, AfterDelay_LuaStringToDo). It's can be realized as lua-library throught "dostring".
5. if <smth>.lua is not-correct then dofile(<smth>.lua) must return error.
In MScript.cpp -> doFile change luaL_dostring(L, text); to
int result = luaL_dostring(L, text);
if (result != 0)
printf(lua_tostring(L, -1));
com3D, yeah. Thanks.
I thinked that IsVisible return reverse value of "Invisible"-attribute
But it's my mistake
P.S. He-he, I look to engine-code. Visible check use described above algorythm with BBox
I need to detect events - "object appear on screen" and "object dissapear from screen".
Can you advise the best way to do this?
Currently my plan is check object-visible in onSceneUpdate() by next algorythm:
1. Find camera look direction => vec3_A
2. Find vector from cameraPosition to objectPosition (center) => vec3_B
3. Find angles between vec3_A and vec3_B and compare with angles defined by camera fov/screen width and height.
It's a dirty algorythm with "unknow visible state" zone and can be improved by cheking all BBox-vertices (inaccessible yet) instead of center.
P.S. I don't need accurate detection.
P.P.S. Next step is visible level, e.g. 1 - object under cursor +-, 0.8 - object near cursor, 0.4 - object near screen border, 0 - object invisible.
anael, I think, unicode is not drug. The font creates as texture and font with all unicode symbols is bad.
Maybe use first way? User define own alphabet in option as string, e.g. "ABC...abc..." and when texture created then only user sympols apears there.
I cann't find lua-function to work with player data. Are they exists?
Surely this data may be stored as lua-script
// pseudo-code
function SaveData()
file = io.open("player_data.lua", "w+")
file:write("player_data_vars={}")
for key,value in pairs(player_data_vars) do
file:write("player_data_vars[<<key>>]=<<value>>")
end
file:flush()
file:close()
end
function LoadData()
dofile("player_data_vars.lua")
end
But this code create stand-alone lua-file with platform-depends place (in Windows7 used exe-same folder).
Perhaps, I wrong and place not depended.
Wait yours remarks
I planning to use Maratis for my game. My language is not english.
When I try use national simbols then TEXT (object) is not display nearly correctly (one simbol ё is wrong).
I analized source-code, make some fix and now TEXT appears correct.
// MFreetypeLoader.cpp
bool M_loadFont(const char * filename, void * data)
{
...
error = FT_Load_Char(face, n, FT_LOAD_RENDER);
// replace twice to
error = FT_Load_Char(face, (n < 192) ? n : n + 1040 - 192, FT_LOAD_RENDER);
// My national symbols (russian) begin from 1040 position in unicode. First 192 symbols are common.
...
}
So, I see two ways to support non-english languages
build font by user-defined alphabet
add new option "language" for define start position of national symbols
It's just remark for thinking, not request
I'm not professional C++ engineer (=> My C++ is very weak) and gamedev is my hobby.
So you can find more elegance way to support other language.
Posts found [ 8 ]
Maratis forum » Posts by Aikon
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.