Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 06 Feb 2011
Offline Last Active Jun 16 2016 03:49 PM

#5243979 XP, Level, Health,Damage progression of player, enemy and weapons

Posted by on 01 August 2015 - 04:30 AM

So what aspect exactly?


Normally when there is many levels,  I see stats implemented via some sort of formulas, which you can play with to get the results you want. Some stats may be linear, others exponential.




stealth_detect_range = 10 + level * 5

hp = 100 + level*level

resist = 0.9 - 0.5/level


You can apply such things to both players and NPC's, and to randomly generated weapons/items. NPC level is selected based on player level, possibly with some random variation, and possibly including difficulty setting.


When there is fairly few levels (e.g. specific skills you spend skill points on, rather than or in addition to a "level" that buffs everything), I tend to see games just explicitly pick values for each level. Sometimes a skill level will have an entirely new effect compared to the one before it.



It mostly just a question of deciding what you want level's/skills to do, then playing it a lot to try and make it balanced/fair.

#5243802 Pass anything as constructor without varargs

Posted by on 31 July 2015 - 08:51 AM

The only problem is that I don't want to create a pool for each of them



std::map> eventPool;



But isn't that exactly what you have done? Is it really such a big step to make a "SimplePool<T>" then explicitly instantiate it for each type in some collective factories? Then just do say "myEventFactory->createKeyEvent(KeyEvent::KEY_DOWN, keyCode, modifierKeys)".



Otherwise for a more complex solution Id just look at getting a pool memory allocator. Since this only actually deals with raw memory of certain sizes, the type does not matter, and you avoid that expensive map lookup. Instead at that level your just getting or freeing a block of initialised memory (potentially with optimisations, like allocating a full page worth of blocks at once). You can have a pool for different sizes, e.g. up to 16 bytes, 32bytes, 64, 128, 256, etc.


The user of the system then deals with constructing and destructing the right object into it (e.g. new/delete). If you have many event types with similar sizes, this also reduces the required size of the pool. And there is no special requirements on your pooled objects (at least at this level, e.g. your other event code might mandate a base class), e.g. they don't even need to be moveable or have any particular constructor signature.

#5243762 [Question] map algorithm in sdl is flickerin'

Posted by on 31 July 2015 - 03:37 AM

While full code would be better, looks to me like your calling SDL_RenderPresent once per tile. You should only present your scene after you have rendered the entire thing, once per "frame". Also with 3D acceleration, a present call is also likely to invalidate the back buffer contents, meaning you have to redraw the entire screen, not just add/edit parts, allthough cant remember if this applies to SDL or not.

    for(int i= 0; i < MAX_COL ; i++)
    	///cout <<endl;
        for(int j=0; j < MAX_ROW;j++){
    	    if(arreglo[j][i] == 2) ////  correcto.
    	         rect.x  =32;
            else if(arreglo[j][i]==1)
    	        rect.x = 0;
            else if(arreglo[j][i]==3)
         	rect.x = 64;
            ///cout << arreglo[j][i]<<',';
           DrawMap(render, &rect, i*32,j*32,32); ///copy the render in the screen.
           SDL_RenderPresent(render); //SyncViews: Call this once per frame, after everything has been rendered/drawn

#5243544 Dropbox + TortoiseSVN; Where is the advantage? (New to SC)

Posted by on 30 July 2015 - 07:16 AM

Putting a source control repository on something like drop box is likely asking for trouble the moment you only get a partial sync for some reason, or multiple people try to "commit" before it syncs. I wouldn't even be surprised if it corrupted the repository including previous changes.


Anyone know what the size limit is on github? It's $7/month for individuals to have 5 repo's or $25/month for businesses to have 10 repo's, but can't see any limited on the size of a given repo. Would also want to check what the restriction on "personal plans" is, there a lot cheaper and as far as I can tell, the only limitation is you can't have any complex restricted permission system, people either have access or they don't.


If you must avoid that, Id host a SVN/GIT/whatever repo on one of my own "server" systems, then just use dropbox or other cloud storage system as a place to put the repo backup's say once a week incase my "server" was to die. This way the repo is running on a proper file system with no risk of potentially unpredictable cloud syncs corrupting it.




Also generally, a lot of the "big files" I see in projects don't need to be under version control. e.g. none of your build output (exe's, dll's, etc. or complete installer packages like .msi, .rpm, etc.), none of the intermediate build files (e.g. .o files) and various other cache/misc files the IDE and toolchain might create (e.g. Visual Studio .sdf and .pch files). This can cut down a fair bit on the required repository size, although in games I tend to find the source audio files and graphics files are also pretty big, and I wanted those version controlled.

#5243543 default install folder for windows game

Posted by on 30 July 2015 - 06:51 AM

Well, Steam is bad, and if I was developing an operating system Id have banned them. Although they install to program files, they modify the file permissions and give "Full Control" to the local "Users" group. This means that nearly any old piece of non-trusted code can go and change stuff in their, for example replacing a games executable or DLL files with malicious versions.


You really want to install to program files by default, and require elevation to a trusted user for both installation and updates, and never load executable files (exe's, dll's, Java jar's, etc.) from any non-trusted location. This way no other untrusted piece of code can infect your program.


I suspect MS would really like to ban what Steam does and any other case of executables in generally writeable locations, but the size of that compatibility problem would cause a really big backlash. The new App's system is a lot more restrictive and would expect to see further phasing out of the legacy "desktop program" stuff.

#5243541 DLL or Static Library

Posted by on 30 July 2015 - 06:37 AM

static libs are far easier.


The problem with DLL's is there are a lot of traps because lots of things can cause binary incompatibilities even when you take the required steps to get the basic linking/calling convention right so that they load (e.g. using only C-API's with their standard ABI, or using the same C++ compiler everywhere) that will just cause memory corruption and then crashes (because of things being statically linked that should not have been, or mismatched DLL versions/binary interfaces).


Id only use DLL's if I had a need for the runtime linking aspect of them, e.g. for plugins. But that is a very advanced topic. LGPL licensed libraries also causes problems. Hopefully any you need to use have a plain C interface that is safe (e.g. the core Window's DLL's, and things like zlib, libpng, etc.) or other standardised ABI (e.g. the Window's Common Object Model stuff you will come across if you ever use DirectX), otherwise id avoid them.

#5242155 Maintaining faction specific view of the world

Posted by on 23 July 2015 - 06:20 AM

When I made a simple RTS, I didn't bother with anything complex, with a simple form of your option 1. Essentially each object just had a "seenBy" bool array / bit field, and in LOS updates Id set that appropriately for each object. This gave me the common fog of war type thing, as rendering, AI, etc, could just check the flag for the relevant faction when iterating through object collections. This however doesn't allow for misinformation.


One option is to just expand the bool to contain more info, e.g. if I was making a system similar to supreme commander, the states might be:

  • UNDETECTED: not directly visible, and not detected by radar,
  • LINE_OF_SIGHT: currently have direct line of site,
  • RADAR_DETECTED: only approximate unit type,
  • RADAR_DETECTED_KNOWN_TYPE: currently only seen by radar, but had previously seen details through line of sight

Or you could even include more complex info in that per-faction block, like having the last known position, essentially building up a per-faction "view" object that goes with the real object. You could even then make it so that the engine only gives other components (e.g. UI and AI) these per-faction view's, not the underlying real logic object, allthough not sure that provides much value unless you intend to have user-created UI plugins and AI's and want to prevent cheating.

#5241688 Working on C++ Visual Studio projects across multiple PCs?

Posted by on 21 July 2015 - 04:12 AM

For both git and svn, I just use the ignore feature to strip out the build output directories, and other per-user / per-machine files (e.g. for Visual Studio stuff .sdf and .suo).


Third party dependencies are more tricky. At work we put the original download tar/zip/etc. in the projects SVN, then have a fairly complex set of build scripts to build all the third party stuff correctly as well as our own stuff (not doing C++ stuff on Window's, so things like the DX SDK and Window's SDK that don't do this have not come up, but would surely cause a lot of irritation. IIRC we even have the GCC and Java rpm's in their and install them into a chroot on the Linux build servers).


For personal stuff I have never bothered, I just have a "Third Party.txt" detailing and linking the third party dependencies, and need to download and compile them on each system I use into a Third Party directory. I did define custom MSBuild properties in a property sheet, so I can just do say "$(BoostLib)" in additional link directories, but not figured out if a dev can override these should they put boost somewhere other than "$(SolutionDir)ThirdParty\boost".

#5241547 Good C++ engines?

Posted by on 20 July 2015 - 10:50 AM

I guess this is why I hear things about Window's 10 not providing an update opt-out for non-enterprise users... You really should make that a priority, those updates include lots of security things as well.


Also as well as being a fairly clear message (rather than just it being broken in some way), that looks like a hyperlink to me, does it not take you to somewhere useful?


As for IE requirement, i think I read somewhere that an embedded browser is used for some UI components/panels within Visual Studio (and not just for the web/html editor).

#5241485 free private SVN with biggest disk space?

Posted by on 20 July 2015 - 04:28 AM

Yep, most flexible free solution is to host it yourself laugh.png Leave a PC on 24/7 running the SVN daemon, and tell your router to forward the SVN ports on to that PC.


Alternatively, it's free to rent a private host in the amazon cloud with 5GB of storage (for the first 12 months).


[edit] as pointed out below this can be as expensive as renting a server/service -- A 250W PC * 0.15c/kWh * 24hrs * 30days = ~$27/month -- so check your utility rates and look into low-power PCs to use as the server biggrin.png

You get a few zeroes wrong there? Looks like you forget some of the magnitude differences in the units.




"250 W (watts)×0.15¢/kW·h (US cents per kilowatt hour)×1 month"

"27.40¢ (US cents)"


If you have the hardware, internet, etc. already, then not so pricey (assuming that 0.15c/kWh is right, I don't personally pay direct so not even sure for my own country).

#5239190 Advanced font/text rendering options

Posted by on 09 July 2015 - 06:45 AM

I have some existing code using FreeType I did some years ago and have used since, just laying out the glpyhs using the FreeType provided metrics and kerning routine then rendering as mono or 8bit anti-aliased greyscale (some fonts, e.g. Calibri I found will give mono at certain font sizes for most glyphs) then uploading the final result as a D3D or OpenGL texture (so one texture containing the entire block/string of rendered text that I can draw as an alpha blended quad either screen aligned in the UI, or in 3D space).


However I now want to improve this to give correct and higher quality results in more cases. Namely correct handling of composed/decomposed codepoints/glpyhs, non-latin scripts and support for subpixel rendering.

Most of these however appear to not be part of FreeType. e.g. the correct placement of the combining mark for á and Á does not appear to have a FreeType API, and kerning seems to be superseded by GPOS which FreeType does not implement. Things like correct subpixel rendering, while a FreeType feature seem to be highly complex and poorly documented (e.g. how to then deal with coloured text and backgrounds). So at least before I start down that highly complex road am looking at what options I have...


  • FreeType itself seems to recommend a library called Pango. However this looks like a pretty big and heavy weight library, pulling in a lot of other difficult dependencies (e.g. parts of GTK and Cario) which while may be fine on Linux, does not look promising for MSVC/Windows/Direct3D. I also found very little information on using Pango with Window's and OpenGL/Direct3D or just games in general...
    Is this worth pursuing? It looks like I might be able to do without a lot of GTK and work with in memory bitmaps I can upload to the GPU as textures, but I am not sure if it is really suitable and worth learning about?
  • On Window's there is DirectWrite. Which I understand I can use via Direct2D and Direct3D. Don't really know much about this, and again if it is generally suitable for games using D3D11 on Windows 7 to 10. Also I would need something different for anything I do on Linux which would seem a lot of extra work.
  • Anything else? I had a poke around CEGUI and SDL_ttf, but they seemed to use FreeType in much the same way I did. I am planning to look at CEGUI some more and write a demo to see if it has solutions for my problems, but am not entirely sure it solves everything having read through their FreeType logic and not seen much sign if them implementing the things I did not. Also since I do not plan to port the rest of my UI stuff, mostly just looking for inspiration/examples on fixing up my own FreeType logic.
  • Obviously simple bitmap/sprite fonts don't really solve any of my problems here.

#5212504 what would make vc text unreadable.?

Posted by on 23 February 2015 - 01:17 PM

Yes, MS seems to have made a mistake, you can get the update from the MS site, I guess windows update should have it as well, but seems odd it would come up now unless you manually played with them.





Fix for text quality degradation after security update 3013455 (MS15-010) is installed

After you install security update 3013455 (described in MSRC bulletin MS15-010), you may notice some text quality degradation in certain scenarios. This problem occurs on computers that are running the following operating systems:
Windows Server 2008 Service Pack 2 (SP2)
Windows Server 2003 SP2
Windows Vista SP2
Release Date: February 18, 2013
EDIT: Actually seems MS made a second mistake and put the wrong year on that lol, 

#5208110 When to use pointers or objects in 'Composition'?

Posted by on 01 February 2015 - 06:09 PM

In all my stuff, my main Win32 window class and my main graphics object are actually completely unrelated. I just give the graphics constructor the HWND it needs.

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    Window window(...);
    Graphics graphics(window.getHandle(), ...);
    while (window.processMessages())

I then have higher level logic that contains both these components to deal with both together (e.g. the game loop, managing window/fullscreen/borderless transitions, resizing, etc.).

#5187377 Converting project code from VS13 to Code::Blocks, massive amount of errors

Posted by on 16 October 2014 - 06:39 AM

Thats not really a "genuine bug". If you turn off the MSVC extensions switch you get the correct error for the reference thing, or you can enable the relevant warning, or you can make that warning an error. There just accommodating old code by default there, because it is already hard enough to get enterprises to upgrade (and even on Linux, I had to write code for GCC 4.1 not long ago, making changes that effect old programs or code just really does not go down well).



The warning, off by default (I suppose you could argue that maybe, but some enterprises like there "treat warnings as errors" then complain about every little thing when an update breaks the build...):

warning C4239: nonstandard extension used : 'argument' : conversion from 'Vector2f' to 'Vector2f &'

If you turn extensions off entirely

error C2664: 'void func(Vector2f &)' : cannot convert argument 1 from 'Vector2f' to 'Vector2f &'


GCC has some non-standard features as well. e.g. for c++ see https://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/C_002b_002b-Extensions.html. And I recall GCC has some compliance issues as well, like two-phase-lookup not being completely perfect? Likewise Linux/GCC programmers seem to be forever depending on things from POSIX that are not actually C/C++ so porting them off of GCC/Linux is far harder than it should be, even when not dealing with GUI's, etc, so just because its a GCC compatible lib that process some data (no network,gui,drivers,etc.), in my experience can still mean that "porting is incredibly difficult"....

#5185991 using xml for crafting recipes

Posted by on 09 October 2014 - 08:15 AM

I use a datafile to define my recipes, its a fairly simple thing to have as long item types can be reference by some kind of id.


For example for me the "Item" class only defines the item type (e.g. I only have 1 Item instance for my iron bar item, and every iron bar in the world references that single instance). There are other, possibly cleaner ways, the main point in this situation is it gave me an easy "const Item *getItemByName(const std::string &name)" for console commands and data file loading.

class ItemStack
    const Item *item;
    unsigned quantity;
    /**Exact meaning, default value, etc. is defined by virtual methods on Item.
     * e.g. for a tool this might be durability (and I also prevent non-new tools
     * from being stacked).
    unsigned metadata;
class Recipe
    std::vector<ItemStack> inputs;
    ItemStack output;
List<Recipe> recipes;

        <input item="log" quantity="1" />
        <output item="plank" quantity="1" />
        <input item="iron" quantity="1" />
        <input item="plank" quantity="1" />
        <output item="pickaxe-iron" quantity="1" />
        <input item="lead" quantity="1" />
        <input item="gunpowder" quantity="1" />
        <output item="bullet" quantity="100" />