Yep, seems to be fine now. I wonder what it is that keeps doing this. I think we had issues here with Notepad sticking a BOM at the beginning of files at one point...

anael wrote:

Good, thank you,
for pushPointer normally you should use lua_pushinteger instead of lua_pushnumber

Oops, I copy/pasted wrong then, sorry. Fixed now

Ok, so I reverted MWin32Window.cpp to the previous version, and compiled. It all worked fine. The new one seems to have some sort of incorrect BOM... for some reason assuming it was using wide characters when it wasn't, or something. I didn't submit the fix for this because, to be honest, I have no idea what's going on... But the script now has the pointer functions!

Um. I can't compile because apparently MWin32Window.cpp is full of chinese... but MScript compiled fine... so I'll just submit anyway?

sure, just doing it now smile

Does long change in length based on architecture? I think that pushPointer is probably a better solution as it's more obvious what it takes

void MScript::pushPointer(void* value){
        lua_pushinteger(m_state, (lua_Integer)value);
}

the size of void* definitely changes based on architecture, and it reads quite nicely. I'll make the change and submit during my lunch break (in 30 mins)

Anael wrote:

Previous code is compatible, but internally getObject now uses a pointer and not an id (to deal with the different scene)
So, after I commit, you will need to send the object pointer to your function instead of the id : lua_pushinteger(L, (lua_Integer)object);

lua_Integer isn't exposed, and when trying to compile on a mac, it seems to default to 64 bit, it refuses to compile this:

script->pushInteger((int)obj);

Cast from pointer to smaller type 'int' loses information

That looks great!

Is it possible for you to come on IRC at some point today? I can sort out access to dropbox, and can set you up with access to the project at github. (don't expect me online in the next ~hour, I'm on a train)

If you can't come online, just fire me off an email and we can set it all up over that smile

134

(35 replies, posted in News)

Nistur wrote:

Build 3.1 Bug #1 tongue Apparently I forgot to package the shader directory wink I'll fix this and submit it tomorrow

Ignore this, I was just trying to load the file before the package was loaded. Silly me

135

(35 replies, posted in News)

Build 3.1 Bug #1 tongue Apparently I forgot to package the shader directory wink I'll fix this and submit it tomorrow

136

(35 replies, posted in News)

Both Windows and Linux versions work great for me smile

137

(4 replies, posted in Scripting)

I've just done a quick test

    const char* params[10];
    for(int i = 0; i < 10; ++i)
        params\[i\] = script->getString((unsigned int)(i - 5));

Wow. lua is weird. Both positive and negative work :S Weird. I wonder why all lua docs I've read would take negative numbers

138

(4 replies, posted in Scripting)

Ok then, I have no idea how lua works internally, but I am seeing negative indices in things inside MScript.cpp.

Doesn't matter if it doesn't make the build, I guess, I can always hack it for now wink

script->getInteger((unsigned int)-1);

139

(4 replies, posted in Scripting)

I've been running through my code, trying to expose some helpful things to lua (like messages in my message system) and I was trying to sort one thing, and something felt a bit wrong, so I checked it up. MScript::getInteger (and other get functions) take unsigned int.

Checking a previous project, indices are usually negative... I just checked the actual code and you're doing arg+1, which I assume was meant to be, as a C programmer, people would be used to asking for 0 .. n-1 rather than 1 .. n. I think it's possible to hack it by casting the sign off... but I think the "nicer" way to do it might be to do something like lua_tointeger(m_state, arg - getArgsNumber());

Wondering if I am still early enough to submit this "fix" in time for the builds... or if it was done like that for a reason I can't see?

140

(5 replies, posted in External Tools)

You should be able to download the plugin here.

Yeah, I've been trying for a couple of days to get it running. Usually it loaded, but my behaviour names were garbage (which caused segfaults when trying to select/load them) even though, under Linux, it worked perfectly. I just tried another compile now and it just worked. No code changes. Nothing. Weird. My guess is that Visual Studio was playing silly and decided not to recompile some objects for some reason before, then realised just now that something had, in fact, changed...

The live screen thing is awesome! I have no idea what I can use it for... but I want to! tongue

142

(36 replies, posted in Scripting)

I did exactly the same thing for Maratis, and for another project, I took a look at how to expose classes, started trying, then decided it was far too difficult to be worth it tongue

I will try and help BitPuffin with whatever time I can afford to get some of the functionality wrapped up nicely... and will make sure MPackageManager is robust enough to load an embedded npk file. Still have to think about how to run the embedding script at compile time... but I'm sure I'll figure something out smile

Nice! So the post processing can be sorted from lua?

Looking forward to the builds smile

I'm having trouble with the Windows version of the game.dll right now, for some reason it doesn't seem to want to load properly, I'm not sure why sad

EDIT: scratch that. Windows is working now

144

(36 replies, posted in Scripting)

Awesome work BitPuffin!

I've been thinking about this sort of modular API for a while. I was wondering whether it could be integrated with the normal API, but after having a look at lua, building the objects (well, tables) in C/C++ seems incredibly painful without designing the code to work like that from the ground up.

Implementing it in lua seems like a nice way to do it though. Can easily wrap up entity/object functionality in a lua MEntity object or something. If there's ever anything that proves to be too slow, it could be moved back into the standard C/lua interface.

Distributing it with Maratis might be more... interesting. I was actually talking to lqez a few days ago and he's had a couple of requests to be able to load libnpk packages from a buffer, so I guess it would be possible to have the standard modules in an embedded npk package in Common. That shouldn't be too hard to do, and should be able to be integrated into the build system. It looks like there's even python bindings for libnpk... so even scons should work (although VS/XCode may be more interesting...) Anyway, if you want me to set up this system, I can take a look at it smile

I haven't seen much missing in the script. To be honest, I think the only way that anyone can find these is to just use the system in anger and come up with things.

BitPuffin has been looking at the scripting a good deal more than me recently, so he might be able to tell you some more.

The build would be great. Obviously no rush, as I know what it's like to be busy (I still can barely do any personal dev work apart from during my commute. Even today, I'm at work... meh!)

With regards to the documentation, I think that is really a community effort. No one person, even yourself, who wrote the system, can know all the perculiarities with everything. I'm not sure how to best promote the wiki and get people to contribute. If the community was a little larger, I'd suggest maybe something like a points system where new pages got X points and then edits that get voted as being good get Y points... When I get some time (with or without points) I will do what I can to fill in the wiki.

nice!
... I really think we should start adding documentation to the wiki. I'm going to see if I can get access from my Kindle, in which case I might have 2 weeks when I'm on "holiday" in Bulgaria with very little to do soon tongue

147

(4 replies, posted in Engine)

That's awesome! Thanks smile

Ok, we'll just leave it for now. It seems like it's more complicated than I was expecting. Never mind smile

Thanks for the information smile

The way I've seen it done in the past is to get a callback every (say) 100 bytes that are read. As you have things like the mesh loader which does a lot of stuff that isn't just reading, you get a reasonable feedback of how much is happening by how quick things are animating. I don't think there's a major issue with 3rd party libraries, because I think most of them are tied into the MFile wrapper. Having had a look, libsndfile uses MFile directly, so M_fread wouldn't necessarily make sense, maybe moving it into MFile might...

You're right, this wouldn't work for a loading bar. I can't think of a nice way at this point of making a loading bar work though. Potentially you could have a count of the objects in the scene, calculate a percentage for each of them, then say 50% of the object is mesh loading, 50% is texture loading. As it loads the objects into the scene, it sends a callback for every 1% or something.

150

(4 replies, posted in Engine)

Thanks. I will leave this for now and work on something else smile