capturetheflag icon indicating copy to clipboard operation
capturetheflag copied to clipboard

Introduce flagwars game mode

Open farooqkz opened this issue 2 years ago • 21 comments

Tasks

  • [x] flagwar mode itself
  • [ ] Treasure spawner(gold, mese, diamond, iron)
  • [ ] Shop

Subtasks for shop:

  • [ ] texture
  • [ ] Shopping inventory

Do you think a vending machine would be fun, too?

farooqkz avatar Mar 17 '23 15:03 farooqkz

  1. What must we use for the spawner thing? I believe an ABM fits it so that it'll spawn only when somebody is around.
  2. I want to save the item each spawner spawns in its metadata, is it a good idea? Or perhaps separate gold, iron, and diamond spawners is a better idea?
  3. Alternatively, Spawners could spawn something on punch/click. Is this a better idea?
  4. Should each team's shop create a blast on destroy? Damaging nearby players and nodes/blocks?

farooqkz avatar Mar 20 '23 12:03 farooqkz

  1. What must we use for the spawner thing? I believe an ABM fits it so that it'll spawn only when somebody is around.
  2. I want to save the item each spawner spawns in its metadata, is it a good idea? Or perhaps separate gold, iron, and diamond spawners is a better idea?
  3. Alternatively, Spawners could spawn something on punch/click. Is this a better idea?
  4. Should each team's shop create a blast on destroy? Damaging nearby players and nodes/blocks?

1: Anything but an ABM please, they are horribly inefficient, and you want the droppers to be active even when no players are around. I'd suggest using a globalstep that loops through the dropper positions every x seconds 2. Metadata is not saved in maps, so a separate node for each spawner would be best 3. No 4. Shops should be unbreakable

LoneWolfHT avatar Mar 23 '23 20:03 LoneWolfHT

Is it a good idea shops having some HP and when it reaches zero, the shop gets destroyed?

farooqkz avatar Mar 23 '23 20:03 farooqkz

Is it a good idea shops having some HP and when it reaches zero, the shop gets destroyed?

I don't think so. It's not done like that in Bedwars either AFAIK. I'd recommend getting the original idea done first, and innovating once the mode is on the server being played

LoneWolfHT avatar Mar 23 '23 20:03 LoneWolfHT

mtg_default should be default, I changed the folder name to make it more obvious where the mod was from, the mod.conf name is still default

LoneWolfHT avatar Apr 02 '23 18:04 LoneWolfHT

@LoneWolfHT The shop and the spawners must be placed in maps, somehow. My suggestion is a new property for maps which is a list of coordinates and nodes to place in a given game mode. What do you think?

farooqkz avatar Apr 04 '23 14:04 farooqkz

@LoneWolfHT The shop and the spawners must be placed in maps, somehow. My suggestion is a new property for maps which is a list of coordinates and nodes to place in a given game mode. What do you think?

How about a node group that causes on_construct to be called for it at around the time chests are placed? No need to record/save its position then

LoneWolfHT avatar Apr 05 '23 04:04 LoneWolfHT

A "node group"?

farooqkz avatar Apr 05 '23 12:04 farooqkz

A "node group"?

In the node def. It would look something like:

groups = {init_on_map_load = 1},

LoneWolfHT avatar Apr 11 '23 16:04 LoneWolfHT

A "node group"?

In the node def. It would look something like:

groups = {init_on_map_load = 1},

Excuse me but I still don't understand how such a group can make nodes with this group appear in certain places in a map.

farooqkz avatar Apr 13 '23 12:04 farooqkz

Excuse me but I still don't understand how such a group can make nodes with this group appear in certain places in a map.

I would need to add code to one of the map placement LVMs that checks for it and then calls that node's on_construct

LoneWolfHT avatar Apr 21 '23 17:04 LoneWolfHT

Excuse me but I still don't understand how such a group can make nodes with this group appear in certain places in a map.

I would need to add code to one of the map placement LVMs that checks for it and then calls that node's on_construct

But I still don't understand where do you get the placement positions from.

farooqkz avatar Apr 23 '23 09:04 farooqkz

But I still don't understand where do you get the placement positions from.

The LVMs loop through all nodes on the map in order to find places to place the treasure chests

LoneWolfHT avatar Apr 23 '23 18:04 LoneWolfHT

But I still don't understand where do you get the placement positions from.

The LVMs loop through all nodes on the map in order to find places to place the treasure chests

oh so you meant putting them randomly on the map?

farooqkz avatar Apr 23 '23 19:04 farooqkz

One tiny question about this new project for CTF v4, after it's finished, we'll need to create new maps no? So... maybe creating a tiny tutorial of how to create new maps would be ok too... Also, about the poll you made Landar... is for deleting one mode... right...

LuismiInTheZone avatar Apr 23 '23 20:04 LuismiInTheZone

One tiny question about this new project for CTF v4, after it's finished, we'll need to create new maps no? So... maybe creating a tiny tutorial of how to create new maps would be ok too... Also, about the poll you made Landar... is for deleting one mode... right...

I could make the tutorial by the way if it's needed

LuismiInTheZone avatar Apr 23 '23 20:04 LuismiInTheZone

One tiny question about this new project for CTF v4, after it's finished, we'll need to create new maps no? So... maybe creating a tiny tutorial of how to create new maps would be ok too... Also, about the poll you made Landar... is for deleting one mode... right...

I'm not planning on ever making a CTFv4, as that implies a near-full rewrite with my current versioning system.

This mode probably will need maps specially made for it, so I will hopefully be able to release a mapmaking tutorial with it.

As to the poll, I don't plan on deleting anything based on its results, it's just to get an idea of what I could improve

LoneWolfHT avatar Apr 23 '23 23:04 LoneWolfHT

oh so you meant putting them randomly on the map?

No, put them on the map and add load_on_map_init=1 to their node groups. I'll handle the rest :P

LoneWolfHT avatar Apr 23 '23 23:04 LoneWolfHT

  1. What must we use for the spawner thing? I believe an ABM fits it so that it'll spawn only when somebody is around.

Here is an some code from my item spawner, it uses node timers which only have to be started once (using an ABM or something), then when the match ends I stop them and clear objects.

minetest.register_node("bedwars:base_spawner", {
    description = S("Base Item Spawner"),  -- Description for translation
    tiles = {"default_stone.png"}, -- Change the texture to your preference
    groups = {cracky = 3},
    drop = "", -- No drop when the node is dug,
    paramtype2 = "facedir",
    legacy_facedir_simple = true,
    is_ground_content = false,

    on_construct = function(pos)
		local timer = minetest.get_node_timer(pos)
        timer:start(2)
    end,
	on_timer = function(pos, elapsed)
        local meta = minetest.get_meta(pos)
		local time = meta:get_int("time")
		if time == nil then
			time = 0
		end
		pos.y = pos.y + 1.5
		time = time + math.round(elapsed)
		if time > 14 then
			local item = ItemStack("default:gold_ingot 1")
        	local objects = minetest.get_objects_inside_radius(pos, 2)
			local count = 0
        	for _, object in ipairs(objects) do
                local entity = object:get_luaentity()
                if entity and entity.name == "__builtin:item" then
                	local stack = ItemStack(entity.itemstring)
                	if stack:get_name() == item:get_name() then
						count = count + stack:get_count()
					end
            	end
    		end
			if count < 12 then
				minetest.add_item(pos, item)
			end
			time = 0
		end
		if time == 3 or time == 7 or time == 10 or time == 14 then
			local item = ItemStack("default:steel_ingot 1")
			local objects = minetest.get_objects_inside_radius(pos, 2)
			local count = 0
        	for _, object in ipairs(objects) do
                local entity = object:get_luaentity()
                if entity and entity.name == "__builtin:item" then
                	local stack = ItemStack(entity.itemstring)
                	if stack:get_name() == item:get_name() then
						count = count + stack:get_count()
					end
            	end
    		end
			if count < 64 then
				minetest.add_item(pos, item)
			end
		end
		meta:set_int("time", time)
        return true
    end,
})

Infernia829 avatar Jul 04 '23 02:07 Infernia829

I think a globalstep looping over positions would still be faster. If you want to use node timers I'd suggest comparing its speed against that of a globalstep

LoneWolfHT avatar Jul 06 '23 15:07 LoneWolfHT

I'm sure that global steps would probably be faster in this specific use case, where you only have a few spawners, but node timers start becoming faster once you have 10+, since they are handled in C, and they can be configured to only run when you want. I'll test this theory later, but there isn't really a good way to measure how long it takes multiple node timers to execute.

Infernia829 avatar Jul 06 '23 15:07 Infernia829