Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need 7 developers from Canada and 18 more from Australia. to help us complete a research survey. We need your help! Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 29 Jun 2010
Offline Last Active Today, 05:34 PM

Topics I've Started

Should fanfic games be legal?

Today, 08:04 AM



I've seen this topic crop up at the forums from time to time. I'm also dealing with it on a regular basis myself due to my main project being a sequel to a SNES (Terranigma). However, I've never really had any larger discussion on the topic with other game devs. So...


Should fanfiction games be legal?


Personally, my own game is already on the extreme side - I'm making a direct, storywise sequel to the original game, using some of the characters, the same gameplay-mechanism (with extentions), and due to lack of artistic talent and for nostalgica purposes the original graphics (with edits) and sounds.


I know that it is technically a grey area with a trend towards illegality, currently. I've never heard of anyone being sued for making a private, non-profit fanfic, but I've heard and experienced the practice of Cease & Desists letters, which request you to remove such a project, while threatening legal actions if not followed.


Then there is the argument of fair use. Technically from what I understand, though I'm not a legal expert, fan-fiction most likely would not fall under fair use. Since the ruling of this seems to be fairley subjective/specific, it would be interesting to see the result of such a court case, but I belive no private fanfiction write/programmer is willing to let it go that far. I also don't want this to turn into a mere legal discussion, so nevermind that...


Now I see that there is a general desire to protect one's work, and I agree that not anyone should be able to use your own intellectual property to enrich themselves. However, what I don't really see is why that is a problem with private (= developed by individuals and not a company), non-profit, fan-fiction games, which fully states the original source of its material (= doesn't claim ownership for stuff that they didn't make themselve), which are put online.


By producing such a game, I'm not making any profit off of their work. Also, in my case, I'm making a sequel to a game whose franchise has never been used for the last 19 years (not even in the Wiis retro store). So I'm also not taking any market-share or generating profit-loss due to a free alternative to nintendos/enix charged products of this franchise. I can see this being a problem with currently active franchices like Zelda, Mario... howerver, I also belive that this is not a real issue. First off, most/all the fanfic-games are on the PC anyways, so its not even the same platform/target audience (at least for console only games). Second of all, most fanfics eigther suck, or are at least wastly inferior to their original counterparts (1 person cannot possibly achieve the same quality of a game like the current mario titles in a feasable timeframe). Thus, I belive that fanfiction (in the frame I gave) does not possibly inflict any damage to the original games copyright holder. Or am I missing something?


So what this leaves me personally with is just the attitude of "Its our trademark, we control what we do with it", despise any considerations about if it actually affects them at all. Which again is understandable in its core, but doesn't make much sense to me in the context of like what I am doing. I also understand that legally copyright/trademark holders somewhat have to enforce their copyright for it to keep validity, and that with there being no real legal regulation towards this kind of non-profit fanfic, they can't just be like "yeah, do whatever". Some studios seem not so strict about it, but others bring down fan-made games on a regular basis. Other studios even endorse or promote fanmade games, which I belive is great - though what I'm suggestion is that there should be some sort of legal regulation towards non-profit fan made games, so that there can't just be someone to hack the ROM of the newest Zelda game, replace a few textures, resell it and claim its "fan-fiction" and get through with it. But us people who are just making a fan-game due to general admiration of the games of our childhood - it saddens me personally that I basically always have to live in the fear that one day I will be shut down. 



I'm basically claiming that it should be legal to produce a fan-fiction game given those points:

- Its free of any charge and/or profit for the producer.

- It fully states and qualifies the original authors of the work, which parts of their work has been used and what has been contributed by the author of the new game

- It does not actively offer a free, full alternative to a game that is currently being sold.

- The producer of the fan-fic game formally informs the owner of the original game about what he is producing, giving him the possibility to inspect what he is doing. This is the point I'm currently not applying to, because I know both from personal contacts and research that in case of a direct contact enix response is basically a 0815 C&D-letter. So this point really is only viable for people like me if there is a legal possibility to keep doing what we are doing (or the studio in question is known for having a positive attitute towards fan-ficton work).


So - do you agree on my stance toward fan-fiction games, or do you think copyright-owners should have the total control over the work anyways? If so, why/why not? I know I'm probably strongly positivly biased towards the idea of legal fan-fiction due to what I'm doing, so I'd really like to hear other devs ideas towards this - like, what would you say/do if someone made a fan-fiction game based on one of your games (in the context I've given)?


"Mode7" perspective projection "arch"

13 July 2015 - 06:50 AM



for my 2d game, I've implemented a perspective effect for a pseudo-3d worldmap like the "mode7" of the SNES yesterday. I'm using a simplistic "fake" approach using a fullscreen quad, where each height-value acts as a scan-line, and based on the scanline position and an angle (0-89, where 0 is "top down look"), the read map values are displaced. Now while the algorithm works, I want to improve upon it, in order to achieve a certain effect.


The thing is, the current implementation of the perspective projection produces a apparent flat surface, which is ok for most uses, but for the worldmap, I want to emulate the effect of the worldmap in the SNES-game "Terranigma, which looks like this:


Attached File  WantedProjection.png   65.53KB   0 downloads


I've already added lines for the kind of projection that this generated. Now look at what it currently looks like for me (I think I've found the correct angle, and have recreated the scene with most needed details):


Attached File  CurrentProjection.png   83.53KB   0 downloads


As you can see, I've got a "default" perspective projection (don't mind the rendering artifacts right now). If you compare that to the first picture, you'll see that only in the pivot (where the player is), the projection lines are identical, the higher and lower you go, the more distortion there is. This applies both vertically (there is much more to see in the distance on the upper side of the screen in the first picture) and horizontally (all landmarks are much closer to the middle of the screen in the first picture). This creates the feel of a "cylindrica"/round plane, which is much nicer than a flat one (the world-map in the original game is supposed to be our earth, so its just fitting). So yeah, thats the effect I want to recreate.


Unfortunately, I can't quite figure out an algorithmn for this. I know that I have to move the projected point in x and y-direction, depending on how far on each axis from the screen center they are, but I find it hard to find an exact formula for creating just such a type of arch. So I'd hope someone here has a good idea (or simply more experience in math/CGI) to help me out here. In order to know what there is to work with, here is that data that is available on each scanline pixel:


- The resolution (448x480)

- The screen position in both 0-1 and 0 -resolution range.

- Configuration parameters: Angle (33.333), and pivot-screenline (256; marks the line that the "camera" is focused on where no projection is applied)

- Post-projection: A relative value marking which pixel of the tilemap to read. This is in range 0-TilemapSize, where each tile is 32x32 pixels wide.

- The camera-position, which is applied to the relative projected value to get the absolute pixel value at this position.


So what I belive is that I simply can/have to modify the post-projected relative tilemap position, by a value depending on how far from the center of the screen the point is on each exis. From what I've been able to inspect, scanlines around the center of the screen are not distorted any more, and lines on the bottom of the screen. But how? I've already done some brainstorming and tried to add ie. x/y distortion values based on the y-position, like this:

// TODO: how do I represent a non-linear distortion?
y_origin_tilemap += 64 * (i / 256.0f); // i is the distance from pivot screenline; y_origin_tilemap is the value to read from the tilemap

But I haven't been able to get any decent results so far. So I'm asking you, does anyone have any idea how this could be done (in pseudo-code or with mathematical formulas), based on what information is available for each pixel? For the exact value of displacement, I think I've got the lines right in both pictures, so I've made a gif to showcase that:


Attached File  Perspective.gif   88.06KB   0 downloads


Red belongs to the desired effect, black is what it looks like right now. So I basically need a way to calculate x/y distortion value to adjust the black line to the curve that the red line denotes. I think there is some simple mathemactial way for this to be achieved. Any ideas? Thanks in advance!



Just in case, I've attached the actual shader code, if anyone might need it (and can make sense of it):

        float2 vResolution = float2(vCamera.z, vCamera.w);
        float2 vPosTex = (in.vTex0 / (vResolution / float2(1920.0f, 1080.0f))); // project to viewport
        float2 vPos = floor(vPosTex * vResolution);
        // tilemap view angle
        float sin_angle = sin(vConfig.x);
        float cos_angle = cos(vConfig.x);
        // calculate projection parameters
        float h0 = (-distance_h * pivot * cos_angle) / (distance_h + pivot * sin_angle) + pivot;
        float z0 = distance_h / (distance_h + pivot * sin_angle);
        float slope_value = (1.0 - z0) / (pivot - h0);
        float corrective_value = 1.0 - pivot * slope_value;
        float i = floor(vPos.y - pivot);
        float y_origin_tilemap = (distance_h * i) / (distance_h * cos_angle + i * sin_angle) + pivot;
        y_origin_tilemap = floor(y_origin_tilemap + 0.5f);
        y_origin_tilemap = fmod(y_origin_tilemap, vTilemap.y * 32);
        float zoomX = slope_value * vPos.y + corrective_value;
        float length = 2 + floor(vResolution.x / zoomX);
        float x_origin_tilemap = floor((vResolution.x + 2 - length) / 2);
        x_origin_tilemap = fmod(x_origin_tilemap, vTilemap.x * 32);
        x_origin_tilemap += vPos.x / zoomX;
        float oX = length / 2;
        //y_origin_tilemap += 64 * (i / 256.0f);
        x_origin_tilemap += vCamera.x;
        y_origin_tilemap += vCamera.y;
        y_origin_tilemap = floor(y_origin_tilemap + 0.5f);

x_origin_tilemap and y_origin_tilemap are said projected position values.

[Win32] No WM_KEYDOWN for screenshot-key

08 July 2015 - 08:49 AM



I'm having slight difficulties to aquire the keypress for the screenshot-key in my Win32 application. It appears there is no WM_KEYDOWN being generated/caught/processed on my applications end (though WM_KEYUP is received on release of the button). Every other button on my keyboard seemed to work though (A-Z, 0-9, ctrl, alt, delete, scroll, pause, end, insert, ...). I'm simply catching those events in a callback function like that:

LRESULT CALLBACK WindowHandler(HWND hwnd, unsigned int msg, WPARAM wParam, LPARAM lParam)
	// test for message
	    // ...
		case WM_KEYDOWN:
			const bool bPreviouslyDown = ((lParam & (1 << 30)) != 0);
			input::WindowProcHook::SetRawButtonState(input::winToKey(wParam), true, bPreviouslyDown);
		case WM_KEYUP:
			input::WindowProcHook::SetRawButtonState(input::winToKey(wParam), false, true);
		// ...

I'm looking for occurances of VK_SNAPSHOT as the key, which is generated for WM_KEYUP when I release the screenshot key, so that one should be right. As for WM_KEYDOWN, none is created when pressing the key, so there should be no issues here. This is how I register the window class:

const WNDCLASSEX wndClass =
    sizeof(WNDCLASSEX),                                 // size
#ifdef ACL_API_GL4
    CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,    // styles
    WindowHandler,                                     // callback-function
    0,                                                  // additional infos
    0,                                                  // not needed
    LoadIcon(nullptr, IDI_WINLOGO),                        // windows logo
    nullptr,                                                // normal cursor
    (HBRUSH)GetStockObject(WHITE_BRUSH),                // white brush
    nullptr,                                               // no menue
    lpClassString,                                     // class name
    LoadIcon(nullptr, IDI_WINLOGO)                         // windows logo


and create the window:

m_hWnd = CreateWindowEx(0,
                      WS_VISIBLE | WS_EX_TOPMOST | WS_POPUP,
                      m_x, m_y,
                      m_width, m_height,

const MARGINS marg = { m_x, m_width, m_y, m_height };
DwmExtendFrameIntoClientArea(m_hWnd, &marg);

Do you see anything suspisious here, or is there some other reason you know of that this/any certain key cannot be captured?



std::unordered_map random insertion infinity loop

19 June 2015 - 06:52 PM



for quite some time I have this weird, randomly occuring issue with one specific part of my code that uses std::unordered_map. I always discarded it, but its finally getting so annoying I want to get rid of it. I'm using MSVC 2013. So here we go.


The problem is as following. Look at this piece of code:

class ACCLIMATE_API Module
    using HandlerMap = std::unordered_map<std::wstring, sys::Pointer<Handler>>;

    Handler* AddHandler(const std::wstring& stName);

#pragma warning( disable: 4251 )
    HandlerMap m_mHandler;

#pragma warning( default: 4251 )

Handler* Module::AddHandler(const std::wstring& stName)
    auto itr = m_mHandler.find(stName);
    if(itr == m_mHandler.end())
        auto* pHandler = new Handler(stName);
        m_mHandler.emplace(stName, sys::toPointer(pHandler)); // HERE ISSUE
        return pHandler;
        return itr->second;

This stores an input handler in a map of key to unique_ptr. Now on the commented line, whenever a blue moon occurs on friday the 13th, the application will just hang at that line when loading. Its like 1 out of 30 times, sometimes it happens like 2 times after another, sometimes it doesn't happen at all for like a week. Now I'm using unordered map in this fashing EVERYWHERE throughout my program, and it only ever fails on this very exact line, so I can't really make sense of it (and surely as won't you). So I'll try to give everything I have in the hope somebody notices anything strange here.


First, here is an image of the callstack of where this is actually happening inside the map. Its like 5 more lines than my monitor can print out, so yeah...

Attached File  Callstack.png   1.06MB   0 downloads


Now as for the actual place of the infinity loop, there is no one place, but partially here:

template<class _Alloc> inline
	void _Destroy_range(typename _Alloc::pointer _First,
		typename _Alloc::pointer _Last, _Alloc& _Al,
	{	// destroy [_First, _Last), arbitrary type
	for (; _First != _Last; ++_First) // HERE

These are the values for first and last at some random iteration I stopped:


_First = 0x1e4aef84 {...}

_Last = 0x1f310040 {...}


Now (in debug) it takes like 5 seconds for this loop to complete, after which it just "randomly" jumps around reinsert-functions etc... until it finally lands at this function again... its totally f*cked up.


As for whats actually being inserted, there is only one element in the map beforehands, which is called ""EditorGuiInput". The element being inserted (it always seems to happens on the same element) is called "GuiInput". This is the only similarity I noticed between them, and if somebody could point out any reason why this would cause this, I'd be glad.


The calling code is unlikely to be an issue since this changed drastically from since I first had that issue to now. First it was a simple XML-parse, now its part of my sophisticated asset system, where the external call looks like this:

sys::Pointer<Handler> InputHandlerAssetLoader::OnLoad(std::string stData)
    const auto& stName = GetCurrentAssetName();
    auto pHandler = m_pModule->AddHandler(stName);

    // ...    

Aside from that, I really don't have any more information. I can give you some things I indirectly tried that didn't work: I had a raw pointer instead of that smart pointer type before. I'm also pretty sure I had a regular map at first because I saw a integer-counted loop with i being -XXXXXXX the first time this happened to me, but I wouldn't bet on it (would make things even more f*cked up, would it). So lets just assume it happens just with unordered_map. I also have the most current update for MSVC (had some problems with this before that are now fixed, so definately not the case). It also happens on multiple machines, 3 to count, one with Windows 7, one Windows 8 and the last one Windows 8.1, so yeah. Also ran application verifier to check for heap corruption but at least for the times I ran this didn't normally happen, it didn't catch anything.


Now, I hope I have given you a good overview of whats going on. As you can see, I'm pretty much lost on being able to debug anything since the code lies way out of my control and there is no real pattern that I could inspect (I'm not going to debug through 100 callstack entries of STL code, ugh). Now I want to ask you, if you have any idea on what could be going on, especially since this bug is so damn sporadic, but always happens in the same place. ANY input would be highly appreciated, from experience based to blindly quessing in the air. Thanks in advance...


PS: You might ask "why don't you just use a regular map?" Well for once I have this feeling that this has happened with a regular map before, for whatever weird reason, and also I'd really damn well like to know what causes this in the first place, before I go change the data structure to a vector with manual search if everything else fails...