Page 257 of 259

Re: What are you working on?

Posted: Sun Jan 20, 2019 7:58 pm
by Spike
y o u s h o u l d p r o b a b l y d o s o m e t h i n g a b o u t a l l t h e e x t r a n e o u s s p a c e s , t h e y k i n d a m a k e i t h a r d t o r e a d .

I'm not saying variable-width nor ttf fonts (which are fun, but messy), just that non-square glyphs would really help readability (though perhaps not with CJK glyphs).

Re: What are you working on?

Posted: Mon Feb 11, 2019 5:34 am
by Shpuld
Been working a bit on procedural level generation for something roguelite-ish. I first have it generate a 4x4 layout of meta-tiles using a somewhat simple algorithm that guarantees levels that aren't too simple and never have too long dead ends, and going to the exit never requires the player to go south by design.
Image

then after this step the map itself is filled with actual tiles based on the meta-tiles. each meta-tile represents just a basic shape (straight, corner, t-junction, dead-end), and I'm planning on having a good amount of pre-made 8x8 tile layouts for each meta-tile shape, so it can just pick those randomly to generate the actual level. I haven't gotten this far yet, but I started making my own tile editor for these 8x8 shapes
Image

Re: What are you working on?

Posted: Fri Feb 15, 2019 8:43 pm
by Shpuld
Continued from the previous post:

I improved the tile editor for the meta tiles, now you can save save and load tile sets, pick which category, and which variation of that category you are editing. still some minor bugs in it, and in the future I'll have more than just wall/not-wall as paintable types, like enemy and item placements.

Here's a video of it in action: https://i.imgur.com/YpeWenk.mp4


Then I implemented filling an actual map grid using both the meta tile map (in the first gif in the previous post) and a tile set created with the tile editor, spawning block entities in server qc for each tile and set their model/solid accordingly.

Image

Re: What are you working on?

Posted: Wed Feb 20, 2019 8:41 pm
by Shpuld
Continuing from the last 2 posts, you can see the procedurally generated map in action in a top down shooter form, just with no enemies or anything yet.
I did write a custom lighting system that works by rendering these circular light meshes on a texture and then overlaying that texture on top of a fullbright scene, works surprisingly nicely (but only in top down/2d-style views).

Video: https://streamable.com/1urkb

Re: What are you working on?

Posted: Sun Feb 24, 2019 5:48 pm
by Shpuld
More progress with the same project. The map is now completely rendered using FTE's trisoup drawing instead of one entity per block, so I write all the map geometry vertices and indices in QC and when rendering I can draw the entire level with a single call (not counting actual entities like the player). This gives me a lot of control and in theory at least it should also be very fast. I also implemented a system to pick the correct texture for that particular block, so corners, walls, etc, all have the correct texture applied to them.

Image

Re: What are you working on?

Posted: Mon Feb 25, 2019 11:11 pm
by frag.machine
How about the collision between the trisoup and the AABB entities ? I am very interested on this approach.

Re: What are you working on?

Posted: Tue Feb 26, 2019 12:47 pm
by toneddu2000
Outstanding work, man! Could you please describe how to use FTE's trisoup drawing, because I tried but I couldn't manage how to do it

Re: What are you working on?

Posted: Tue Feb 26, 2019 5:17 pm
by Shpuld
How about the collision between the trisoup and the AABB entities ? I am very interested on this approach.
The trisoup is purely for visuals, kinda like R_BeginPolygon, but with way less built-in spam, which should make it potentially much much faster. The collision in my case is handled with entities that are created on the server and the entities also tell exactly what types of blocks there are for the client so it knows how to draw the level using the trisoups.
Outstanding work, man! Could you please describe how to use FTE's trisoup drawing, because I tried but I couldn't manage how to do it
Thank you! Yeah I can go through it real quick here, Spike will hopefully clarify if I make mistakes.

1. Allocate memory for the vertex buffer (just an array of vertices), you could do this by just having a large array as a global but it slows down compilation a lot so I use memalloc and store the result in a global pointer.
You can use memalloc to allocate a vertex buffer like this:

Code: Select all

trisoup_simple_vert_s * my_vertex_data = (trisoup_simple_vert_s*)memalloc(sizeof(trisoup_simple_vert_s) * NUMBER_OF_VERTS);
2. Generate values for the vertices, the vertex is defined like this

Code: Select all

typedef struct trisoup_simple_vert_s {vec3 xyz;vec2 st;vec4 rgba;} trisoup_simple_vert_t;
The vec2, vec3 and vec4 are just float arrays of those sizes. You can setup a triangle (with default [1, 1, 1, 1] color like this:

Code: Select all

my_vertex_data[0].xyz[0] = 0
my_vertex_data[0].xyz[1] = 0;
my_vertex_data[0].xyz[2] = 0;
my_vertex_data[0].st[0] = 0;
my_vertex_data[0].st[1] = 0;

my_vertex_data[1].xyz[0] = 0
my_vertex_data[1].xyz[1] = 0;
my_vertex_data[1].xyz[2] = 100;
my_vertex_data[1].st[0] = 0;
my_vertex_data[1].st[1] = 1;

my_vertex_data[2].xyz[0] = 100
my_vertex_data[2].xyz[1] = 0;
my_vertex_data[2].xyz[2] = 0;
my_vertex_data[2].st[0] = 1;
my_vertex_data[2].st[1] = 0;

3. You also need the index array which is integers, and the size of it should be the same as the number of triangles you want to draw. The indices is the indices of the vertices in the vertex buffer to link to create triangles, so indices [0, 1, 2] will draw a triangle that connects first, second and third vertex in the buffer. In my case I just allocated and generated a list that goes from [0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ] for a nice quad pattern.

4. Draw the stuff, this is the only step you actually need to do every frame, use the builtin like this:

Code: Select all

// Definition:
// void(string texturename, int flags, struct trisoup_simple_vert_s *verts, int *indexes, int numindexes) addtrisoup_simple = #0:addtrisoup_simple;
// Usage:
addtrisoup_simple("my_shader", 0, my_vertex_data, my_indices_data, num_indices);

Re: What are you working on?

Posted: Wed Feb 27, 2019 1:27 am
by frag.machine
Shpuld wrote:
How about the collision between the trisoup and the AABB entities ? I am very interested on this approach.
The trisoup is purely for visuals, kinda like R_BeginPolygon, but with way less built-in spam, which should make it potentially much much faster. The collision in my case is handled with entities that are created on the server and the entities also tell exactly what types of blocks there are for the client so it knows how to draw the level using the trisoups.
Ahh, I see. You are just skipping the overhead of drawing individual models, but you still have one entity representing the tile, right ?
Thanks for the explanation, shpuld.

Re: What are you working on?

Posted: Wed Feb 27, 2019 8:20 am
by Shpuld
Yeah that's basically the idea, technically there's no entity used at all for the trisoup, just data in arrays and one built-in func call per updateview. So instead of drawing X*Y amount of models, it just draws one mesh that I created when the map data was received from the server. The fact I generate it "on the fly" means I can also customize it to my liking, picking the correct UV coords, maybe translate the vertices to make it look more organic, some vertex colors to alter color to make it "dirtier" or whatever I want

Re: What are you working on?

Posted: Wed Feb 27, 2019 12:22 pm
by toneddu2000
Thanks a lot Shpuld, really helpful! I'll definately try this out!

Re: What are you working on?

Posted: Fri Mar 01, 2019 3:54 pm
by Shpuld
I'm always glad to help!


Some more progress! The tile editor can now place some entities and different tile types on the preset 8x8 meta tiles. The UI of the editor has evolved with it.

Image


I also made another set of textures for the tiles, to better represent what can be done and reflect the mood I'm going for in the game. (The lights are still completely randomized and not from the tile presets, that will come later)

Image


And here's the actual texture itself, since it's pretty small it's quick to whip out new tile styles and entire tile sets hopefully,

Image

Re: What are you working on?

Posted: Sat Mar 02, 2019 11:40 am
by toneddu2000
very very nice work!

Re: What are you working on?

Posted: Thu Apr 25, 2019 6:33 am
by Shpuld
Next (this) weekend is another Ludum Dare and I'm taking part again and streaming it at https://www.twitch.tv/shp__ for those who are interested

Related to that, I put out the UI lib I used for my previous LD game as well as the game I've been working on that I posted about in the previous posts in this thread, it's called SUI and you can find it here: https://github.com/shpuld/sui-qc (Actually the code is a new empty menuqc+csqc+ssqc template with SUI preinstalled)

It still needs more documentation but it's been serving me well already in its current state. After I've documented the API and made more examples of how to do some interesting things with it, I'll make a proper thread for it I guess.

Re: What are you working on?

Posted: Thu Apr 25, 2019 9:05 am
by toneddu2000
oh boy oh boy oh boy, can't wait to see your game! :biggrin:
sui-qc seems a good addition, look it up!Have you tried my CUI (craFTEr User Interface)?
It's not advanced like yours (it needs to create for every ui element a quake entity, so..) but I'd like to hear your thoughts

Good luck for your next ld! :biggrin: