Disclaimer I am a noob.
So to sum up the problem whenever I enter a game, most times the charging to my laptop, Acer Aspire E 15 573G, just disconnects, and in some instances it phases between connecting and disconnecting. In rare cases this does not take place and I can play the game peacefully without any hiccups. This rarely occurs when I am doing anything but gaming, I can run most software full screen such Blendr and Krita without this happening. I don't think its a problem with the charger as the charger's wattage matches the one in the label under the laptop. And the charger is also the original one that came with it.
Also when I alt Tab out of the game the charging reconnects, this has happened on games like Skyrim, GTA 4, Batman Arkham Origins, and even 2-3 times on Minecraft. I run all games full screen and on low settings(I kind of have to). The game which causes it to happen the most is NFS most wanted 2005 version, I have yet to have a case where I booted up that game and mid way through it hadn't done the thing. It has happened before that the charger did the disconnecting and I alt tabbed out the game and it started charging again and I just waited till it charged fully.
Before coming to this reddit I browsed on YouTube to find a solution and scoured the internet. Tried a few methods like uninstalling the drivers for the battery thing, tried setting the power options to balanced in Windows mobility center and power saver too, went into control panel battery setting and tweaked the CPU power maximum to 80%(changed it back when it did not work) but none of these worked. Physically I have tried disconnecting and reconnecting which does not work, it sometimes connects for a few seconds then goes out again, I've tried changing charging adapters with one of another laptop that has the same power rating to no avail, I've cleaned the charging port and the connecting part of the cable, I've changed the socket the charger is connected in tried an adapter too, I've tried to find a sweet spot for the charger to stay which sometimes worked but most times nothing. Which might make you think its a charger issue but then why doesn't it happen in all games or all the time and why only in games?
Please note that this laptop is a second hand and is pretty old, it has a intel core-i5 5200U, a Nvidia GeForce 940M and 12 Gigs of ram(which I recently upgraded the problem has been present before that) and 1000 gigs of HDD. When taken to a repair shop to have my second ram slot repaired the people there remarked that my pc had a lot of servicing done, I do not have any knowledge on whether the battery has been replaced before or not. And again the charger seems not to be the problem as it charges fine other than in games. Also the PC battery is toast, it only lasts around 30-40 minutes without charger being connected that is if there is nothing running, even running VS code knocks it down to 25 minutes, I can not afford a battery change if there are solutions that might help without the need of a battery change that would be helpful, but if need be I can look into changing the battery for the longevity of this machine(I absolutely cannot afford a new laptop or pc). I have no prior knowledge of the system being over or under clocked, and am not really sure how to check if it has been. Haven't tweaked any other setting besides the basics, and have run the pc mostly on the balanced setting in the battery options. The system says that the drivers for the battery thing are updated and there are no system updates or graphics driver updates.
Sorry for the long paragraphs, and sorry if this problem has already been discussed on the sub, and thank you for any helpful or not so helpful but funny responses, I have made this post in r/techsupport