处理游戏开发中的战斗效果 [英] Handling combat effects in game development

查看:63
本文介绍了处理游戏开发中的战斗效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力制定一个高科技规格的游戏,我正在修改一个个人项目。这是一个基于回合的冒险游戏,可能最接近于 Archon 试图做。



我遇到麻烦的是概念化开发战斗系统的最佳方式,我可以在一开始就可以实现,但这将允许扩展和复杂性被添加在将来。



具体来说,我试图找出如何处理战斗特效,即演员可能应用或删除的奖金或底片,一个项目或环境。




  • 如果游戏本身检查每个武器,盔甲,演员和

  • 是否在单个对象中处理效果,还是在效果对象或两者之间?



我可能没有在这里很好地解释自己,如果我的要求太广泛而通风,我很乐意尝试扩大这个问题。但我的初衷是,像我这样聪明的人花费时间和精力来计算这样的事情,坦白说,我不想太早就把我自己的愚蠢的死气沉沉的谈话。



所讨论的语言是javascript,虽然在这一点上我不会想象它有很大的不同。

解决方案

你以前称之为特效,称为修饰符,但现在在MMO中​​被称为buff一词。处理这些是你想要的那么简单或困难,因为你可以选择你想要在每个阶段赋予多少通用性。



但从根本上说,系统的每个方面通常都会存储适用于它的修饰符的列表,您可以按需查询。通常,在任何给定的时间只有少数修改器适用于任何一个玩家,所以这不是一个问题 - 取得玩家的统计数据和任何由技能/法术/任何增加的修饰符,添加磨损设备传递的任何修饰符,然后添加有关武器赋予的任何东西。如果你在这里提出了一个标准的接口(例如,sumModifiersTo(attributeID)),这些接口被演员,项目,位置等所使用,那么实现这一点就可以很简单。



通常,效果对象将包含在它们涉及的实体中:actors具有效果列表,并且它们佩戴或使用的项目具有它们自己的效果列表。哪些效果被明确激活和/或有时间限制,这取决于你想要存储的东西 - 例如。如果你有魔法药水或其他消耗品,它们的效果将需要附加到Actor而不是(可能是销毁的)项目。



不要试图尝试并具有效果修改actor属性就地,因为您很快发现,如果您不确保按照正确的协议完成所有添加和删除,属性将很容易漂移。它也使以后更难绕过某些修饰符。例如。想像一下魔法盾,只能防止其他魔法 - 你可以传递一些谓词到你的修饰符总计功能,忽略某些类型的效果。


I'm trying to nut out a highlevel tech spec for a game I'm tinkering with as a personal project. It's a turn based adventure game that's probably closest to Archon in terms of what I'm trying to do.

What I'm having trouble with is conceptualising the best way to develop a combat system that I can implement simply at first, but that will allow expansion and complexity to be added in the future.

Specifically I'm having trouble trying to figure out how to handle combat special effects, that is, bonuses or negatives that may be applied or removed by an actor, an item or an environment.

  • Do I have the actor handle all effects that are in play for/against them should the game itself check each weapon, armour, actor and location each time it tries to make a decisive roll.
  • Are effects handled in individual objects or is there an 'effect' object or a bit of both?

I may well have not explained myself at all well here, and I'm more than happy to try and expand the question if my request is simply too broad and airy. But my intial thinking is that smarter people than me have spent the time and effort in figuring things like this out and frankly I don't want to taint the conversation with the cul-de-sac of my own stupidity too early.

The language in question is javascript, although at this point I don't imagine it makes a great difference.

解决方案

What you're calling 'special effects' used to be called 'modifiers' but nowadays go by the term popular in MMOs as 'buffs'. Handling these is as easy or as difficult as you want it to be, given that you get to choose how much versatility you want to be able to bestow at each stage.

Fundamentally though, each aspect of the system typically stores a list of the modifiers that apply to it, and you can query them on demand. Typically there are only a handful of modifiers that apply to any one player at any given time so it's not a problem - take the player's statistics and any modifiers imparted by skills/spells/whatever, add on any modifiers imparted by worn equipment, then add anything imparted by the weapon in question. If you come up with a standard interface here (eg. sumModifiersTo(attributeID)) that is used by actors, items, locations, etc., then implementing this can be quick and easy.

Typically the 'effect' objects would be contained within the entity they pertain to: actors have a list of effects, and the items they wear or use have their own list of effects. Where effects are explicitly activated and/or time-limited, it's up to you where you want to store them - eg. if you have magical potions or other consumables, their effects will need to be appended to the Actor rather than the (presumably destroyed) item.

Don't be tempted to try and have the effects modify actor attributes in-place, as you quickly find that it's easy for the attributes to 'drift' if you don't ensure all additions and removals are done following the correct protocol. It also makes it much harder to bypass certain modifiers later. eg. Imagine a magical shield that only protects against other magic - you can pass some sort of predicate to your modifier totalling function that disregards certain types of effect to do this.

这篇关于处理游戏开发中的战斗效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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