• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
noizex

Angelscript with Objective-C

3 posts in this topic

Hello,

I recently tried to code something on iOS using Xcode and Objective-C. I thought it would be nice if I could hook scripting with AS into my game, but I encounter a lot of problems, most of them come from mixing Obj-C and C++ (Angelscript). I managed to compile AS and even create script engine, but thats as far as I can go with my limited knowledge.

For example how this should be handled in Obj-C class that's some kind of ScriptManager (creating engine, handling pool and message callback):
[source lang="cpp"] r = engine->SetMessageCallback(asMETHOD(CScriptMgr, MessageCallback), this, asCALL_THISCALL); assert( r >= 0 );
[/source]
I have no idea how to pass Obj-C method to asMETHOD() macro. Can I even do this? If not, how should I "bridge" such things with AS C++ API?

Its even worse when it comes to registering Obj-C classes (NSString, GLKVector etc.) - I have no idea where to start.

Did anyone make a successful implementation of AS on iOS and has any example that would let me start with this? Because I couldn't find a clue regarding working with AS and Objective-C.

Thanks,

noizex
0

Share this post


Link to post
Share on other sites
AngelScript is successfully on iOS in several projects. Though I do not know the details of those projects I do believe they have been implemented with C++ rather than Objective-C.

Unfortunately my knowledge of Objective-C is very limited. Perhaps it would be easier to integrate AngelScript through a [url="http://www.angelcode.com/angelscript/resources.html"]pure C interface[/url]? Note, the [url="http://www.angelcode.com/angelscript/resources.html"]C interface[/url] is a bit outdated and would have to be updated to the latest version of AngelScript to work, but it should be quite easy to do so by following the existing work.
0

Share this post


Link to post
Share on other sites
[quote name='Andreas Jonsson' timestamp='1354487549' post='5006412']
AngelScript is successfully on iOS in several projects. Though I do not know the details of those projects I do believe they have been implemented with C++ rather than Objective-C.

Unfortunately my knowledge of Objective-C is very limited. Perhaps it would be easier to integrate AngelScript through a [url="http://www.angelcode.com/angelscript/resources.html"]pure C interface[/url]? Note, the [url="http://www.angelcode.com/angelscript/resources.html"]C interface[/url] is a bit outdated and would have to be updated to the latest version of AngelScript to work, but it should be quite easy to do so by following the existing work.
[/quote]

Yeah, I suppose they're written in C++ because mixing C++ and Obj-C in a way that would be required for AS to work is beyond sanity for me. Some weird bridges just to pass a callback, so I don't even think about registering everything I need for scripting. Would either end up with tons of bridging functions and even then I'm not sure it will work okay. C could be easier actually, because it more lightweight and it seems it works better with Obj-C than C++ classes, but it will be probably a hard work filled with void* and emptiness ;)

I think I will just give up on this idea, I use Angelscript successfully for my C++ cross-platform project, so I wanted to try it in this little iOS project, but it seems that difficulty of implementing it with Obj-C outweights any benefits of scripting for such a simple game. I'll probably code game logic in a time that will take me to register some basic functionality with Obj-C++.
0

Share this post


Link to post
Share on other sites
After reading up a little on [url="http://en.wikipedia.org/wiki/Objective-C"]Objective-C and Objective-C++[/url] I understand that it is not possible to bind Objective-C class methods directly with AngelScript. Even if it is possible to somehow take the address of an Objective-C class method the way Objective-C works is completely different from C++. In Objective-C communication between classes are done through messaging and not direct calls of the class methods as is done in C++.

However, as Objective-C++ can include C++ code in the same program it should be straightforward to write global proxy functions that bridge the AngelScript to Objective-C interface. If you're using Objective-C then you will have to use the C interface for AngelScript, as Objective-C don't understand C++ code.

Regards,
Andreas
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0