脚本语言和游戏开发/编程 [英] Scripting languages and Game Dev/Programming

查看:141
本文介绍了脚本语言和游戏开发/编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以我一直在开发2D游戏开发/编程,许多游戏我也看过使用某种脚本语言。所以我想知道 - 在游戏中使用脚本的目的是什么?我知道没有简单的一个原因的答案,我一直在试图考虑所有的可能性。这里是我认为'我知道到目前为止:



1)脚本允许改变游戏而不必重新编译。



2)脚本对非程序员来说更容易使用。



3)脚本允许我将引擎与游戏本身分开,其他具有相同组件的游戏更快?



这是我所知道的。我的下一个问题是,如果我要开发/编程一个游戏 - 我真的需要使用脚本吗?或者我可以使用像python或ruby这样的东西来原型化游戏,允许快速测试,然后重写C ++中的代码,节省时间和编译器错误等等。



我想知道,我最好使用Ruby或Python,因为我最经验的那些?或者我应该使用Lua,Perl或其他东西,如果它更适合我的目标实现?说到这个问题,我真正应该使用脚本?我应该使用它们来定位和建模游戏菜单UI,写/读保存文件,加载地图级别,保持游戏术语的数组或结构,如新游戏或退出,上述所有, ?



如果我使用脚本,不会允许最终用户编辑游戏机制吗?或者是否有一种方法可以将脚本打包成引擎可以读取的一个压缩文件?



最基本的是,我想知道:



我应该在我的游戏中使用脚本?为什么?



如果我单独工作或与程序员而不是开发人员合作,我需要使用脚本语言吗? / p>

如果我要制作平台游戏,角色扮演游戏或有什么,你应该使用什么脚本语言?

解决方案

您的前三个原因都是100%正确,是使用脚本语言和游戏引擎的主要原因。



我个人真的只有Lua的经验。这是一个有点棘手的设置,但它是值得的。你可以用脚本语言做什么是暴露你想要用户在这种情况下自己的数据结构和/或功能,以便能够使用。一般来说,唯一可以编辑的游戏机制就是你允许他们的。



我应该在我的游戏中使用脚本?为什么?
资源加载,暴露特性/类型,即对于我们的游戏引擎(用c ++编写),我们有一个基本级别,然后有许多不同类型的级别从它继承,例如波浪水平,死亡匹配等。用户简单地在脚本中陈述他们需要什么类型的水平,然后在资产中吸引。在我的演示中,我们有;



Level =wavelevel



- 级别敌人的初始数量

EnemyNumbers =3



- 级别总数



WaveNumbers =4



- 波系数



WaveCoeff =1.1 / p>

- 地形大小



TerrainSize =256



- 地形文件



TerrainFile =resource / Models / mountainous.raw





正如你可以看到的,一些资产加载以及确定级别类型



我们还为脚本提供了很多控制,事实上,数据结构几乎完全暴露给Lua。



如果我单独工作或与程序员而不是开发人员一起工作,我需要使用脚本语言吗?



是否可以?当然,我们都喜欢真正的编码。如果你可以让你的游戏引擎抽象到足以构建完全不同的游戏只是与Lua,那么这意味着你做了一个伟大的工作,并设计非常好。



你必须考虑的另一件事,特别是如果你的游戏引擎是相当巨大的,让我们面对它,真的不会是一个小的,每次你编译,可能需要几分钟!这是链接器在这里花费时间。



如果我正在制作平台游戏,角色扮演游戏或什么有什么脚本语言



我只使用过Lua,所以这里是我可以提供的唯一建议。



希望这是对您有用的信息。


Okay, so I've been getting into 2D game developing/programming , and many games I've seen use some sort of scripting language too. So I'm wondering - What's the purpose of using scripts in games? I know there's not simple one reason answer, and I've been trying to consider all the possibilities. Here's what I 'think' I know so far:

1) Scripts allow for changing the game without having to re-compile.

2) Scripts are easier for non-programmers to use.

3) Scripts allow me to separate the engine from the game itself allowing me to make other games with the same components quicker?

That's about all I'm aware of. My next question is, if I'm going to be Dev/programming a game alone - do I really need to use scripts? Or could I prototype the game using something like python or ruby, to allow for rapid testing, then rewrite the code in C++ saving time and compiler bugs, etc?

Another thing I'm wondering, Am I better off using Ruby or Python since I'm most experienced with those? Or should I use Lua, Perl or something else if it better fits what I aim to achieve? Speaking on that matter, what really should I use scripts for? should I use them to position and model game menu UI's, write/read save-files, load map levels, hold arrays or structures of game terminology such as "New Game" or "Quit," all of the above, none of the above?

If I make use of scripts, won't that allow game mechanics to be edited by the end user? Or is there a way to package the scripts into one compressed file that the engine can read?

Most basically, I'm wondering:

What should I use scripting in my game for? And why?

Do I need use scripting languages if I'm working alone or with programmers as opposed to Devs?

What scripting language 'should' I use if I were to be making platformers, RPGs, or what-have-you?

解决方案

your top 3 reasons are all 100% correct and are the main reasons for using scripting languages along with your game engine.

Personally I've only really had experience with Lua through Luabind. It's a little tricky to setup but it was worth it. What you can do with scripting languages is expose the data structures and/or functionality that you want the 'user' in this case yourself, to be able to use. Generally speaking the only game mechanics etc that can be editted would be the ones you allowed them to.

What should I use scripting in my game for? And why? Asset loading, exposing features/types, ie, for our game engine (written in c++), we had a base level, and then many different types of level inherriting from it, such as wave level, death match, etc. The user simply states in the script what type of level they need, and then chucks in the assets here too. In my demo we had;

Level="wavelevel"

--Level Initial number of enemies

EnemyNumbers="3"

--Level Total number of waves

WaveNumbers="4"

--Wave coefficient

WaveCoeff="1.1"

--Size of terrain

TerrainSize="256"

--Terrain file

TerrainFile="resource/Models/mountainous.raw"

Don't worry too much about the numbers and all of that.

As you can see that does some asset loading as well as determining the level type

We also gave a lot of control for the AI to scripts, in fact, the data structures were almost completely exposed to Lua.

Do I need use scripting languages if I'm working alone or with programmers as opposed to Devs?

Yes no maybe? We all prefer 'real' coding of course. If you can make your game engine abstract enough to build completely different games just with Lua, then it means you've done a great job and have designed it very well.

The other thing you have to think about, especially if you're game engine is quite huge, and lets face it, there isn't really going to be a small one, each time you compile, it can take minutes! It's the linker that's taking time here.

What scripting language 'should' I use if I were to be making platformers, RPGs, or what-have-you?

I've only ever used Lua, so that's the only advice I can give here.

Hope this is helpful info for you.

这篇关于脚本语言和游戏开发/编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆