www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - rfc bread and butter dod data structure

reply monkyyy <crazymonkyyy gmail.com> writes:
Im looking into dod datastructures again

As I said elsewhere I dont believe aosoa is reasonably possible 
without compiler support; however while such packing is likely 
rather important in some cases, its not the entirity of dod 
thought.

consider:

1. batched deletions
2. tagged structs instead of classes
3. bool packing flags
4. radix sorting from user functions(such as sorting objects by 
grid for faster collision checks)
5. indexes over 64 bit pointers

I believe I can make this api work:

```d
import mkydata;
struct shape_(P){
   float width,height;
   float x,y;
   float xv,yv;
   P following;//where P is a magic "pointer", index
}
//struct dodarray(alias T,int i,string[] flags=[],int 
line=__LINE__,string file=__FILE__)
dodarray!(shape_,1000,["isstatic","isdead","iscircle","isrectangle"]) shapes;
alias shape=shapes.value;
alias shapeenum=shapes.enum;
void draw(shape s){
   if(s.isalive){
     if(s.iscircle){
       DrawCircle(...);
     }
     ...
     if(s.follow != null){
       DrawLine(...,s.follow.x,s.follow.y,...);
}
void boundscheck(){
   foreach(s;shapes){
     if(s.x<0||s.x>1080){
     if(s.y<0||s.y>1080){
       s.isdead=true;
}}}
void moveshapes(){
   foreach(s;shapes.filter(isnt:shapeenum.isstatic){
     s.x+=s.xv;
     s.y+=s.yv;
}}
void deletedeadshapes(){
   shapes.deleteby(has:shapeenum.isdead);
}
```

I think the dod book sucks, and I think the rust "database driven 
videogame" guy is a uncle bob conartist. But are there other 
ideas I should keep in mind?

Has there been any good dod talks in the last few years?
Jul 15
parent reply Kapendev <alexandroskapretsos gmail.com> writes:
On Tuesday, 15 July 2025 at 21:41:33 UTC, monkyyy wrote:
 Has there been any good dod talks in the last few years?
No. The only good one is the CppCon 2014 video.
Jul 15
next sibling parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Wednesday, 16 July 2025 at 01:21:59 UTC, Kapendev wrote:
 On Tuesday, 15 July 2025 at 21:41:33 UTC, monkyyy wrote:
 Has there been any good dod talks in the last few years?
No. The only good one is the CppCon 2014 video.
well chop chop youtuber
Jul 15
parent Kapendev <alexandroskapretsos gmail.com> writes:
On Wednesday, 16 July 2025 at 02:08:24 UTC, monkyyy wrote:
 On Wednesday, 16 July 2025 at 01:21:59 UTC, Kapendev wrote:
 On Tuesday, 15 July 2025 at 21:41:33 UTC, monkyyy wrote:
 Has there been any good dod talks in the last few years?
No. The only good one is the CppCon 2014 video.
well chop chop youtuber
I'm not making a dod video. Will do it for 15€ tho. The thing that I might do is rant about ECS.
Jul 16
prev sibling parent monkyyy <crazymonkyyy gmail.com> writes:
On Wednesday, 16 July 2025 at 01:21:59 UTC, Kapendev wrote:
 On Tuesday, 15 July 2025 at 21:41:33 UTC, monkyyy wrote:
 Has there been any good dod talks in the last few years?
No. The only good one is the CppCon 2014 video.
https://www.youtube.com/watch?v=wo84LFzx5nI smh I cant believe you lied on the internet
Jul 17