Wrap TeeworldsMapLib for me?

If you have troubles with anything about mapping - just ask.
Post Reply
d3fault
User
Posts: 10
Joined: Sun Jul 24, 2016 9:35 pm
Player profile: d3fault

Wrap TeeworldsMapLib for me?

Post by d3fault » Wed Dec 05, 2018 10:03 am

I want to write a map generator, but I am no good at Python and I'm not willing to learn it. C++ is my language of choice. There exists a TeeworldsMapLib for working with maps, but it's written in Python. It comes with a test app but it's too fancy and does more than I want (that and I can't read Python very good).

I am a mapping noob in general and I don't want to learn maps as they exist today. There's just too much to them and tl;dr. The output of my C++ map generator would just be a 2D array of "ints", where 0 is nothing, 1 is nonhookable, 2 is hookable, 3 is freeze, 4 is deep, etc.... very basic. I don't care about the graphical part of the map one single bit, I play with entities on 24/7 (this tutorial sucks: viewtopic.php?f=16&t=4020 -- and I see it as a bonus that it would troll Oblique). The app should just read a CSV file of ints or some basic text file format, and output a teeworlds map.

It would probably be a simple app for someone who already knows Python, but I can't be bothered to learn Python just for this.

TeeworldsMapLib: https://github.com/erdbeere/tml

User avatar
deen
Retired Administrator
Posts: 3171
Joined: Mon May 05, 2014 2:30 pm
Player profile: deen

Re: Wrap TeeworldsMapLib for me?

Post by deen » Wed Dec 05, 2018 10:13 am

TML is meant if you don't want to use C++ since regular Teeworlds is already in C++ and contains map support obviously. So you can just edit the regular Teeworlds source code for that. See src/tools/map_* in DDNet for example: https://github.com/ddnet/ddnet/tree/master/src/tools

(Also, Python is quite simple if you already know C++.)

d3fault
User
Posts: 10
Joined: Sun Jul 24, 2016 9:35 pm
Player profile: d3fault

Re: Wrap TeeworldsMapLib for me?

Post by d3fault » Fri Dec 07, 2018 5:50 am

hmm getting warmer, never saw these tools. compiled dummy_map.cpp and generated a map, but the resulting map is a bit too.... empty... to be of use. it taught me how to create empty layers, but not how to put down any tiles (despite the code mentioning adding 4x tiles, I don't see any when I load the map). map_resave is too abstract to be of use. do any of these tools create a very small but non-empty map? a spawn point, maybe 5x non-hookable ground tiles to walk on, some hookables up in the air, and a finish tile over to the right.

using ddnet source for this was my first instinct a while ago, but I took the wrong approach and tried reading the in-game map editor source xD...

User avatar
deen
Retired Administrator
Posts: 3171
Joined: Mon May 05, 2014 2:30 pm
Player profile: deen

Re: Wrap TeeworldsMapLib for me?

Post by deen » Fri Dec 07, 2018 8:12 am

map_compare reads every tile in the map. Instead of reading you could also change them.

d3fault
User
Posts: 10
Joined: Sun Jul 24, 2016 9:35 pm
Player profile: d3fault

Re: Wrap TeeworldsMapLib for me?

Post by d3fault » Sun Dec 09, 2018 6:01 am

only changing existing maps would make the map generator pretty limited. I still don't know how to add a tile. I modified map_diff slightly to dump every tile (not just mismatches), but m_Index is almost always 0 and m_Flags is almost always 0 too. m_aName shows more interesting info (Game, Front, Letters, spikes, ground), but still seems like a category of a layer than a tile type (idk tbh). it's also just a string (so maybe just a a description vs. an identifier?). I tried changing the m_Index for the 4x tiles placed on dummy_map...
Tiles[0].m_Index = ENTITY_SPAWN;
Tiles[1].m_Index = TILE_DEATH;
Tiles[2].m_Index = TILE_NOHOOK;
Tiles[3].m_Index = ENTITY_SPAWN;
... but I still didn't spawn nor did I see any tiles whatsoever (also tried ENTITY_SPAWN_RED).
this probably seems very obvious to you, who has spent so much time with the teeworlds source code, but I'm trying to just dive into it part time for fun... don't really want to learn the code base fully because I got better things to do (like stare at a wall). dummy_map builds a minimal loadable map with nothing in it, but maybe in /tools/ there could exist a map_gensimple.cpp that generates a very small map using raw C++ commands... to give map generator writers a starting point. hell I'll submit it myself if I can ever figure this out.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest