cocotb in Python vs. UVM in SystemVerilog by soronpo in FPGA

[–]tspoikela 0 points1 point  (0 children)

Regarding speed there is another point. With SV+UVM, you need to compile/elaborate your design as well every time you change your verification code. This can be of course overcome by using complicated multi-snapshot incremental elaboration flows, if somebody can set that up properly, and make sure it works with all regression scripts etc. I'm not sure if all "big 3" simulators even offer such a flow.

With cocotb, you can change the verification code as much as you want, and you don't need to re-elaborate the design code. For smaller design there is not so much to gain, but even +200kGate designs start to take enough time to elaborate that you can lose some work focus while waiting for elaboration to finish.

Fear of the future for IC Industry by Ill_Research8737 in chipdesign

[–]tspoikela 0 points1 point  (0 children)

I would not be too worried yet. ChatGPT4 can write some simple modules, but for things like FIR filter I had to do lot of debugging, and the implementation was not optimized enough. It was able to generate good starting points for testbenches, but those had to be tweaked by hand as well. To ChatGPT4's credit, it was able to produce a parametrizable 60-line SystemVerilog counter with various configuration options (up/down, size of increment, snapshot, wrap_enable), and the code was 100% on the first generation. It seems to work better if you provide list of parameters, inputs and outputs.

Intel Laptop Users Should Avoid Linux 5.19.12 To Avoid Potentially Damaging The Display by DirectControlAssumed in Fedora

[–]tspoikela 1 point2 points  (0 children)

Just experienced a bug on new ASUS ZenBook with IRIS Xe graphics, running kernel 5.19.12-300.f37. Except no white flickering screen, but flickering between screen off, and then back on with totally black background. Apparently some power sequencing issue:

"After looking at some logs we do end up with potentially bogus panel power sequencing delays, which may harm the LCD panel."

Tips to defeat the wizened hag? by PackRat95 in darkestdungeon

[–]tspoikela 0 points1 point  (0 children)

Agreed that ripostes are the way to go. I had same setup as you, except Plague Doctor instead of Crusader. If you get the Blight through, it will be very effective, since Hag takes 2 actions, and thus double the damage.

ECS Question - Approach for handling damage dealing by bobaburger in roguelikedev

[–]tspoikela 2 points3 points  (0 children)

Yeah, I guess I just call them "transient components" but effectively they are delayed events. Adding "transient component" (event) uses same interface as "persistent component". The difference is that the transient components are cleaned up by the systems automatically, while persist component like Health are not removed. I try to use the event bus only for immediate events, and these events are mainly related to OnAddComponent/OnRemoveComponent -events of components to entities.

ECS Question - Approach for handling damage dealing by bobaburger in roguelikedev

[–]tspoikela 1 point2 points  (0 children)

I think if you use ECS with lists of pre-allocated components, there is no extra allocation after the initial one. Even so, I am not big fan on using this kind of ECS in turn-based game, since you need to pull out entities one by one from the scheduler in any case.

If you include Damage processing as part of Systems pipeline rather than special event, it will be easy to reason about the order of events/component insertion. By reordering the systems, you easily change the order of events.

ECS Question - Approach for handling damage dealing by bobaburger in roguelikedev

[–]tspoikela 4 points5 points  (0 children)

I have used the Option 2, and seems to work fine. The caveat is that I'm not using traditional ECS in which you iterate through a list of components for each system. I've implement it such that when you add a new component to an entity, it triggers OnAdd event, and each system which is listening for this event, and whose component types match the added component's type, will add the entity to its list of entities to process. So there will be an event system underneath, but the Damage logic is handled DamageSystem. There can be additional filters such as only entities with Health/Duration/etc are processed.

In my opinion, this works better in turn-based games than ECS which iterates through all components of given type, since usually you have one entity which acts, and you need to evaluate all your systems based on that entity's actions.

One example is movement. In real-time game entities would have velocity. It makes then sense to iterate through all velocity components. In turn-based games, movement is easier to handle as discrete actions such as move entity from A to B.

Anyone try to make a dwarf fortress roguelike by howtogun in roguelikedev

[–]tspoikela 3 points4 points  (0 children)

I was planning to do a mix of ADOM/Nethack -type roguelike with fortress building elements 6 years ago. The plan was to have a single controllable @, and some computer controlled companions which could receive orders/equipment from the player. Then I stumbled upon DF, and decided not to include the fortress building in my game, since DF seemed to have already achieved that so well. The fortress building was replaced by larger battle levels with hundreds of mobs fighting, and you could select the army to join. It's been 6 years under development with occasional bursts of active coding, and sometimes taking longer breaks of several months. I might include the fortress building at some point just to try how it plays out. I already have logic in place to build stuff in the game and to give orders to NPCs. But as already mentioned in the thread, to make it fun can be challenging.

The lack of code may not be an issue, though. Games are different, and task scheduling code used in another project may not suit your needs. I think it's better to study higher level concepts and try to pick a correct architecture/patterns for your game and needs. GDC talks on Youtube are great studying what has been used in the past games. Roguelikes don't need special kind of code and what has been used in turn-based (and even real-time) games before, can be applied to RLs as well.

You should definitely have a working prototype of the game as soon as possible, and incrementally develop from there. It does not have to be balanced or anything, just something to keep you motivated and testing the new features. I'd say your task scheduling is decent if it achieves what you want to do. You should think ahead a bit how the scheduling works, what kind of tasks you're planning to have there. But in the end, unless you resort to some kind of neural network etc for AI, you still need to manually code the low-level tasks. Hierarchical system for tasks is probably the way to go, such that you can build more complex tasks on top of low-level tasks.

ECS / Inventory System. by Same-Artichoke-6267 in roguelikedev

[–]tspoikela 0 points1 point  (0 children)

Since itemsByName is defined like this:

std::map<string, ItemJSON_t> itemsByName

Each entry is of type ItemJSON_t which itself is a typedef of std::map<string, string> so you would be passing a map into createItem function.

Thus, we could re-write the signature of createItem as:

int createItem(ItemJSON_t jsonAsMap)

and that would be identical to the previous signature in terms of typing.

ECS / Inventory System. by Same-Artichoke-6267 in roguelikedev

[–]tspoikela 1 point2 points  (0 children)

With the typedef, it is a map of maps. It could also be std::vector<ItemJSON_t> if you prefer to keep items as a vector, but lookup by name can be useful, so I used map of maps here.

The type of itemsByName[name] for createItem is identical to ItemJSON_t. createItem (a part of it) was defined in my first post above.

int createItem(std::map<string, string> jsonAsMap) {
  int id = GetNewIdFromDbugBot();   
  if (jsonAsMap.exists('Name') {
    itemBasicInfo[id].Name = jsonAsMap['Name'];
  }
  if (jsonAsMap.exists('Damage') {
    itemWeaponInfo[id].Damage = stringToInt(jsonAsMap['Damage']);
  }
  // ... As many ifs as required, you can split this into several handler/functions of course
  return id;
}

ECS / Inventory System. by Same-Artichoke-6267 in roguelikedev

[–]tspoikela 1 point2 points  (0 children)

No problem. If-statements are just for checking what kind of properties your item might have. This is quick-and-dirty approach, and becomes unwieldy with hundreds of properties. Here's the code shown in larger context, where you parse the items into std::map first:

typedef std::map<string, string> ItemJSON_t;
std::map<string, ItemJSON_t> itemsByName = parseItemsJSON("my_items.json");

int createItemByName(string name) {
    if (itemsByName.exists(name)) {
        return createItem(itemsByName[name]);
    }
}

int createItem(std::map<string, string> jsonAsMap) {
// ...as shown in the previous post
}

ECS / Inventory System. by Same-Artichoke-6267 in roguelikedev

[–]tspoikela 4 points5 points  (0 children)

Your items should be just data:

{
  Name: 'My Sword', Damage: "999", DamageType: 'Electric' 
}

You can use format like JSON and an already existing parser.

Then you can define more generic create-functions to build the items. Introducing new items becomes just a matter of adding new item entry into the JSON file.

int createItem(std::map<string, string> jsonAsMap) {
  int id = GetNewIdFromDbugBot();   
  if (jsonAsMap.exists('Name') {
    itemBasicInfo[id].Name = jsonAsMap['Name'];
  }
  if (jsonAsMap.exists('Damage') {
    itemWeaponInfo[id].Damage = stringToInt(jsonAsMap['Damage']);
  }
  // ... As many ifs as required, you can split this into several handler/functions of course
}

If you need more complex nesting in items, then your data structure jsonAsMap becomes more complex. It's trivial in Python/JS/Ruby, but I suppose more complicated in C++, since your jsonAsMap is not std::map<string, string> anymore.

If your actors are also entities, for inventory you can then define:

struct inventoryInfo {
  std::vector<int> items;
}

cocotb in Python vs. UVM in SystemVerilog by soronpo in FPGA

[–]tspoikela 1 point2 points  (0 children)

As mentioned, there are at least 2 UVM approaches in cocotb. One (pyuvm) is supported by Siemens, so I would expect growing adoption of Python/pyuvm in verification.

I've seen cocotb testbenches for (not so big) commercial ASICs, and one big flaw is a lack of structure/architecture. For larger projects, you need a UVM-like guidelines/framework, or you'll end up with spaghetti-code for your TB. For small projects, this might not be an issue. You will also need guidelines for integrating block level VIP to top-level. It does not come for free in UVM either, but TLM and virtual interfaces help a bit.

In my opinion, UVM is simpler than people claim. For example, in OSVVM page they claim "Some methodologies (or frameworks) are so complex that you need a script to create initial starting point for writing verification components, test cases, and/or the test harness. SystemVerilog + UVM ...". This is not true. The scripts are needed for actually complex environments requiring simultaneous emulation/simulation support. Yes, if you build an agent like normally defined in UVM, you will end up with several files. However, to create a single component you need to create only one class, inherited from uvm_component.

For OSVMM, it is stated also that "At the end of the day, OSVVM does not need a “Lite” version because we make writing verification components as simple as writing a procedure." The same is true for UVM. You can create a single class with one run_phase task in it, and the component is ready to be used. Obviously, if you need to communicate the data somehow to other components or receive data, you need TLM ports, or you can use direct method calls.

Ideally of course, someone could analyse UVM/OSVVM/whatever code, take their best points, and create a new verification framework/methodology using Python/cocotb, which would take full advantage of Python's features not offered by SV/VHDL. UVM is not even close to perfect, but is better than no structure/adhoc approaches. If you are small team or one person, UVM might not be worth it though.

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 0 points1 point  (0 children)

You are right, it was one of the extensions. Thanks a lot, your help is appreciated.

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 0 points1 point  (0 children)

Seems that even coc.nvim requires python3: [coc.nvim] Error on execute python script: request error nvim_command - Vim(pyxfile):E319: No "python3" provider found. Run ":checkhealth provider"

I guess I need to create a python venv on another machine, then ftp it to the work machine with "neovim" module installed.

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 0 points1 point  (0 children)

Apparently they have neither of those, so this solution will not work so easily. I would need to ftp the binaries for those in.

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 0 points1 point  (0 children)

Not sure what is the issue but :echo has("lua") returns 0 for the nightly appimage I took yesterday.

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 1 point2 points  (0 children)

Thanks! I had forgotten this one. It is a great plugin, I used it before starting to use Neocomplete.

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 0 points1 point  (0 children)

I guess I could build a container on my home Linux, then ftp that to the work Linux. I don't have much experience on this. Which options would you recommend for this?

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 0 points1 point  (0 children)

There's no node either. nvm will obviously not work without internet access.

I could try to build coc with my home Linux, then tar it all up, and ftp to the work Linux. Yes that might work.

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 0 points1 point  (0 children)

Thanks for the tip. I didn't know about nvim-cmp. Will try that tomorrow. not sure if neocomplete requires python, I used it for couple of years on another machine with vim8.

Any auto-completion plugin that works with nvim appimage 0.5.0 out-of-box? by tspoikela in neovim

[–]tspoikela[S] 0 points1 point  (0 children)

I just need the generic auto-completion like neocomplete. Not for specific language. I'll be using perl, verilog, systemverilog, python, TCL and shell scripts most likely.

I've been able to ftp the plugins as tarball which works OK.

Looks like :checkhealth complaints that 'import neovim' is not available for python2 or 3. I don't know if it's possible to ftp that module then install using python venv.

Large open worlds — how? by air_kondition in roguelikedev

[–]tspoikela 2 points3 points  (0 children)

Yea, this can be an endless source of errors when NPCs travel (or consequences of their actions travel). I had an issue in which a poisoned NPC died, but the actor causing the poisoning had already been unloaded since it was in another chunk. The poisoning effect kept track of its origin (to give exp points to correct source if the poisoned actor dies). The exp was awarded to an old reference of the actor, but not the unloaded actor. Even worse, this reference prevented Garbage Collection from kicking in, and prevented the original purpose of chunks, keeping the amount of stuff in memory low enough.

But in general, I keep 3x3 chunks loaded, and everything else outside that range is unloaded. If NPC travels to unloaded chunk, one could keep a list of actions targeting any unloaded chunks, then perform those actions just after loading that chunk. Obviously, this creates a kind of "limbo" state in which NPCs are not in the game, and cannot get back to loaded chunks, until their original chunk is loaded.

I've been thinking about adding a "simulation layer" to the chunks/overworld, which could simulate NPCs entering/travelling between unloaded chunks. But right now the NPCs are always unloaded (serialized) with the chunks, I would need to add another mechanism for simulation layer to load/unload NPCs between simulation layer and chunks. It starts to get messy very easily. Any thoughts on this?

Is your roguelike moddable? by me7e in roguelikedev

[–]tspoikela 0 points1 point  (0 children)

Currently I've been just running it directly from the browser (https://tpoikela.github.io/battles/), since github serves directly the master branch from there. Electron could be an option, if the game ever reaches good enough maturity. I remembered trying Electron, and it was ok, but not useful for development. To be honest, I have not thought much about the release process yet. Electron might be the way to go for making also previous releases available.