Re: Reworking the control flow for my tactical role-playing game

2024-03-25 Thread harakim via Digitalmars-d-learn
On Saturday, 23 March 2024 at 22:37:06 UTC, Liam McGillivray wrote: ...a tick system would go hand-in-hand with making animations happen in a separate thread, but it sounds like you're talking about the same thread. Are you suggesting a fixed framerate? I have done both ways. If you're new to pr

Re: Reworking the control flow for my tactical role-playing game

2024-03-24 Thread Liam McGillivray via Digitalmars-d-learn
On Saturday, 23 March 2024 at 04:32:29 UTC, harakim wrote: * You should probably not do this, but it might give you some ideas for later. What I would do is make a separate thread for managing the UI state and push events to that thread through the mailbox. I have done this once (on my third ve

Re: Reworking the control flow for my tactical role-playing game

2024-03-23 Thread Liam McGillivray via Digitalmars-d-learn
On Saturday, 23 March 2024 at 23:59:18 UTC, Liam McGillivray wrote: I replaced `destroy(unit)` with `map.deleteUnit(unit)`, and it solved the problem. Nevermind. It turns out this was because the call to the Unit destructor was missing in `Map.deleteUnit`. The segfault happens whenever a unit

Re: Reworking the control flow for my tactical role-playing game

2024-03-23 Thread Liam McGillivray via Digitalmars-d-learn
On Saturday, 23 March 2024 at 04:32:29 UTC, harakim wrote: This comment points to a symptom of the circular dependency: //Always set `destroy` to false when calling from the Unit destructor, to avoid an infinite loop. I was just doing some work on the AI system, and I had a segfault every time

Re: Reworking the control flow for my tactical role-playing game

2024-03-23 Thread Liam McGillivray via Digitalmars-d-learn
On Saturday, 23 March 2024 at 04:32:29 UTC, harakim wrote: You should engineer the system in a way that makes sense to you. The currency of finishing programs is motivation and that comes from success and believing you will succeed. If you're implementing XYZ pattern from someone else, if you d

Re: Reworking the control flow for my tactical role-playing game

2024-03-22 Thread harakim via Digitalmars-d-learn
I am not an expert but I would second the tick system. That is pretty solid advice. Just iterate through your events or, in your case, units and such objects and update them all. Then draw. Then go to the next tick. You should engineer the system in a way that makes sense to you. The currency

Re: Reworking the control flow for my tactical role-playing game

2024-03-21 Thread Liam McGillivray via Digitalmars-d-learn
On Thursday, 21 March 2024 at 16:48:39 UTC, Steven Schveighoffer wrote: On Sunday, 17 March 2024 at 00:14:55 UTC, Liam McGillivray wrote: As many of you know, I have been trying to write a tactical role-playing game (a mix of turn-based stategy & RPG) in D. This is the furthest I have ever gott

Re: Reworking the control flow for my tactical role-playing game

2024-03-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 17 March 2024 at 00:14:55 UTC, Liam McGillivray wrote: As many of you know, I have been trying to write a tactical role-playing game (a mix of turn-based stategy & RPG) in D. This is the furthest I have ever gotten in making an interactive program from the main function up. Right now

Reworking the control flow for my tactical role-playing game

2024-03-16 Thread Liam McGillivray via Digitalmars-d-learn
As many of you know, I have been trying to write a tactical role-playing game (a mix of turn-based stategy & RPG) in D. This is the furthest I have ever gotten in making an interactive program from the main function up. Right now, it is not yet playable as a game, but you can interact with it a