Tag Info

New answers tagged

1

What about GUI, sound, asset / resource management, levels / maps, quests etc.? These are all good candidates for scripts. Most of the game can typically be written in a scripting language. Typically the only thing that may require being written in the core language (C, C++, C#, Java, etc) is anything that is performance critical or core game ...


1

Whatever's most amenable to encapsulation or is already well specified - and thus well encapsulated - in C++ classes / functions, i.e. exists behind a stable, solid interface. Aspects that are ever-changing, and aspects that are coded at a low level and need fine control like rendering and low-level network code, are poor candidates for scripting. It ...


0

I think the trick here is that a lot of cards have the same kind of effects with some variations while some cards have totally unique effects. Imo, what you should do is to do this. This is written in typescript, but you can get the idea. class Effect extends { static fromArray(game, card, data) { if (data.type == "SelfDestructEffect") { ...


0

Consider adding scripting to your game. Then you can store code snippets in the scripting language in the cards themselves. That will give you a lot of flexibility. This could, for example, look like this: { "name": "Ocean Humans", "type": "Creature", "description": "When Ocean Humans dies, you lose half of your hit points" "components": { ...


4

I'd move all those UI constants to a centralized file. It doesn't matter if they are only used in one class or not. The reason is that if you ever want to adjust that type of stuff, it is nice to have it all in one location. You don't want to have to muck with a dozen different classes just because you decided you wanted to change the overall look and feel ...


1

You made a simple mistake there, you go through your array, and as soon as the cell you look at does not have the specified item in it, you insert it into that cell or go on if it already has something else in it: ...else if (c.get(i).holdingid == 0) {... instead, you could do it like this (in pseudocode): insertItem(Item item) { int pos = index of ...


3

I can give one small piece of advice. Don't do this in your render loop: viewMat = getUniformLocation(sp, "viewMat"); modelMat = getUniformLocation(sp, "modelMat"); projMat = getUniformLocation(sp, "projMat"); maxIterLoc = getUniformLocation(sp, "maxIterations"); centerLoc = getUniformLocation(sp, "center"); scaleLoc = getUniformLocation(sp, "scale"); ...


2

Since javascript is a scripting language, updating it wouldn't be a big deal, it would mean restarting the server, but it would seem most online games go through some sort of restart when introducing new things anyways. You really don't want this. Yes, some items will need reboots, because they'll need new accompanying game logic. Minor updates, ...


3

Rather than hard-coding your data in Javascript, why not use JSON. It's always a good idea to separate your data from your program, and splitting out item definitions into JSON files would be very clean I think. Node even let's you use "require" with JSON files, how handy: How to parse JSON with node Databases are a great technology to learn if you haven't ...


0

I will try to help you a litlle bit, in the way I can. Correct me If I am wrong. If I got it, then your game is about creating a dungeon, in wich, you can place block's to build it, like floor, ceiling's and such., and not only block's but you have other object's as well, like chest's and spikes. So If I where to create a game like that, first, I would ...


9

RobStone is on the right track, but I wanted to elaborate since this is exactly what I did when I wrote Dungeon Ho!, a Roguelike that had a very complex effects system for weapons and spells. Each card should have a set of effects attached to it, defined in such a way that it can indicate what the effect is, what it targets, how, and for how long. For ...


1

I’ll offer a handful of suggestions. Some of them contradict each other. But maybe some are useful. Consider lists versus flags You can iterate over the world and check a flag on each item to decide whether to do the flag-thing. Or you can keep a list of only those items that should do the flag-thing. Consider lists & enumerations You can keep adding ...


12

Have you looked into entity component systems and event messaging strategies? Status effects should be components of some sort which can apply their persistent effects in an OnCreate() method, expire their effects in OnRemoved() and subscribe to game event messages to apply effects which occur as a reaction to something happening. If the effect is ...


0

Instead of thinking of each card individually, start thinking in terms of categories of effects, and cards contain one or more of these categories. For example, to calculate the amount of time in a turn, you can loop through all cards in play and check the "manipulate turn duration" category of each card that contains that category. Each card then increments ...


1

The simplest way is to pass STL shared pointers of resources around to your objects, it's fairly painless but hard to catch errors in and it's not particularly obvious what system/object owns the particular resource. Personally I prefer the method of the resource system giving out handles, a handle (in this case) just something comprised an integer value ...


1

Like most things in software development, the answer is "it depends". Only you will be able to decide which is the right approach because you have intimate knowledge of what you need to accomplish and whether it is worth the extra effort to make it right. Properly designed, you might use both methods. Global anything in code is typically a bad idea. Though ...



Top 50 recent answers are included