I would like to implement a timer in Lua without using the os library.
I am working on a mod for a game I play, whose game scripts are written in Lua. I would like to implement a timer function, but for security reasons the game does not allow access to the os library and its time function. Is there still a way, or should I give up?
EDIT: The game's scripting engine is Halley, a lightweight engine written in C++. It appears to be a custom engine built by the developers of the game. https://github.com/amzeratul/halley
EDIT 2: This mod is intended for online multiplayer, so it has to work with the base game Lua scripts, and that means I can't use third party libraries or the OS library (trying to require it will throw an error). After much consideration I have come to believe that it is sadly not possible. Thanks to everyone who gave me comments.
Related
By checking the Codename One website and ParparVM Github, its guide only show how to build the Java (with Java Main function entry point) into the native executable/app (iOS), but I can't find any guide to build/compile Java into iOS share library (either in C source or binary, as long as can be reused by swift/objective-C from iOS app).
So are we able to do so? is there any guide for that?
It wasn't designed for that purpose so it probably won't work well for it. There are some inherent design decisions that would make it very difficult to get ParparVM to work with a library. Two big ones:
The GC needs to work with roots and would have a hard time collecting without full control of the app
The code generated looks "awful". Method names translate to very long function names in C with a very convoluted syntax to allow all sort of VM edge cases such as covariance
I suggest you look at J2ObjC. I haven't checked it out in ages but it was designed exactly with this use case in mind. It doesn't have a "real" GC but that might be OK with ARC. It works with your sources and produces libraries that look a bit more "natural" on iOS.
So I wanted to go about designing an add-on for a game I play, World of Warcraft and the game uses Lua scripts. The add-on involves speech recognition. I found a library that apparently adds voice recognition functionality to Lua.
Here is the link to the library: https://github.com/stuarch/speechtotxt-lua
The problem is, I have no idea how to set this up. It looks like they're using linux commands, but can I use this with Windows?
Also, do I have to put all these files in a certain place (pocketsphinx, sphinxbase) like a project folder, and then call them from Lua?
I'm sorry if this a noob question, I just can't find anything online about adding these libraries to Lua, and how to include the pocketsphinx and sphinx base. Any help would be greatly appreciated.
There is a difference between let's say running the full Lua interpreter under Windows and running a Lua interpreter as part of a software like WoW.
They usually restrict the use of Lua to what makes sense for the game. You don't have to reboot the system from within WoW, you also should not be able to manipulate files or even manipulate memory ....
Just imagine you install a WoW addon from the internet and it suddenly deletes all files on your computer. Whooops.
So they simply remove the standard Lua libraries like os, debug, io...
Of course they also don't want you to extend your power beyond those limitations by loading third party code. Hence they remove the require function.
So all you can do in WoW is run restricted Lua code and use the feature set they offer you.
Adding speach recognition to WoW is not possible through the embedded Lua interpreter.
Is there a way to prevent the default OS behavior for a command key (i.e. prevent start menu opening and focus loss when the windows key is pressed) using Love2d (LÖVE) in particular, or Lua more generally. If I understand correctly, LÖVE uses LuaJIT, so it would be helpful if a Lua based approach did not involve Lua 5.2/5.3 functions that are not implemented in LuaJIT, but I could rebuild with the appropriate module or shim the LÖVE interpreter if necessary.
Having failed to find a simple solution on my own, I'm currently thinking I will have to create a Lua-C Module. If that is the case, any advice/links along those lines would be greatly appreciated. Thanks!
Lua certainly has no functionality for hijacking OS key functionality of this kind. Such things are too OS-specific for Lua to expose. And from its documentation, Love2D has no such functionality either.
While we're on the subject:
prevent start menu opening and focus loss when the windows key is pressed
It would be exceedingly rude to have your application prevent basic OS functionality like this from working. However good your game may be, it is not as important as the user being able to do what they actually want. If the user wants to switch to something else, that's their right, and you should not interfere. If the user accidentally pressed that button, that's their responsibility.
The only thing you should do is set up a love.focus callback, so that when the application loses focus you can automatically pause.
I am not very familiar with Game engines for iOS app. Can anyone suggest an open source game engine for my game development?
My game scenario is as follows: The user selects a map, and a character inside of the game I moves through a path predefined in the map.
I was thinking about writing this game in OpenGL but it seems like I have to write a huge amount of code. Do any game engines exist in which I can successfully write this game?
Lua is easier to learn than Objective-C. There are several Lua development environments:
Gideros Studio: http://www.giderosmobile.com/
Corona SDK: http://www.coronalabs.com/
Moai: http://getmoai.com/
My favourite is Gideros Studio, because it seemed to me the easiest to get started, and is free until you want to remove the splash screen, and has a very friendly forum with access to the developers. You can also include native plugins (Objective C and C++ for Android).
Moai is the only actual open source one, if you really need to change the source, but it is probably the hardest one to learn.
cocos2d is popular and easy to use and learn. you could also use kobald2d as that includes cocos2d and other frameworks as well. you can download them through a search on google
As state by the other user cocos2d would be a good solution for what you want. Although you asked for "open source", you can always check, for free, Unity for iOS. You could also check a question I made some time ago, which can give you some hints of some options you have, here. From the Unity site:
Oh, and don't forget that Unity is free and we have fully-functional
30-day trials available for Unity Pro and Unity iOS Pro!
I know it's not perfect, but still, if you see it's worth, it can make a huge difference in your project.
Try Stencyl, it's not free, but it is a good engine that doesnt require a lot of code
I've been reading about Andrew Russell's ExEn project and I'm wondering what the flow would be like for creating a WP7 accelerometer-based game and then porting it to another platform, say iOS. Here's what I hope would happen:
Create fully functional game in XNA, avoiding dependance on device
specific items like the 'back' button.
Run the project through ExEn (I have no idea on how this would
happen), creating fully functional iOS game.
Run game on iPhone.
Sorry for that pitiful outline, but I just don't have a solid high-level view after reading about it.
Also, being software conversion, surely it wouldn't totally work. How would you iron out the wrinkles? I assume you'd have to know iOS or Android fairly well to pin it down.
Anyway, if anyone can move me one step closer I would appreciate it.
ExEn is an implementation of a subset of the XNA API that runs on different platforms (including iOS and Android). Put simply, it makes the classes and methods that you use when writing XNA code available to you on these other platforms. (Plus appropriate instructions, examples, etc.)
When using ExEn, the bulk of your code should simply "just work". However in most real-world cases you will need to write at least some platform-specific code (and probably provide some platform-specific assets). In particular to support different device resolutions, and also in cases where you use XNA features not available in ExEn.
At time of writing, ExEn does not implement the XNA/WP7 APIs for accelerometer support. At some time in the future they may be added (either by me or anyone who wants to contribute a patch). ExEn is distributed as source code, so you could even add the necessary support yourself.
The alternative would be to write platform-specific code for the parts of your game that query the accelerometer. Using ExEn does not prevent you from also using the APIs of the underlying platform.
ExEn (on iOS and Android) runs on top of Xamarin's MonoTouch and Mono for Android products. These two products provide C# bindings for the underlying platform APIs. Also, much like ExEn implements the XNA APIs, Mono implements the .NET APIs. These products also provide you with the tools you need (IDE, compiler, debugger, etc).
So the iOS API that you would use is UIAccelerometer (doc). This is exposed in C# via MonoTouch.UIKit.UIAccelerometer (doc). I'll leave looking up the Android equivalents as an exercise.
You can't expect:
porting a game to other platform and don't modify it.
porting a game with special platform inherent abilities to other platform that lacks this abilities, or vice versa