0 votes

I am using godot 3.1.2 on Windows, currently targeting Windows but eventually targeting Android.

I am loading a 2D image as a "world map." This has "height data" in red, and various "features/resources" data in green and blue channels. I have a custom shader that renders this texture as a top-down sprite by swapping out height-dependent texture images for terrain types, and marking up the special features. This works great! Even with GLES 2.0!

I would like to pre-process the data from this image to build a navigation grid, probably not using navmesh, but instead some new cell based system, because navgrid doesn't have things like feature points, agent/agent blocking, or agent size.

Preferrably, I would do this in a tool, as part of level building, rather than on level load, because it takes a while (especially on lower end CPUs.)

I can't figure out how to do this, though. I can see how to create addon/plugin tools, and how to add custom nodes to a scene, but I don't see any way to do the following things:

  1. Allocate a packed byte or word array (Similar to PoolByteArray, I suppose?) of a given size
  2. Register some function that gets called on project build to update the data in this array if the underlying image data has changed (or that gets called on build, and can somehow check a checksum of the underlying image data)
  3. Marshal this array data out on build, and in again on scene load

Also, the image processing part in GDScript is ludicrously slow right now because creating a new class for each little data structure I want to use, and box-allocating it on the heap, and stuffing it in a variant-storing Array(), gets slow after tens of thousands of such data structures ... Anything I can do to improve this would be good, too.

I am not interested in writing C# code, or C++ code. I know how to do all this in Unreal Engine, (or from scratch,) so if I wanted to deal with C++, I would do it there.

What advice should I read?

asked Dec 26, 2019 in Engine by Jon Watte (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.