Jump to content

  • Log In with Google      Sign In   
  • Create Account

Servant of the Lord

Member Since 24 Sep 2005
Online Last Active Today, 09:55 PM

#5221751 Advanced unit steering (e.g minion movement in moba games)

Posted by Servant of the Lord on 06 April 2015 - 07:40 PM

I'm a beginner at pathfinding, so take these thoughts with a grain of salt:

 

I am using A* on a classic grid, but taking all units into account would mean repathing all units when one unit moves. Units are usualy only immobile for a very brief time, so thats not happening.

 

How about you don't take units into account, doing the regular A* you are currently doing, and if an entity is blocked by another entity and they are within a small range of each other (i.e. "10 ft"), then, preserving your existing A*, run a smaller local A* only taking into account the nearest tiles (the tiles within 20ft) with a "goal" of getting back on the "real" path from the original A*. Take into account other units only in the smaller A*.

If the entity can't find a way around, then just let him walk through the other entity (perhaps having each entity visually step to the side to pass around each other).

To prevent both entities from trying to move around each other at the same time, have the first entity "tell" the second entity not to bother changing its path.

 

Your entity normal pathfinding is gameplay-related. But the entities moving around each other - is that just visual polish, or gameplay-critical? You could just have them walk through each other and "sidestep" (each automatically moves a half-tile to their left if another entity is also on the same tile).




#5221532 Eve online elements in a medieval setting

Posted by Servant of the Lord on 05 April 2015 - 05:22 PM

Practically speaking it's not really possible to have different parts of the map that only have a couple of narrow access points

Why not? Geographical choke points are what "choke points" actually are.
 

it's a huge open world that is procedurally generated then hand tweaked.  Hand crafting a world this size just isn't practical for an indie studio, so we had to take a compromise route.


Fine, so use your procedural generation to generate your world according to the generation rules you supply. i.e. make the generation include generating the chokepoints.

Types of chokepoints include:
Narrow land bridges between bodies of water (like Istanbul is built on)
Any other river crossing (man-made bridges, or low points in the water during dry seasons, or just slower water)
Narrow lushland paths between bodies of desert (check the current ISIS and Syrian wars - they follow the rivers)
Mountain passes ('cause nobody could ever cross the alps)

Rocky cliff-like regions where the only route is through canyons or between large rock outcroppings (this is kinda like mountain passes, except the "mountains" are smaller, and the passes are at, or below, ground level)
Cave tunnels running under mountain ranges
Natural pathways going through valleys and around hilly areas and around forests

Basically any path following something (like a river, or a cliff wall, or the edge of a forest), or any area that goes between two rougher or uncrossable areas of terrain (like being caught on a beach between a cliff and an ocean)
 

I was thinking that I can apply specific access points for trade via roads, which is kind of the angle I'm going with now.  I have npc cities and player run cities, and the general idea is you have to transport your goods from your player run city to an npc city to be able to sell to players outside your guild.  To transport your goods you have to stay on a road.  If you are on a road you can carry a lot of weight, if you go off, you become extremely  encumbered.


That sounds artificial. Why would you get more encumbered by going off-road? Perhaps I misunderstand how you are using the word 'encumbered', but often in video games 'encumbered' is shorthand for 'weighted down'. Why would your cargo weight increase when off-road?

Why not just increase your movement speed ~10% on common paths (like dirt roads), and ~25% on really good paths (like stone roads). And your game can even dynamically change to 'create' new paths through constant player use (if players start taking another route) and 'erode' old paths through disuse. Sure, it doesn't make much sense for a dirt pathway to gradually turn to a stone pathway, but since it's not happening all at once before players' eyes, but over a period of real-life weeks, it could fit the lore through willing suspension of disbelief.

Or better yet, why not make the non-paths actually take more time naturally without artificial limitations in some way or another?

Here's two ways that it function in real life:
Rivers often became "highways" because boats move alot faster and more predictably on water than humans on land. Rivers are natural chokepoints. Piracy is naturally fun. Magi-empowered piracy even more so.

 

Humans can cross almost any terrain (limited by some obstacles like mountains and such), horses can cross less, and caravans can cross even less. By making horses naturally unable to navigate in some areas (without artificially hindering them), and by making caravans even less maneuverable terrain-wise, you got your chokepoints and more player choice (do I carry a backpack of goods and go an unpredicted route? Or risk a horse-load full of goods (perhaps with a secondary packmule as well) and go a more risky route? Or do I take a full wagon of goods, but go a route that is pretty much guaranteed to be monitored? If I take a wagon, should I hire some players/mercenaries to escort me? Or will they turn on me half-way to my destination?).

 

Even boats on oceans tend to follow common paths naturally by humans taking the straightest route for economic sake, or travelling in convoys for security.
 

To make things more interesting I was going to put a couple of watch towers on the road between every player run city and the npc cities, and watch towers are also player controlled.

It's funner (if possible!) if players choose where to build watchtowers. And ofcourse, watchtowers can be destroyed and captured. And even if they aren't destroyed, they still have to be manned. And nothing (part from other players' actions) should prevents highwaymen (or local barons) from building watchtowers to setup tollhouses.

 

I would definitely try to set up rules to generate the terrain you want, to encourage the gameplay behavior you want. I don't have experience with procedural generation, so I don't know how to do it, but I've read enough to know it's possible to do it.

Secondarily, I'd try to run code on the terrain after (more specifically, during) generation to detect different situations to provide additional gameplay options to players (auto-detecting where possible 'watchtower' locations or 'wall' locations can be built, or where new towns can be founded, or where pathways should go, and by what routes rivers should flow).

 

Third, if I'm going to do hand-tweaking of the terrain post-generation, I'd want to build tools that allow you to rapidly make large-scale tweaks to allow content modification and construction to be as fast and easy (and still high quality) as possible. i.e. not placing each plant manually is a common tool feature.




#5221358 Anyone got any ideas where 4k a sec is coming from?

Posted by Servant of the Lord on 04 April 2015 - 12:02 PM

I don't see any place where you change the value of 'bLoadMedia' apart from when you initialize it.




#5221030 Organise Entities in a 2D Game

Posted by Servant of the Lord on 02 April 2015 - 05:13 PM

What Sean said. happy.png 

Since I already typed it out before reading his response:

 

Could you explain, why a 3D/2D vector is an unfavourable?

 
Sure. First, let me clarify: I had two nested, abd you had three vectors nested, but speaking of the code logic, you had a "2D" vector of map cells (and each map cell had a vector), and I had a "1D" vector of map cells, and each map cell had a vector. I'm not arguing against each cell containing a vector.
 
Also, let me clarify that the "ouch" comment was the declaration:

std::vector<std::vector<std::vector<std::unique_ptr<mapObject>*>>> mMapObjectPointers;

I find that not very legible. Even if I was using the same thing, I'd rewrite it to show code intention more.

struct MapCell
{
    std::vector<std::unique_ptr<MapObject*>> objects;
};
 
typedef std::vector<std::vector<MapCell>> MapCells;
MapCells mapCells;

Virtually the same thing (only one minor usage difference), just easier for me personally to read, especially when passing into functions by reference.
 
Alrighty, onward! So, setting aside the map cells, what's the differences between using:

std::vector<int> blah(Width*Height);

And:

std::vector<std::vector<int>> blah;

 
First, an std::vector<std::vector<>> isn't a 2D array. It's an array-of-arrays. This means that each "row" can be a different length... it doesn't enforce squareness/rectangleness! This is especially significant if you resize the arrays (for example, different maps having difference sizes) - you have to make sure you resize all of them; you have to keep them in sync.
 
Second, remember that std::vector<> allocates and manages a chunk of memory for you. Doing std::vector<std::vector<>> means you are allocating many smaller chunks of memory scattered throughout the RAM, instead of one chunk of memory (adding up to the same amount, total) in one location in the RAM. This *might* be slower, in some circumstances. In this situation, I wouldn't worry about it at all, as it probably doesn't matter in your case, but it's important to know as a "difference" between them. 
 
Third, there are benefits to 1D vectors, and benefits to 2D vectors.
Now, let's suppose you had a class that actually was a 2D vector. We'll call it std::vector2D<> instead (no standard like that exists, but it'd be very easy to make).
 
The 1D benefits are, you can iterate from one end to the other really easily:

for(int i  = 0; i < vector.size(); ++i) //Alternatively: for(Type &type : vector)
{
     vector[i] = ...;
}

 
To do the same in 2D, you do:

for(int x = 0; x < width; ++x)
{
     for(int y = 0; y < width; ++y)
     {
          vector[x][y] = ...;
     }
}

 
More code for doing the same thing.
 
The benefit 2D arrays are indexing into them with 'x' and 'y', it more closely matches the mental model of your 2D board.

myMap[x][y] = ...;

 
But you can do the same thing with 1D arrays, by treating them as if they were 2D arrays:

myMap[(y * width) + x] = ....;

 
You get the best of both, with none of the other limitations.
 
The limitations (fragmentation of memory, manually keeping the row lengths in sync, extra code merely to iterate over every element) get worse and worse for each additional dimension you add. Three dimensions, four dimensions, whatever.
 
But you can treat a 1D array like an array of any number of dimensions you want, just by indexing into it how you like:

myMap[(z * width * height) + (y * width) + x] = ....; //Three dimensions

And you can wrap up the indexing into a helper function if you like.

 

Our memory (RAM) is one dimensional. Any 2D or 3D arrays are just mapping the indices to a 1D set of memory, the same way we are. Here, we're taking finer control over it so it maps the way we want, and so we can switch between 1D and 2D when we need (which we often do!).




#5220991 Organise Entities in a 2D Game

Posted by Servant of the Lord on 02 April 2015 - 01:54 PM

These are the requirements of my container:
- insert / delete objects (seldom)
- change values of existing objects (often)
- access by coordinates

 

Access by coordinates could easily be wrapped into a function. Since it's possible that there are multiple objects at a specific coordinate, you can write a function like:

 

std::vector<Object*> objectsAtLocation = GetObjectsAtLocation(mapData, location);
 

...looking up all the objects at a specific map cell in a single iteration of the array. 2000 is a small amount.

 

Therefore i chose a std::list to store unique_ptrs on the entitie's instance


Why unique pointers within a container? The container already manages the memory for you, using unique_ptrs is redundant - unless you are using polymorphism, in which case, pointers/unique_ptrs inside a container is necessary.
 

Therefore i chose a std::list to store unique_ptrs on the entitie's instance because inserting/deleting objects in a list is easier,

But you said you insert/delete objects seldomly, so use a vector, and write a couple of helper functions for insertion/deletion.

Does the order of the elements in the container matter? If not, swap-and-pop them - it's very efficient.
 

This is the second container:
std::vector<std::vector<std::vector<std::unique_ptr<mapObject>*>>> mMapObjectPointers;
-> mMapObject[X][Y][Multiple Objects on this field]


Ouch. How about this?

struct MapCell
{
    std::vector<std::weak_ptr<Object>> objects; //Non-owning pointers.
};

std::vector<MapCell> map;
map.resize(MapWidth * MapHeight);

Use a one-dimensional array, and treat it as two-dimensional when you need to.

Like this:

size_t index = (y * MapWidth) + x;
map[index] = ...;

All Entities are derived from "mapObjects". I think there will be 400-2000 entities in total

400-2000 entities per map, sharing two or three derived classes?
 

that's why im trying to avoid using a search algorithm.

When learning, just do the simplest thing that works until it no longer works fast enough. When I don't have experience, it's easier for me to get caught up in "Oh, I need some super uber clever way of doing things, because certainly doing it the brute force way would be too slow...", but computers nowadays are ridiculously powerful, and 2000 entities is still a tiny amount.

You can probably find your elements quick enough by iterating over each element in the array but, if not, you can easily look into alternative optimizations at that point in development, and at this point in development focus on making the game logic. Programmers are notoriously bad at predicting what parts of our code will be the bottlenecks - which is why we've invented tools (profilers) to tell us.

You don't need to do your logic every frame - you do rendering (drawing) every frame, but logic only X times a second, or logic only in response to certain actions.




#5220727 c++ Instantiating a class in another class

Posted by Servant of the Lord on 01 April 2015 - 10:05 AM

It may not be necessary but it's probably good practice, just like putting return 0, at the end of main.

 

I think you are mixing up two different ideas.

 

It's good practice to clean up memory and other resources when you are done using them. This helps prevent things from being leaked.

It's good practice to set pointers to null after freeing the pointer, unless you know the pointer itself is about to be erased. This helps prevent accidental double deletion, dangling pointers, and memory leaks.

 

It's a pointless (but not harmful) practice to set your flags after they are no longer in use.

bool meow = true;
 
//...code that uses 'meow'...
 
meow = false; //Pointless. It's just a boolean, and since it is no longer used after this point, it could be set to 'aardvark' for all the code cares.
SDL_EnableUNICODE(SDL_ENABLE);
 
//...code that uses the hidden internal boolean...
 
SDL_EnableUNICODE(SDL_DISABLE); //Pointless. It's just (the equivalent of) a boolean.

There are things that need to be cleaned up or de-initialized, but I'm pretty positive this isn't one of them.

 


Tell that to the SDL devs. :/ I have no idea why they can't do whatever they are doing in SDL_Init() and SDL_Quit() instead.
 
Cross-platform convenience of the end-user. With Win32, the entry point for applications is WinMain() not main(), unless you are running a console application or explicitly set certain Visual Studio flags.

 

#define main SDL_main is a hack, yes, but a mostly harmless and user-friendly one. Sometimes the cleanest way to do something is unfortunately a hackish way; in those situations, the smaller and more self-contained the hack, the better.




#5219221 Why didn't somebody tell me?

Posted by Servant of the Lord on 25 March 2015 - 09:45 PM

I like to talk (and text message) in fake olde english from time to time, for my own amusement.

 

Apparently, nobody bothered to correct my mispronouncing of the word ' ye '. It's the exact same word, and pronunciation, of the word "the"!

 

I have always pronounced it like " yee ", but it's pronounced closer to " duh ", because it's not actually the letter 'y' but a special letter we dropped from the english alphabet, which was a single-letter for 'th' combined (like in 'there').




#5218590 String replacing

Posted by Servant of the Lord on 23 March 2015 - 02:28 PM

Adapt to your need:

namespace String
{
	std::string ReplaceAll(std::string str, char toReplace, char replaceWith)
	{
		for(char &c : str)
		{
			if(c == toReplace)
				c = replaceWith;
		}

		return str;
	}

} //End of namespace.
 
In my own code, I actually use this:
namespace String 
{
	std::string ReplaceAll(std::string str, CharValidatorFunc toReplaceFunc, char replaceWith)
	{
		for(char &c : str)
		{
			if(toReplaceFunc(c))
				c = replaceWith;
		}

		return str;
	}

} //End of namespace.

'CharValidatorFunc' is std::function<bool(char)>, allow me to take more complex functions or functors for matching. For example, I can pass this 'IsPathSeperator()' and it'll match backslashes or forward slashes, or I could pass it 'IsWhitespace()' and it'd match newlines, tabs, spaces, etc...

Ditto 'IsNumeral', 'IsAlpha', 'IsPunctuation', and etc... And then combined like 'CV_IS_NOT(CV_OR(IsNumeral, IsAlpha))' matching anything that's *not* alpha OR numerical.

 

I also have char-validator functions for taking different possibilities:

myString = RemoveAll(myString, CV_IS_ANY("{}[]().,?!"));

Some of my functions also take *string* validator functors, so I can apply wildcards them. e.g:

StringList files = GetFilesInDirectory(directory, SV_MatchesWildcard({"*.png", "*.jpg", "*.jpeg"}));

If you're looking for just a basic function, but also need case insensitivity, this might work for you:

std::string ReplaceAll_CaseInsensitive(std::string str, char toReplace, char replaceWith)
{
	for(char &c : str)
	{
		if(std::tolower(c) == std::tolower(toReplace))
			c = replaceWith;
	}

	return str;
}

The replacing substring version (case-sensitive) would look like this:

//Replaces _every_ occurance of 'toReplace' with 'replacement' in 'str'.
std::string ReplaceAll(const std::string &str, const std::string &toReplace, const std::string &replaceWith)
{
	std::string copyStr = str;
	ReplaceAll_Mutate(copyStr, toReplace, replaceWith);
	return copyStr;
}

//Replaces _every_ occurance of 'toReplace' with 'replacement' in 'str'. Operates directly on the string, instead of returning a copy.
void ReplaceAll_Mutate(std::string &str, const std::string &toReplace, const std::string &replaceWith)
{
	size_t pos = str.find(toReplace);
	while(pos != std::string::npos)
	{
		str.replace(pos, toReplace.size(), replaceWith);

		//Just to make sure we don't go into an infinite loop, if 'replaceWith' contains a match of 'toReplace'.
		pos += replaceWith.size();
		pos = str.find(toReplace, pos);
	}
}

Though if I was rewriting it, I'd probably cut out the 'Mutate' nonsense, and default to copying, since you could just do something like:

myStr = FuncThatCopies(std::move(myStr), ...);

...but I originally wrote it pre-C++11.




#5218364 what do you use to document your c++ code?

Posted by Servant of the Lord on 22 March 2015 - 06:18 PM

My function declarations have comments explaining what they do in the header files. The function names are usually pretty straight-forward also, and sometimes it's not even necessary to comment their purpose.

 

I occasionally add comments before class definitions also, but the majority of the time this isn't necessary.

 

I don't need external documentation - I can just Shift+Click on any func usage to jump to its definition, or I can Ctrl+Shift+F to locate a function in the source.

However, if I was releasing my code as a public library (that's more than just a single header), I'd run something to just pull the comment and function definitions out of the header, or else markup the existing comments with something like Doxygen, because I definitely like html documentation for code I didn't write myself.




#5218113 String replacing

Posted by Servant of the Lord on 21 March 2015 - 01:10 PM

They were actually added back in TR1. So even if you have an older compiler -- say Visual Studio 2008 -- you can access them in the std::tr1:: namespace.

 

Though three years ago, MinGW's/GCC's Regex support was non-existent, and I'm not sure when it was implemented, so older versions of GCC and MinGW would likely not have support, std::tr1:: or otherwise.




#5217807 Under what class / category is a Golem?

Posted by Servant of the Lord on 19 March 2015 - 09:49 PM

Obviously this depends on your own lore, but my default lore-view would be:

 

Golems are similar to (but not quite) earth elementals.

 

Their creation is different - whereas elementals are spirits representing or personifying certain elements, with the power to manipulate that elements, that give themselves form by manipulating that element around themselves; golems are created beings (created by humans or other entities), and can't manipulate the element it is composed from. They can be composed from clay, earth, stone, wood, iron, flesh, or whatever... but the distinction is that golems aren't spirits with elemental affinity inhabiting and manipulating the matter, they are the matter, enchanted to give artificial life, and can't themselves manipulate the matter (anymore than say, throwing chunks of themselves). Their creator originally manipulates the matter to give them form, but they can't normally manipulate the matter themselves. And normally, they aren't very intelligent beings, being simple forms of limited human-created intelligence and technically barely even alive.

 

They aren't summoned into existence, or called forth like spirits; they are material gathered together from the environment and enchanted to give life, in the same way a magic carpet might be enchanted or a sword or animating and ""bringing to life"" a stone statue, suit of armor, or a wooden chair.

 

Now, depending on the magic used, you might take an existing spirit and bind it to a suit of armor or a human-shaped hunk of clay or a sword. That entity would then be intelligent, because the spirit bound is the actual entity and the spirit was already intelligent even before being bound. You could take a dog and cram a human's living spirit or a ghost/dead-human's spirit or a djinn, cramming that into a dog's body.

A spirit also could, of it's own will, inhabit a statue or suit of armor - it doesn't have to be something done to it by a third party - but usually without the proper bindings, the inhabitation is only temporary and a fairly weak bond. It's a weaker bond because it takes continued effort to sustain and continue animating the object, whereas being bound to the object makes you part of the object and requiring zero effort or sustained energy to remain within it.

 

Picture a skeleton. Now imagine that the spirit of the person who died is still floating around nearby. That spirit might re-animate the skeleton, providing a weak and fragile and temporary occupation, and the spirit eventually drains itself of energy trying to continue to animate the skeleton.

 

Picture a skeleton. Now picture a necromancer binding the dead spirit back into the skeleton. It takes an upfront cost for the necromancer to do this, but once down, the spirit will remain within the skeleton and the skeleton can be easily moved with minimal energy drain from the spirit itself. It doesn't have to be the original spirit of that skeleton that the necromancer binds - it could be a dog's spirit, or some other kind of spirit. But the original spirit probably has a more natural affinity for it, so it might adapt to it better, giving a greater chance of long-term survival.

 

Picture a skeleton. Now picture the necromancer instead of binding the spirit to the skeleton, using energy to animate the skeleton directly, without any spirit involved. This is closer to what a golem is. An inanimate object being manually animated by magic without spirits being involved. Except, now we take it a step further. The necromancer may easily bind dozens of skeletons and let them operate semi-independently from him, with minimal input. But if he has to manually animate skeletons, that takes alot of mental focus. It'd be hard to manually animate more than one at a time. Three or four if you have alot of practice at it. So golems go a step further - not only is the golem artificially animated, but the magi-user instead of binding an existing spirit, creates a kind of artificial spirit purely from magic and binds that to the golem.

 

I've never heard of a skeleton being used as a body for an artificial life, but I can't think of any reason why not. It's probably just that anytime you have a skeleton nearby, you probably already have a decent supply of non-artificial spirits to use anyway.

Also, I was using the term 'necromancer' because of the example of using existing spirits of the dead to bind back into skeletons. Golems themselves, being entirely artificial, is more enchanting and doesn't actually involve necromancy unless you put your artificial life into a dead body...

 

Because it's not a real life form, but something a wizard is creating, the intelligence is very simple and rough-around the edges. The artificial spirit then does the animating of the golem, requiring no mental concentration from the wizard. But because normal spirits themselves are life-forms, they have energy they can use to animate things. These artificially created lifeforms don't have energy in themselves, so they need some way of either A) gathering energy from the environment (requiring a greater skill of the creator when creating the artificial life), or more commonly B) precollected energy is stored either nearby.

 

If the energy is stored in a fixed location, that limits the geographical range of the golem. This still makes them useful for, say, guarding an area, but it means if they leave the range of the energy source they crumble and fall apart (depending on the material) and the artificial life fades out ("dies") from lack of energy.

 

More commonly, the energy is pre-collected by the wizard and stored inside the body of the golem (in some object within them or perhaps directly in their material), so the golem carries the energy source around with it's body. Eventually it'll use it up, but if the golem was created skillfully enough, and if it isn't very active or is dormant for long periods of time, it might last decades or even a few centuries.

 

A third option is the wizard having the golems use energy from the wizard's own body. If the wizard lacks skill in gathering and storing energy in other objects (like crystals or metals), existing lifeforms already naturally produce and store energy quite efficiently. It probably would give some wizards an ego trip that they are literally sustaining another life form, artificial and simple-minded though that lifeform may be. It also prevents other wizards from taking control of your golems and using them against you, because you can easily cut off access to their energy source (yourself). It suffers from the same mobility limitation of not having an internal energy source, but at least it's still semi-mobile in that you can travel and they can travel with you, and probably have a decent rage (maybe even a few miles, depending on your skill in creating them as well as depending on terrain interference) around you.

 

 

Uh, and in answer to what 'category' they would be in would depend on your other categories. By what characteristics are you categorizing all your beings? Golems fall into the 'created' category. They also have different element categories depending on the material used to create them. They are melee, if categorizing by attack type...

 

The thing about categories is that they only make sense in contrast to what's not in the category. I'm a human. I'm also American. I'm also male. I also like cake. I have brown hair. What category you put me in depends on what categories are available. If you are categorizing by 'Cake Fan' vs 'Not cake fan', then I'd go in the 'Cake fan' category. But in someone else's categorizations, I'd go in the 'Programmer' category (as opposed to 'Composer' category), but I might also fit slightly under the 'Artist' category or 'Designer' category at the same time. It's even been proven mathematically possible for something to fit into two mutually exclusive categories at the same time (with upset and messed up a whole generation worth of math concepts back around the end of the 19th century).




#5217784 Problem with 2D isometric tile picking

Posted by Servant of the Lord on 19 March 2015 - 06:52 PM

Unrelated issue: Typically you shouldn't load images every frame, you should load images once and then store them someplace where you can repeatedly use them.
 

I'm just not sure how you're supposed to implement the actual mouse map. Do I create an image with the different colors?

Yes. Make sure it lines up to the shape and resolution of your isometric tiles (some people use different isometric angles and measurements).
 

How do I check what color the click was registered on?


PosInTile = (PosInWorld / SizeOfMouseMap)

The mousemap size should be the size of the regular flat isometric tiles.
 
Don't forget that you're looking at the position in the world, and not necessarily the position of the mouse on the screen. You have to compensate for the camera, if you have a world that scrolls.

 

All you'd have to do at that point is check the color. I'm just unsure of how exactly you would do that.

That depends entirely on your API and language, though it looks like you already figured that out.
 
 

if(color.equals(red))
{
    coords.y++;
} else if(color.equals(green)){
    coords.x--;
} else if(color.equals(blue)){
    coords.x++;
} else if(color.equals(yellow)){
    coords.y--;
}

You aren't just going up or down and left or right, you are going diagonally. Your ++ and -- to the coords should be affecting both X and Y in two of those cases, depending on the layout of your isometric map.
 
My guess is:

'red' is y++
'green' is y--
'blue' is x++ AND y++
'yellow' is x++ AND y--

But you have to figure that out since I don't know your map layout.
 
Also, I don't know what your 'isoToCart()' function is doing. It looks like you are trying to mix your old solution with the new solution, and the two conflicting solutions are stepping on each other and giving you extra wrong results.




#5217770 If you're familiar with both Harry Potter and Naruto...

Posted by Servant of the Lord on 19 March 2015 - 04:52 PM

They are constrained by their low rank/not being recognized as adults, and have to compete to earn certifications to make progress towards becoming full-fledged warriors considered as equals by their teachers.

I wouldn't mind if you left that trope out! I think there's plenty of the "Oh waaaaah! we're so underestimated, misunderstood, and overlooked! But we'll prove them wrong and save the day and earn their respect!" kid stuff. [Adults are useless, Not now kiddo, Cassandra truth, Parental obliviousness, Police are useless, etc...]

Unless you are playing it for laughs and lampshade it, like Lemony Snicket (who did a fantastic job at that), it just gets tiresome to me.

 

I don't mind the students being hindered by their genuine incompetence and ignorance though!

 

Personally, if the adults aren't helping them with some challenge, it's probably part of their training. I'm a fan of seemingly (or actually) heartless wizard masters who toss their own pupils into different dimensions or labyrinthian dungeons, or teleport them to foreign lands to force them to survive. SERE and worse. I've heard offhand about survival courses like escaping from helicopters that are intentionally "crashed" into freezing water, or being dropped nude into a forest with only a hunting knife and expected to survive for three weeks before you are picked up (not sure if that's a real thing or not). 

 

I'd expect the teachers to be harsh, dismissive, and abusive.

 

why this school exists

If a magic school existed in real life, maybe it'd fall into one these categories: (or maybe a mix of them!)

A) Military institution (either pre-military preparation, general soldier (bootcamp), or an officer school (e.g. Westpoint))
B) Correctional training
C) Shelter and rehabilitation (also think post-Nazi rehabilitation of concentration camp victims)
D) Private or government general education (Harvard, Yale, Hogwarts, etc...). Likely for ran for money or prestige or philanthropy, though maybe ran as a cover to hide a more important purpose,
E) Also see the different purposes for different types of concentration camps for more ideas.
 
Are these government owned but ran with minimal government interference, privately-ran and privately owned (private military), or government-ran and government-owned (and possibly overly bureaucratic)?

Then you have to ask, "Why was it originally founded?", "How long ago was it founded?", "How has it changed since the founding?"
As each general passes, the reasons for it a school to exist, and the purpose and motives of the people running it, change dramatically.
 

I want to have a more explicit process of specialization, where the teens have to decide what role they want to specialize in, then earn it, and there would be some kind of irreversible metamorphosis.


I like this idea. I read a poorly written (i.e. no editing process) snippet of a story recently that kinda went in this direction, and definitely wouldn't mind more of both those ideas (explicit specialization and character metamorphosis).
 

I'm aware that jedi in the Star Wars universe are kind of like ninja, but I never liked the philosophy or culture of the Star Wars universe much; I see jedi as being like paladins or clerics, and I strongly dislike religious warriors or mages.


Not even when they are genocidal eugenicstongue.png

I linked that for additional creative thinking; not to encourage or discourage the use of ninjas, clerics, or clerical ninjas. wink.png




#5217724 Has royalty share ever worked?

Posted by Servant of the Lord on 19 March 2015 - 02:15 PM

Yeah, I get the feeling that most of the successful collaboration projects were ones where the people involved already knew each other.

 
It seems the common thread is that the people, whether they know each other or not, are already experienced and professional in attitude and skill.
 
Merely knowing each other can complicate the already-complicated development process. There are dozens of threads on this forum about partnerships and agreements between friends and strangers that went sour. In my in-experienced opinion, someone needs to own and control the project, with the others being contributors, employees, or contractors.
 
I discuss my dislike of percentage-based payments in an unrelated thread:

 

[Promising percentages of revenue as payments] is one idea, and one I've considered, but it's not my preferred choice. It complicates things. In 10 years from now, if a single copy of one of my old games is sold, I still have to remember to give 10% to the composer, 5% to the writer, 15% to the two artists.

I could offer the first Y% of sales only for a specific time-frame (The first two launch weeks of sales, the first year of sales, etc...), that way it's not an indefinite budget complication but a short-term one.
Alternatively, I could offer the first X amount of profit earned goes to the composer, before I see any profit myself - and that seems reasonable to me, and appeals alot more.

But as the game developer, ideally it should be me taking the risk of the game, not the contractors. I shouldn't pay people with promises, but pay them out of pocket or not hire them at all - especially in an unpredictable market (indie game sales). If I don't have the money, I shouldn't buy the goods; if I need the goods and don't have the money, then I have to make due with the budget goods I can afford.

 

It's nice to partner up and work on games for fun! But we can't treat the business side of game development the same as we treat for-fun hobbyist projects, or we tend to get rather cavalier about it. When money gets involved, people (friends/family/strangers) behave differently.

When money is involved, then it becomes a business and the business side of things need to be treated more cautiously.




#5217709 Problem with 2D isometric tile picking

Posted by Servant of the Lord on 19 March 2015 - 01:46 PM

I first learned about mouse maps from an article here at GameDev.net many years ago, but have successfully used them in small projects.

The first first article (1999), and the idea expanded by someone here for use with tile elevations (2003). I should've linked to them in the original post. smile.png






PARTNERS