Thylacine Studios - Forum

one core cpu use  (Read 1186 times)

Offline bluequakeralex

  • *****
  • Posts: 603
    • View Profile
Re: one core cpu use
Reply #4 November 30, 2016, 07:01:18 PM
Thanks Wulfe for the info about lists and arrays. 
Thanks Zack for explaining the underlying performance issues along with the history behind them.   

What's left on the todo list for the game for me.
* purchase IAPs
* complete all achievments
* card hunting
* realm pushing until I get bored waiting / enemy strife


Offline Zack

  • Administrator
  • *****
  • Posts: 3370
    • View Profile
Re: one core cpu use
Reply #3 November 30, 2016, 05:52:50 PM
Performance issues in Siralim 2 are the result of four major issues:

1) It's based on code from Siralim 1, which was my first game. It was literally the first game-related project I ever touched, and the sloppy, poorly optimized code tends to catch up to the game after a while. I've made as many optimizations as possible since then, but some things simply can't be fixed without obliterating your save files.

2) GameMaker itself is poorly optimized...to an extent. GameMaker 2 is in beta testing right now and will be released toward the start of next year, and has way better performance. All future games will be created with GameMaker 2, and a fresh code base (to alleviate problem #1). As an added bonus, GM2 is a lot easier to work with, so I look forward to being able to release content more quickly and with FAR fewer bugs/crashes.

3) GameMaker has two compilers to choose from: the default compiler (extremely slow) and what they call the YoYo Compiler (YYC - ultra fast). The YYC is awesome and would alleviate all performance issues, but it was released long after Siralim came out. If you don't build your game with YYC in mind from the onset, you're just asking for all kinds of horrible bugs to spring up out of nowhere. Therefore, we're stuck with releasing executables compiled by the default compiler.

4) Siralim has no inventory limits, stable limits, or any other limits for that matter. I can't think of too many games without these limits, and now we all know why that's the case - no matter how powerful your computer is, you're eventually going to reach a point where there are just too many objects in the game. This is something I will need to keep in mind for future games.
Designer and Programmer of Siralim and The Negative. Follow us on: Facebook | Twitter | YouTube

Offline Wulfe

  • **
  • Posts: 77
    • View Profile
Re: one core cpu use
Reply #2 November 30, 2016, 05:41:53 PM
Multi-threading is probably something Zack will not be able to implement, since the game is built using Game Maker Studio. The GMS people would have to implement support for it, and the chances are somewhere between not likely and not a chance.

You posted a link to an article about lists vs. arrays in Game Maker in the shoutbox, right? I read that, and I do believe that's the primary performance issue the game has. It explains the constant decrease in performance, and the slight temporary boost from reloading(clean, fresh loaded lists).

Note: This all is based on the assumption that lists are the primary data structure being used in Siralim.

Lists are generally versatile data containers, allowing for quick and easy insertion and removal of items, but they have certain limitations when it comes to performance, primarily involving random access. Parts of an individual list can be spread throughout the memory in chunks. To find a specific item in such a list(when you don't already have a reference to its location) requires traversing each item and reading an attached pointer to the next item, over and over until it's found. This can quickly become a huge overhead as the list grows bigger, as not only does this require extra cou effort in general, it also limits the cpu's ability to read ahead and cache data.

Use of arrays would alleviate some of these issues. Arrays are contiguous blocks of memory though, and have to be allocated ahead of time. Either hard limits on items, stables creatures, etc. would be required, or... resizing would be required, which involves making a whole new array that's bigger, and then copying the old one into it. This would cause rsther long lags on occasion. And changing things would take a lot of work. But, it would lead to an overall performance boost.

TL;DR; lists r slow n easy, get slower n slower. arrays r hard but faster, take much work 2 switch 2
Device: Samsung Galaxy Tab 4 - SM-T237P, Android 5.1.1
Game version: 2.3.2

Offline bluequakeralex

  • *****
  • Posts: 603
    • View Profile
one core cpu use
Reply #1 November 29, 2016, 08:52:52 PM
Siralim 2 never uses more than around 25% cpu usage.

I think it is only using one of my four cpu cores (dual-core hyper threaded).  Since when I limit it to one core the cpu usage stays the same along with the overall performance.

Could possibly speed up the game if it were using all of the cores.