Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 15 Oct 2011
Offline Last Active Feb 07 2015 11:03 AM

Topics I've Started

Hidden Locations, Dominions4 Style, Or Not

04 February 2015 - 01:12 AM

So I'm currently working on the part of my game involving how special locations in each province influence the nations that control them. I have a lot of options here and I'm not sure what my plan is yet.


I could allow the Explore Province button to have a random chance to find a location and then a random location would be generated. If you pass the check it is added to your province, this system is I believe the one used in King of Dragon Pass.


I could also have a random discovery chance to find locations pre-assigned to your province, or a skill check of some sort. This is what Dominions 3 and 4 use.


I could assign a time value to expeditions and/or an exploration team size value, or possibly modifiers based on characters. For instance exploring with your god/ruler giving a good boost to finding chance and site quality. I could also have a 100% chance of finding something, with a minimum time value, and have time or size or characters on the expedition increase the quality of the found site.


The trade off here would be to force you to choose how to deploy your major characters, mages/scholars/god/ruler/explorers, and or portions of your population added to the exploration party. What major character you use may also determine the type of site, for instance mages finding magic related sites, scholars finding libraries or ancient castles and so forth.


A major goal for this system is to be a source of character for your nation. What you find in exploration could determine the way your nations goes. If you invest a lot of time and characters on a search and you are magic heavy, you could find an ancient mages guild of pyromancers with lots of fire related artifacts and tomes. From then on you would be a fire themed nation. Or you might find an ancient forge, causing your people to be great weapons/armor smiths. Or you might find the last enclave of a dying race and incorporate them into your nation. You could decide to keep them separate, to interbreed a little to keep them pure but stop them from dying out, or interbreed extensively so that your people would have a low level but noticeable portion of their unique traits. Maybe you find a library of an ancient agricultural society with books and seeds giving you high staple crop production and the ability to grow small amounts of rare crops or even crops thought extinct. As a last example since I'm getting this list really long, perhaps you find a hidden dinosaur population and use them as beasts of burden or war mounts.


In any case the goal of this whole system is to maximize the potential of the above concepts. In games like dominions you may get the ability to recruit a special unit, or a supply or rare magic gems, but that doesn't really massively impact the essence of your nation, especially as you have such a strong starting flavor for each nation. Also I'd like to give the player more freedom, so that finding the equivalent of the Abyssian's Smouldercone doesn't lock you on a path forever like your nation choice in Dominions3/4 does.


The overall goal of the game is to give you control over the fate of your nation even if you are still affected by the factors you don't control like province locations, what nations around you do, and so forth.

Opinion Modifiers: Characters and Populations

28 January 2015 - 05:49 PM

In my current game I need a way to simulate how different individuals and groups feel about each other. I have some thoughts but I don't know if I'm doing too much or too little.


One way is to score a series of modifier objects:

Wrong government -x

Wrong religion -x

Attacked our country/province -x

Attempted to assassinate ruler we hate +x


Then total these up when we need to see the opinion.


Another way is to just modify the opinion whenever any action is performed. This might be easier and faster, but then we can't easily check why we have that opinion.


I'm leaning towards the first though I wonder if there are possibilities I had not considered.


Populations exist as an integer and some descriptors, like 50000 people of race x with religion x and nation x and class x and job x:

50000 dwarf peasant farmers of GenericChurch of Placeland.


Populations will generally have an opinion of relevant provinces/nations/populations/major characters with various modifiers.


If you have the above population living in the same province as 40000 elven noble merchants of SpecificGod of NationOverThere, there might be tension, possibly violent, based on those attributes plus opinion modifiers.


Meanwhile if you are an elf king of Specific god and you have dwarf peasants of GenericChurch, they might side with an invading dwarf king of GenericChurch. So from 50k peasants you might get 2-4k of poorly equipped soldiers joining forces with the invaders plus some supply bonus as they are peasant farmers. Dwarven merchants of generic church might fork over some cash. Unless say you are a benevolent and tolerant ruler not favoring elves or worshippers of SpecificGod over them and the invading dwarf king is a tyrant with high taxes who lets his noble officers abduct the daughters and wives of peasants. Also if you ruled over the province this population lives in for a longer or shorter time, your populace might be more or less likely to assist invaders, or revolt, or what have you.

Loading Data For 2D Game Map

28 January 2015 - 01:32 PM

So I'm currently working on a project that requires me to have a map with provinces. I am currently having a map drawn in GIMP2.0 and loading the map with the standard SFML image loading function. This works fine. The place where I have an issue is reading the image file color data to determine what part of the map is what province. The map has each province colored in a unique color. Borders are added and then a new image without province colors is generated. So the new map has land one color, inland sea another color, and oceans another color. Borders are a lighter color than the land. The color map is kept so that it reads the mouse position when you click checks the color and says, oh you clicked on province X.
This is all great except I feel like the loading time is excessive. There are currently 2860 land provinces and there will probably be many more, plus inland sea, and ocean provinces. When the colored map is loaded a function goes through and checks the color of each pixel and adds the pixel to the appropriate province as an owned pixel of that province.
This data is used by other functions such as drawing the country map. So the program checks the country of a province and colors every pixel of each province the appropriate country color on the country map. The country map is a specific filter; there are many others. pixelsOwned is just a list of coordinates for each pixel, x,y.
My profiler tells me that the functions that generates each province's list of owned pixels is the most time consuming of the loading functions. Although many of the functions that involve coloring the map take quite a bit of time. It takes about 4 seconds to load up just if I comment out all the map coloring functions.
Is there some superior way to reading the data from every pixel?
Here is the function below:

void MapManager::loadMapPixelData(sf::Image *image) {
    sf::Vector2u pixelSize = image->getSize();
    int width = pixelSize.x;
    int height = pixelSize.y;
    for (int i = 0; i < width; ++i) {
        for (int j = 0; j < height; ++j) {
            sf::Color color = image->getPixel(i, j);
            int red = color.r;
            int green = color.g;
            int blue =  color.b;
            for (int k = 0; k < provinces.size(); ++k) {
                if (red == mapProvinceValues[k].red && green == mapProvinceValues[k].green && blue == mapProvinceValues[k].blue) {
                     getProvinceById(k+1)->pixelsOwned.push_back({i, j});
             provincePixels.push_back({i, j, red, green, blue});



Declaring std::String Causing Segfault

26 August 2014 - 10:55 AM

I have a project in Code::Blocks to practice my SDL. For some reason something as simple as this:

string stringname;


is causing a segfault for me. I don't ever recall having an issue where declaring a string caused this.


I generated an all new console project to test this:

#include <iostream>
#include <string>
using namespace std;
using std::string;
int main()
    std::string helloworld = "hello world";
    cout << helloworld << endl;
    return 0;


This has the same issue. Am I just missing something obvious?

My Own Game Feels Worse Than It Is

04 March 2014 - 08:33 AM

Since I'm weird and like games in genres that tend to be unpopular, well its gotten better lately, I learned how to program and got to work on an open source game engine. I made relatively good progress on the programming part, but everytime I started to add the content it got dull. Part of this was that editing XML files is dull as hell. But the main problem is that it was my own personal project.


A good comparison would be Banished. Because he wrote the engine from scratch the dev ended up not adding as much content as people wanted. The gameplay is relatively simple, but still fun. Now, on a technical level Banished is way better than anything I could program, I simply lack the experience to do a lot of things that dev can do. But that's not the main issue. I got mediumly far into setting up the basic city builder economy. Its currently about the level of Banished in depth/complexity/stuff you can make, somewhat modified by lacking the technical skills to do certain stuff. But whereas I could play Banished for quite a while, maybe 20 hours so far, I can't get excited at my work at all, even though it arguably has more stuff to do, and will have even more if I can get my self to work on it, since I saved time by using an existing engine. Even though there's arguably no reason for this feeling, I can't get over it. The only thing I can think of is that knowing exactly how stuff works sort of dulls my enthusiasm.


This happens to me somewhat in modding games as well. In EU4 my mods are always just a little less fun than vanilla, except the parts that are vanilla. Making my own events and nations and idea groups, even when I resist the urge to make them too powerful, does not produce the experience I would expect.


Does this ever happen to anyone else? I get fired up by an idea and make it happen and then its just meh, even if I can have fun playing someone else's game that is similar or even lower quality.


Is there a term for liking your own games less than other people's?