Comments (8)
from libtcod.
Thanks for sharing your own examples.
A malloc
on each queue push isn't good for performance. It harms threading and memory locality.
It's tricky to figure out what I'd even want to do. I really want something that's flexible.
Maybe if I redid the C pathfinder I could make one that takes a C callback to define the graph. I don't think I'll do this until I've implemented something similar in C++, or maybe I can try to backport the complicated Python-tcod pathfinder.
from libtcod.
I've been in the middle of a rewrite of the pathfinder for a long time now. I haven't been happy with what I've done so far, and my plans have been ambitious.
I want to remove the 2D limit, allow a custom heuristic function, and a custom graph function.
The C++ templates in the src/libtcod/pathfinding directory do what I want, but I need to somehow port these to C99.
from libtcod.
Thinking back on this I should have just made the C++ templates more accessible and not worried about what was available in C.
It was really easy to set up a new pathfinder in C++. The hard part was that I need to figure out how to handle the inputs and outputs of the pathfinding computation data, since there's no standard multi dimensional array type in C++.
from libtcod.
from libtcod.
from libtcod.
The main dependency I used was a priority queue I believe.
This is the main part. It's trivial to implement a pathfinder after you have access to a good priority queue. I have one in libtcod but the interface is too weird and I don't want to lock it in by making it public.
I know in my haskell roguelike I pass in a function to the A* algorithm which returns all neighboring points for a given point.
I'll need to do this for C sometime. I've previously done it with C++ templates but it might be easy enough to make a simple C callback work in a similar way. I'm still missing a good C container for the array of distances/path-costs.
from libtcod.
Simple things like "what is the size of an index" are not so easy to resolve in C. This is one of the things which made the internal heap queue turn out weird.
from libtcod.
Related Issues (20)
- Historical issue HOT 54
- Segfault during font loading with `TCOD_sys_check_magic_number`. HOT 22
- Error when configuring project with CMake -> Fatal: path 'versions/baseline.json' exists on disk, but not in <commit> HOT 3
- Missing stdc++fs library for older g++'es HOT 3
- Bitmap font question HOT 1
- Libtcod parser regression: expects identifiers then crashes when given a type.
- Generic ndarray types.
- Update Sphinx docs to cover the API. HOT 3
- Add the roguelike.h renderer HOT 3
- Printing API needs a rework. HOT 10
- Problem with a 64 by 64 pixel font HOT 4
- `TCODImage` is not default constructable.
- How to use libtcod from vcpkg in 64bit MSVC project? HOT 2
- Create a libtcod Discord community channel HOT 4
- Use CMake FetchContent instead of vcpkg HOT 8
- Libtcod blanks the first glyph of tilesets without warning.
- How to access screen from ITCODSDLRenderer::render HOT 2
- Vcpkg should be updated HOT 5
- Confusing names of [l|m|r]button_pressed TCOD_mouse_t properties HOT 2
- Split libtcod into multiple libraries.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libtcod.