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

Scripting! What to script/what to not script?

11 posts in this topic

So I'm finally getting this whole scripting thing to work for my assignment ( Python binding to C++ ).

 

So my question is, in a situation where you were using scripting to develop a game, what would you script and what would you code in C++? So far I know I obviously will have to have C++ handle my draw (openGL) calls, but besides that, I feel like things like sprite classes and game logic could be developed in either language fairly easily.

0

Share this post


Link to post
Share on other sites

Usually, the game engine is in C++ and all the game specific stuff is scripted (especially the AI).

-1

Share this post


Link to post
Share on other sites


So my question is, in a situation where you were using scripting to develop a game, what would you script and what would you code in C++? So far I know I obviously will have to have C++ handle my draw (openGL) calls, but besides that, I feel like things like sprite classes and game logic could be developed in either language fairly easily.

 

Some people prefer to code nearly the entire game in script, others only script unique events. Personally, I would:

 

Script:

 

- All types of controller - player, camera, AI...

- Events, dialoges, cutscenes (some visual scripting language is still a huge plus here)

- Specific behaviour of single game objects

 

Code:

 

- All graphical algorithms. I quess your game is 2D based on you mentioning sprites, but you know, you *could* even script-bind your opengl-drawcalls... I wouldn't recommend it.

- Things that are performance-critical. Yeah, you can program things like A*-paththinding and core AI in script, but I would rather do those things in code than script.

- Everythings thats a "core" aspect of your game, and is largely reusable. Notice, this is merely my opinion, but I really think it is better to write stuff like gui, input, physics etc in code, and add script binding where you need it. For me, scripting is best used, as I mentioned, to handle very specific behaviour where otherwise you would end up creating a new class for each and every game object. Everything that is largely reusable and easy to reuse (like, almost all your game entities will need some sort of physics interaction so you can easily hardcode this, as a basic example).

0

Share this post


Link to post
Share on other sites

It's a balance between flexibility and performance.  Tasks handled in code will perform better, but be more difficult to change.  Tasks handled in the scripts will be easier to change, but run slower.  So the key is to put only the stuff you're likely to change frequently in the scripts, and the stuff that's going to change infrequently in C++.  Unfortunately, you basically need a crystal ball to determine which is which prior to writing the code.  Hindsight will only be useful for your next game.

0

Share this post


Link to post
Share on other sites

Could you also say that the question is, what should I make data driven?

Then the way you provide the data might be scripts or any data you'd be able to deliver to the game, from any tools, editors etc.

(giving you flexibility)

Edited by cozzie
0

Share this post


Link to post
Share on other sites

To further add to what has been already done, the difference between scripting and regular C++ is even more fuzzy if you start to consider using runtime C++ compilation and execution, for example using CLANG.

 

Long story short: you can create scripts in C++. It has the advantage of having great performance while still having allowing for quick iterative changes (you don't need to recompile the game to test).

 

More info: http://runtimecompiledcplusplus.blogspot.co.uk/2011/06/source-code-now-live.html

2

Share this post


Link to post
Share on other sites

To further add to what has been already done, the difference between scripting and regular C++ is even more fuzzy if you start to consider using runtime C++ compilation and execution, for example using CLANG.

 

Long story short: you can create scripts in C++. It has the advantage of having great performance while still having allowing for quick iterative changes (you don't need to recompile the game to test).

 

More info: http://runtimecompiledcplusplus.blogspot.co.uk/2011/06/source-code-now-live.html

Doesn't this still require compilation though?  It doesn't require you to restart your application, but the C++ code is still compiled, right?  I could see that as being a nice feature so that you don't have to restart an app just to change some small functionality.  That's an interesting use case...

0

Share this post


Link to post
Share on other sites

Due to my code being used across a few different projects, I ended up rewriting a lot of it. I eventually insulated the stable code and ended up with some quite extensive scripting (due to historical reasons, the script is proprietary).

For a lot of games, you could get away scripting nothing. Yes, I wrote script nothing. Fact is you should first go through data-oriented design first and then add scripting to manage all those cases where data alone does not cut it. To do this effectively, keep in mind what you want to accomplish.

 

Say for example we want to make a breakout clone. Do we want to use scripting? For first iteration sure not. We build levels using pure data.

Do we need scripting in a breakout clone? Maybe to design a new powerup? Or for a new enemy?

New enemies from breakout does not seem to be so complex to require scripting to me. For powerups, it might be useful to script them since they're often very varied in effects but due to their limited number maybe we might still want to make them code.

 

The very important thing is to not think in a vacuum. Always think in your context first and in the near-to-mid term future then.

0

Share this post


Link to post
Share on other sites

In my case I usually only add in scripting support once it reaches a certain level of complexity. For tool programs, rarely do they get any scripting unless I need customized options to be stored and reloaded (I can use the registry for that until it hits a certain level), For games, definitely since I prefer to have the game logic and data separate, this makes adding a new planet, asteroid field, starship, system, GUI window, trader and etc. trivial with no recompile required. Change the script and relaunch the program. I don't use Lua, I use my own custom parser but the functionality is nearly the same. It really depends on the size of the project though....

0

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