Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Vapourware Codexian Game Development Thread

Developer
Joined
Mar 14, 2023
Messages
13
I'm working on this C64 styled fantasy adventure game.
Let me know what you think.
Looks awesome! I like the original combat approach mixed with the Realms of Arkania style travel.
Thank you!! Spot on with Realms of Arkania, it's what I liked most about the game (apart from endless character generation).
Hope to release it before the year ends, you can wl it on steam already
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,509
Location
Poland
Strap Yourselves In Codex Year of the Donut
I've implemented the list of tile neighbors for A*. It's a bit complicated because tiles need to be subdivided to allow for fine-grained NPC behavior. It was a bitch due to variable character bounding box sizes, wrongly computed formulas, multidimensional indexes etc.

What I noticed really helps is visualizing problems in images. With math, writing it down makes you analyze it and commit it to long-term memory. It works like that when drawing lines, points and text on a grid in a paint program too apparently.

astar-subdivide.png


Now going from that to a bunch of unit tests is trivial. Damn thing took long enough to get all the offsets right.

1696510565999.png

1696510830554.png
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,509
Location
Poland
Strap Yourselves In Codex Year of the Donut
I tend to use static builds and LTO which don't have a stable ABI to begin with. They allow for more optimization and overall smaller binaries.

When building with MSVC, using -MT is ABI-incompatible with -MD when passing STL types across the shared library boundary. So you just learn how to rebuild everything with the correct runtime, then you can do that with LLVM on Windows, on Linux and OSX too with LD_LIBRARY_PATH and install_name_tool, respectively.

MSVC is a particular pain in the ass in terms of breaking the ABI, sometimes defaulting to compatible behavior rather than standards conformance:
Code:
    add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
    add_definitions(-D_ENABLE_ATOMIC_ALIGNMENT_FIX)
Code:
// not supported with MSVC v14x ABI, see https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/
#define myproject_no_unique_address msvc::no_unique_address

I'd rather ship my own libc++ with the program binary than make any sacrifices to performance or correctness.
 
Last edited:
Developer
Joined
Oct 26, 2016
Messages
2,284
I tend to use static builds and LTO which don't have a stable ABI to begin with. They allow for more optimization and overall smaller binaries.

When building with MSVC, using -MT is ABI-incompatible with -MD when passing STL types across the shared library boundary. So you just learn how to rebuild everything with the correct runtime, then you can do that with LLVM on Windows, on Linux and OSX too with LD_LIBRARY_PATH and install_name_tool, respectively.

MSVC is a particular pain in the ass in terms of breaking the ABI, sometimes defaulting to compatible behavior rather than standards conformance:
Code:
    add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
    add_definitions(-D_ENABLE_ATOMIC_ALIGNMENT_FIX)
Code:
// not supported with MSVC v14x ABI, see https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/
#define myproject_no_unique_address msvc::no_unique_address

I'd rather ship my own libc++ with the program binary than make any sacrifices to performance or correctness.
How many NPCs can it handle at once?
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,509
Location
Poland
Strap Yourselves In Codex Year of the Donut
Some general stats like,
How many animated units can be rendered in a scene?
How many animated moving units in a scene?
Once I implement animated looped scenery then I can give you a precise answer.

There's still the choice of optimizing for bandwidth (minimizing VBO uploads) or optimizing for the least amount of draw calls. I'm likely going to have lots of static scenery and that means interleaved drawing from multiple VAOs rather than collecting to one big VBO and drawing it all at once. So that's going to optimize for uploads and draw calls of static objects, but drawing too many animations in between them may become a problem.
 
Last edited:
Developer
Joined
Oct 26, 2016
Messages
2,284
Some general stats like,
How many animated units can be rendered in a scene?
How many animated moving units in a scene?
Once I implement animated looped scenery then I can give you a precise answer.

There's still the choice of optimizing for bandwidth (minimizing VBO uploads) or optimizing for the least amount of draw calls. I'm likely going to have lots of static scenery and that means interleaved drawing from multiple VAOs rather than collecting to one big VBO and drawing it all at once. So that's going to optimize for uploads and draw calls of static objects, but drawing too many animations in between them may become a problem.
Although I can have 1000s of animated units standing still, I can't have more than 50 animated units moving at once without frame drop RN due to the way I implemented the shader for isometric drawing.

Basically I have to calculate on the CPU the depths, and share that information to the pixel shader. I don't really know how I can optimize that into the shaders because the shaders would need to share the information.

I can only think of some cheats to do optimization at the moment, like remove sorting for some parts of the scene. I am thinking about this problem.
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,509
Location
Poland
Strap Yourselves In Codex Year of the Donut
Basically I have to calculate on the CPU the depths, and share that information to the pixel shader. I don't really know how I can optimize that into the shaders because the shaders would need to share the information.
Depth should be derived from position.

If you want to look at my code then send a PM.
 
Developer
Joined
Oct 26, 2016
Messages
2,284
Basically I have to calculate on the CPU the depths, and share that information to the pixel shader. I don't really know how I can optimize that into the shaders because the shaders would need to share the information.
Depth should be derived from position.

If you want to look at my code then send a PM.
For simple sprites like units thats fine.
But its not so simple in my game because objects can be quite large and complex, this would break any sorting by single coordinates.
So sorting needs to be done at a pixel level.
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,509
Location
Poland
Strap Yourselves In Codex Year of the Donut
Depth should be derived from position.

If you want to look at my code then send a PM.
For simple sprites like units thats fine.
But its not so simple in my game because objects can be quite large and complex, this would break any sorting by single coordinates.
So sorting needs to be done at a pixel level.
You can still slice them across tile boundaries. Doing per-pixel stuff on the CPU is too prohibitive in a render loop.
 
Developer
Joined
Oct 26, 2016
Messages
2,284
Depth should be derived from position.

If you want to look at my code then send a PM.
For simple sprites like units thats fine.
But its not so simple in my game because objects can be quite large and complex, this would break any sorting by single coordinates.
So sorting needs to be done at a pixel level.
You can still slice them across tile boundaries. Doing per-pixel stuff on the CPU is too prohibitive in a render loop.
Ok I will take a look at the code.
 

beardalaxy

Educated
Joined
Jun 10, 2023
Messages
117
Congratulations! That must be a good feeling. Your games have a very unique look to them, kind of reminds me of Tron in a way. Just that really old school wireframe look is awesome.

I finally got to the point where I need to develop my Inn system in order to finish up a quest and an NPC. There are two ways I could go about doing it, and I wanted to ask you guys for your opinion.

The first option is that you talk to the innkeeper, pay him your gold, then the screen fades out and your party is fully recovered with the time passing from day>night or night>day. The benefit to this option is that it is very simple to program and gets the player in and out quick to spend more time doing quests/grinding/what have you. The downside is that it isn't as immersive as the second option. A good example of a game that uses this system is Breath of the Wild/Tears of the Kingdom.

The second option is that you talk to the innkeeper, pay him your gold, and then he tells you which room you're staying in. You have full control over the character to walk over to that room and then you click on the bed, which will recover your party and pass the time in the same way the first option does. The benefit to this option is that it is more immersive. The downsides are that it is a little bit harder to program (but not by much) and the player may get tired of needing to walk over there and back every time. A good example of a game that uses this system is Skyrim.

The context as to what type of genre the game is: classic 2D RPG inspired by the likes of Dragon Quest and Final Fantasy.

Personally, I prefer the first option just because I do get tired of having to walk to the room every single time. It wouldn't be as egregious as it is in Skyrim where you have to follow an NPC around to get to your room, but going back and forth every time could get tedious and I prefer functional systems over fancy ones at the end of the day. It seems, at least from my (admittedly limited) experience, that most games tend to go for option 1. I'd like to hear your opinions though to see which one you like better and, more importantly, WHY.
 

Tavernking

Don't believe his lies
Developer
Joined
Sep 1, 2017
Messages
1,264
Location
Australia
Implemented a basic crime system over the last few days. Each crime has a victim, instigator and evidence. NPCs can perceive crimes via sight or sound, but also discover evidence of crimes such as blood on the floor or a bashed down door. When perceiving a crime or discovering evidence, they decide whether they actually care by checking the victim's faction and the instigator's faction. Investigation of evidence is done by wandering around the evidence, and making some calculations to decide whether to pin the crime on you or not. Right now investigators can't accidentally falsely accuse other random NPCs for the player's crimes, but that would be a cool extension. Feature creep though, since the crime/evidence system isn't meant to be a big part of this game.
 
Developer
Joined
Oct 26, 2016
Messages
2,284
Implemented a basic crime system over the last few days. Each crime has a victim, instigator and evidence. NPCs can perceive crimes via sight or sound, but also discover evidence of crimes such as blood on the floor or a bashed down door. When perceiving a crime or discovering evidence, they decide whether they actually care by checking the victim's faction and the instigator's faction. Investigation of evidence is done by wandering around the evidence, and making some calculations to decide whether to pin the crime on you or not. Right now investigators can't accidentally falsely accuse other random NPCs for the player's crimes, but that would be a cool extension. Feature creep though, since the crime/evidence system isn't meant to be a big part of this game.
When I'm bored I also tend to add new features not in the original scope.

I like that idea regarding crime.

My crime system is currently, if a player picks up an owned item, then whomever witnesses this act (any NPC looking in the field of view - player stealth factor), then their opinion of the player reduces by the value of that item.

If their opinion of the player goes below zero, the player is considered hostile and will attack, triggering combat mode.

Depending on the distance to the "crime" any other NPC may side with the player or NPC witness. I.e. if an NPC just sees the player as a victim they will side with the player.

Probably I need to add another factor to affect whether the 3rd party NPCs side with the player or the witness NPC, which will probably faction or reputation based. Player already has a global reputation, so if the NPC sees the player as more prestigious than the witness it would make sense to side with the player.
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.


Added sectors in Little Immersive Engine. Later these will be used to generate portals for visibility, among other things, but for now they only provide "environment boxes" in the scene which are used to calculate the rendering environment settings. These settings are calculated by blending the global scene environment settings with the settings specified in each environment box the camera is inside or near (the blending factor is based on the distance from the box, this is configurable per sector with a default value set to 2 meters and the environment box can have its own factor while environment settings can also specify which parameters they will affect - so e.g. a box can only affect ambient color without affecting fog parameters). In the video above i move in and out of a sector with different settings than the global environment to test the blending.

Later i will also add boxes which are only meant for changing environment settings independent of sectors as well as store environment settings in reusable assets with a dedicated editor, but since i expect sectors to overlap with environment boxes i decided to also add those directly in the sector element instead of making a separate element for that.

Currently the environment settings only specify ambient color, tint color and distance fog parameters, though later i'll add more stuff as i implement more features in the renderer.
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.




Implemented portal-based visibility in the engine to replace the hacky occlusion queries-based one (might use occlusion queries for the main view portals in the future if i need more precise culling though). The first video is from when i did the implementation before i removed the hacked-in debug shapes to show the portal projections on screen and the sectors being marked as visible or not (red=visible, blue=invisible).

In the second video i copy/pasted the few rooms from the first video a bunch of times to stress test it a bit and then flied around the rooms through the openings. In the second video the engine also uses the visibility information calculated from the camera to cull invisible lights and shadow updates do their own calculation (so that a bright light next to a wall wont attempt to render shadows for objects behind the wall - well, at least assuming the light and the objects are in different sectors anyway).

One neat bit about sectors is that the connectivity information is calculated as part of the world data itself and fed to the renderer instead of the other way around, so it can be used not only for rendering but for anything that can make use of it - like propagating sound or gameplay "data" (like smells).
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.


This is a quick hack with ambient lighting to avoid having it look completely flat when there are no lights affecting an area at all, which is something that happens in many games out there. Basically environments can specify two options to avoid it:

  • Shadow fading - this basically fades out a shadow, causing the light to slightly come through. It really only works with very small amounts of fade out (e.g. 0.985 which is the default). You basically get directed fake ambient lighting from this (or at least with barely any computation cost after you have taken the massive computation hit that is shadows anyway :-P)
  • Ambient light direction with separate dark and light colors - this adds a direction to the explicitly defined ambient light even if no lights (with or without shadow fading) affect an area which allows detail from normal maps to still be readable. The separate colors allow to add some color to the ambient light and darkness. The ambient light direction can be rotated to match whatever mood the area is supposed to have.
Since these are part of the environment settings they can be blended with other environments - e.g. a setting can be specified for the whole level and some sectors that need to be darker, lighter or more or less colorful can override just these parameters and the engine will blend between them as shown in the previous videos.

Of course these are hacky as fuck, the proper solution would be to implement some sort of global illumination system, but on the other hand they'll run even on an igpu from ten years ago :-P.
 
Joined
Dec 24, 2018
Messages
1,898
Impressive pace of work, Bad Sector.

Of course these are hacky as fuck, the proper solution would be to implement some sort of global illumination system, but on the other hand they'll run even on an igpu from ten years ago :-P.

Computer graphics is 50% illusion anyways. I'll take a system that uses trickery to look pretty good and run with low requirements over something that does it "the right way" but requires shittons of computing power any day.
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.
Computer graphics is 50% illusion anyways. I'll take a system that uses trickery to look pretty good and run with low requirements over something that does it "the right way" but requires shittons of computing power any day.

Yeah my goal is for the engine to run on my Steam Deck at solid 60fps at "medium settings" (i.e. not everything cranked up high, but not lowest settings either), preferably at a lower-than-default TDP (for battery life).

Last year or so i also tried the engine on the PC i had in the mid-2000s which had an Athlon64 X2 and a Radeon X1950 Pro and it worked at 640x480 at ~30 fps with the lowest settings:

m0pWioN.jpg


Disabling shadows ran at 65 fps but everything was much brighter. I haven't tested the engine on that machine recently because i have a bunch of crap surrounding it and can't use it :-P. Assuming i haven't broken the shader compatibility, it should run better now since at the time occlusion culling wasn't precise and shadows didn't use culling at all.

But of course that's just for my own amusement, i don't think anyone would actually try to play a new game on a mid-2000s PC. At least not for another decade or so until more people consider it retro tech :-P.
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.


Graphics programming is neat but tools need more work, so i improved the transformation manipulator a bit to make it flip the axes so they always face the camera, show the motion axis when using one of the axis arrows or planes and hide the parts that are irrelevant whenever a transformation motion is made (e.g. hiding the rotating and scaling parts when moving some object). Also not shown above but i made it so that when multiple items are selected and the Alt key is down, it rotates each item individually around its own origin (otherwise by default it rotates items around the selection's midpoint).

It is always kinda amusing when graphics are at the forefront of what most people (including even developers!) pay attention when it comes to engines and development in general yet in pretty much all engines the renderer and immediately relevant parts of the engine tend to be only a small part of the overall codebase. This is why sometimes "Named Engines" (i.e. Unity, Unreal, etc) tend to bump up a number whenever they do some major change in their renderers despite the rest of the engine being pretty much the same (sometimes you get a new theme for the editor too, if the editor supports theming).

Out of curiosity it checked out Little Immersive Engine's code and only around 8.75% has to do with the renderer (including render scene and GPU resources). Meanwhile ~42% of the code is for the editor (though i only include the files explicitly about the editor and not all the IFDEF EDITOR ... ENDIF bits in engine code) and so far there is zero gameplay support code (or even gameplay mode support).
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.


Been in the zone lately, hopefully it'll last enough to cover for the next time i get distracted by other stuff :-P. I noticed i've been working in the editor since i woke up ~10 hours ago (though i think i'll take a break now to relax and read something).

Added some nice stuff in the editor, mainly around showing and hiding items to help with working in the viewport. One particular feature i like is being able to select a bunch of objects and isolating the objects which are at the same heights as the selected object's bounding box but otherwise cover the entire world. The main reason for that is to allow working in multifloor/overlapping parts of the map.

In related news Shotcut decided to become even worse in terms of UX and changed how text is added to the videos. Isn't there a simple editor for Linux that lets you throw in a bunch of video segments, crop them (another UX disaster in Shotcut) and add some text? Perhaps i'll try Kdenlive, i don't remember what annoyed me with it last time i tried it but it shouldn't be worse than Shotcut.
 

Bad Sector

Arcane
Patron
Joined
Mar 25, 2012
Messages
2,334
Insert Title Here RPG Wokedex Codex Year of the Donut Codex+ Now Streaming! Steve gets a Kidney but I don't even get a tag.


I think i'm hogging up the thread a bit :-P.

Added grid visualization in the editor, the grid lines are on a grid and axis aligned plane that can be set by using whatever surface the mouse is pointing at as a reference (the reference point will be snapped to grid and the grid plane will be the closest to the major axes). The plane update and toggling the grid is done via the same key (Alt+G): if the plane is the same as the current, the grid visibility is toggled, otherwise the grid becomes visible and the new plane is used - initially i was planning to use different shortcut keys but after trying it for a bit i think this is both easier to use - and saves some shortcut keys for other uses :-P.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom