• 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.

Archived

This topic is now archived and is closed to further replies.

nebukadnezzar

Enums?

10 posts in this topic

Can I youse enums and wich method does declare them to the vm? or should i use const int instead?? p.s: I''m very happy that you set up this forum
0

Share this post


Link to post
Share on other sites
In order to solicit help effectively, one needs to supply far more specific questions. Perhaps you could specify what language you are using, and what you are trying to accomplish with it.

No hard feelings of course, just trying to help

Henry
0

Share this post


Link to post
Share on other sites
I guess ''const int'' is better, or enums should function the same way const int should work. cos i would like to use it as ints for the system function that i pass the labels to.

Jayanth.K
Raptor Entertainment Pvt. Ltd.
0

Share this post


Link to post
Share on other sites
You can use the enums in your C source code, but not in the actual script as far as I know. You would need a bunch of cont ints there. So it doesn''t really matter what you use, you still have to cast them to something else if you want to modify them.

PS: Henners, we are talking about AngelScript. Visit the AngelCode website for more info: http://www.angelcode.com
0

Share this post


Link to post
Share on other sites
Agreed, I have tried enums with no success in scripts.

I think the real problem is that there is no way to register them, I don''t see why the engine itself wouldn''t support them.

How about a RegisterEnumType() method in a later release?

nihlist

0

Share this post


Link to post
Share on other sites
Anything is possible

What exactly is it that you want from an enum type in the scripting languge?

Do you want to be able to declare enums in the scripts? Do you want to pass enums to script functions? Or perhaps you wish to declare a type that can hold integer values but nothing else?

Tell me more about how you would use the enums and I''ll see what I can do to include support for them.

www.AngelCode.com - game development and more...
AngelScript - free scripting library
0

Share this post


Link to post
Share on other sites
I''d like to "register" the enum and simply work tih it

example (i declared an enum MyE {arm = 0, leg, hand} foo; )
so that i can write (in AS):
if (foo = leg) ...;

and it to pass it as param it would be useful too,
but it could be done with cast too
0

Share this post


Link to post
Share on other sites
It''s not a perfect solution but for now you could do the following:

const char scriptEnums[] =
"const int arm = 0;\n"
"const int leg = 1;\n"
"const int hand = 2;\n";

Then add this string to the engine before building your dynamically loaded scripts:

engine->AddScriptSection("scriptfile.as", loadedScript, sizeLoadedScript);
engine->AddScriptSection("enums", scriptEnums, sizeof(scriptEnums));
engine->Build();

Having a function for automatically register enum constants is not possible, I think. The only way is to have a precompiler parse the enum declaration from the C++ file and generate code that register each enumerated constant for you.



www.AngelCode.com - game development and more...
AngelScript - free scripting library
0

Share this post


Link to post
Share on other sites
Thats a certainly a workable solution to my issues with enums.

In my previous post I was thinking of a:

RegisterEnumType(const char * enumName, int elementCount, const char ** elements)

With AS friendly inputs...

You would have to store the enums in a map type structure caching their int equivalents and preprocess the script files replacing these for ints, or handle unknown types by extending the parser.cpp IsRealType() and IsDataType().

The real work would be validating name collisions etc on addition of a new enum type.

Thinking about it, it is really worth it when constant ints either added as a script section or included in a script file would do just as well?

Sorry for the long post, but has anyone toyed with the thought of supporting script include directives for file based scripts?

If this was standardized, it would perhaps simplify the creation of large scripting implementations? Any thoughts?

nihlist

[edited by - nihlist on March 11, 2004 8:15:04 AM]
0

Share this post


Link to post
Share on other sites
I think that for now I will not add a method for registering enum types, the extra script section should be good enough.

To have an #include directive with AngelScript, a pre-processor can be run on the scripts before adding them to AngelScript. The preprocessor would then scan for #include directives with extra filenames to include. It would also substitute two first characters of the lines with "//" to form a comment so that the AngelScript compiler doesn''t complain. It should be rather easy to write a pre-processor for this case.

AngelScript will not have native support for any #include directives, because AngelScript doesn''t have any resources for reading from the disk (and will not).

www.AngelCode.com - game development and more...
AngelScript - free scripting library
0

Share this post


Link to post
Share on other sites
The included constants scripts is certainly workable.

As for the preprocess includes, I could just make this part of my base ScriptManager class implementation so that scripts loaded from disk always preprocess for includes.

Thats all the C++ compiler is doing anyway. Thanks for your feedback.
0

Share this post


Link to post
Share on other sites