Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce flagwars game mode #1115

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Introduce flagwars game mode #1115

wants to merge 12 commits into from

Conversation

farooqkz
Copy link
Contributor

@farooqkz farooqkz commented Mar 17, 2023

Tasks

  • 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 farooqkz marked this pull request as draft March 17, 2023 15:18
@farooqkz
Copy link
Contributor Author

  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?

@LoneWolfHT
Copy link
Member

LoneWolfHT commented Mar 23, 2023

  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

@farooqkz
Copy link
Contributor Author

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

@LoneWolfHT
Copy link
Member

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
Copy link
Member

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

@farooqkz
Copy link
Contributor Author

farooqkz commented Apr 4, 2023

@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?

@LoneWolfHT
Copy link
Member

@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

@farooqkz
Copy link
Contributor Author

farooqkz commented Apr 5, 2023

A "node group"?

@LoneWolfHT
Copy link
Member

A "node group"?

In the node def. It would look something like:

groups = {init_on_map_load = 1},

@farooqkz
Copy link
Contributor Author

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.

@LoneWolfHT
Copy link
Member

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

@farooqkz
Copy link
Contributor Author

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.

@LoneWolfHT
Copy link
Member

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

@farooqkz
Copy link
Contributor Author

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?

@LuismiInTheZone
Copy link
Contributor

LuismiInTheZone commented Apr 23, 2023

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
Copy link
Contributor

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

@LoneWolfHT
Copy link
Member

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
Copy link
Member

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

@Infernia829
Copy link
Contributor

Infernia829 commented Jul 4, 2023

  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,
})

@LoneWolfHT
Copy link
Member

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

@Infernia829
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants