City Tycoon Devlog

I’ve been making my first building in a couple years, and it’s going pretty well! This will be the car dealership where you can purchase the cars I’ve previously modeled to drive them around!

Im struggling on finding a way to make a mobile and desktop compatible car, if you have any models or resources that would be helpful for this please let me know!

Last thing, if you guys would like to help me with my dealership you can go on this post where I have all my feedback, or even post on here! All feedback is appreciated!

If you check the link on the reply I’ve posted to it will take you to the building feedback thread in which I have updated it to include my new question. I need to fill in some space in my building, I’ve modeled some furniture yet it still feels very dull and empty, any help?

Here's a picture of it if you can't click the link.

I have not posted on here in a while. I sort of forgot… :no_mouth: Although I’m going to now catch you up on everything I’ve done, and maybe give you some code to learn from!

First off, I have created separate zones around the game that are over different places that a player may own. This enables me to not let them open the build menu when their 50 miles away from their plot! To accomplish this I found this very helpful module by @ForeverHD, the creator of many helpful open source projects. To accomplish this I simply used this snippet:

local Zone = require(game.ReplicatedStorage.Modules.ZoneModule)
local zone = Zone.new(workspace.Tycoons.bostnmTycoon.CarDealership.Zone)

zone.playerEntered:Connect(function(player)
	player.Values.PlayerBuildingLocation.Value = "CarDealership"
end)

zone.playerExited:Connect(function(player)
	player.Values.PlayerBuildingLocation.Value = "House"
end)

This of course is just a test I used, as its not near efficient!

After I changed the value I had the building system check their value before enabling building!

While there is not much to say here I might as well just state that I have been squashing many bugs throughout this time period! For example I fixed a detrimental bug that doesn’t load any previews for models about to be built. I’m not going to say anymore because the rest are just behind the scenes!

@Beatitkid4 and @goalmwo, I’ve decided not to add any cars driving on roads. I thought it over for a while and decided that it is a little too much. While I might change my mind when the finished project comes, right now I’m not planning on adding any cars to the road. Besides player cars of course :smile:

Now for the car update :hushed:
In the 30+ days of no replies I’ve been working on hard on the entire car system. I’ve also made a huge change to the way to get cars. Previously there was a dealership in a place called central city, where everyone can access it. Well, although this could work, I wondered about making cars another thing to unlock. By this I mean it would be another place you can customize, but instead of making you any money it instead provides you a way to purchase cars! I thought this idea was amazing, but if you think not please let me know.(Give a good reason!) After making it like that I no longer had to decorate it, which checked that off my list! I then came to the car purchase system, which has some pretty big bugs but is overall working nicely. The bugs will get solved once I get around to bug fixes again. Now that I’ve told you about it its time to show! Below is a picture since I cannot get a video right now!


I’ll go ahead and break it down right here!

  • Confirm Button

    • Center Bottom
    • Clicking this gives you a value in your car inventory that will later be used to spawn cars.
  • Stats Menu

    • Left Middle
    • This menu displays all the car stats, while changing every time you change cars.
  • Main Display

    • Center Top
    • Displays name and price, with arrows to switch cars
  • Color Picker

    • Right Middle
    • Allows you to change the color of your car to your liking.

After doing that I went and made a little function to get the rating of a selected place. Below is the code I used for it!

function module.getRating(tycoon)
	
	local function getCleanliness(count)
		local cleanRating = 5
		for i=count, -1, 0 do
			print(i)
			if cleanRating - 0.25 >= 0 then
				cleanRating -= 0.25
			end
		end
		return cleanRating
	end
	
	local function getDecor(items)
		local objects = require(game.ReplicatedStorage.Modules.Dictionaries.Objects)
		local decorRating = 0
		for i, item in pairs(items) do
			if objects[item.Name] then
				local itemStats = objects[item.Name]
				if itemStats.Class == "Decor" then
					if decorRating + 0.25 <= 5 then
						decorRating += 0.25
					end
				end
			end
		end
	end
	
	local function getPopularity(people)
		local popRating = 0
		for i, person in pairs(people) do
			if person.Values.Rarity then
				local increment = person.Values.Rarity.Value / 4
				if popRating + increment <= 5 then
					popRating += increment
				else
					popRating = 5
				end
			end
		end
	end
	
	local function getService()
		
	end
	
	local function getQuality()
		
	end
	
	local cleanliness = getCleanliness(tycoon.Garbage.GarbageCount)
	local decoration = getDecor(tycoon.PlacedItems:GetChildren())
	local popularity = getPopularity(tycoon.NPCs:GetChildren())
	local service = getService()
	local quality = getQuality()
	
	local rating = (cleanliness+decoration+popularity+service+quality) / 5
	
	return rating
end

At the time of writing I have not found a way to get a value for the last two yet, but I’m getting there!

PLEASE DON’T STEAL THIS CODE
You may not copy and paste this code for your own game, instead I showed it to you for you to understand it better and learn from it if you need to.

Last but not least, a simple code system! I used a previous system I made and edited it to fit the game, although the UI is completely new! Not much to say about this as its just the generic code system. I can still give you a picture though!
Screen Shot 2022-04-02 at 4.00.47 PM

Wrapping all this up, I must ask for feedback. This can be on literally anything covered in here! From simply an idea to an entire rework, I’m willing to consider all. After all, I want this game to be enjoyed by everyone, and not just be to my liking. A major thing that I think might need feedback is the UI on these systems, if you have any feedback on those please, please, please tell me! Have a great day!

3 Likes

Looking good, I’m liking the progress!
The car dealership is a good idea and yes, cars roaming around would probably be too much. However, I think NPC’s should still be added to bring the city to life.
Pretty sure I’ve said this before but make sure to watch the lag. If you are having 4+ tycoons per game, with some pretty large buildings it may take quite a hit on FPS.

I’m currently trying my very hardest to reduce lag as much as possible. I’m afraid to say my partner is instead filling up cash bags with 100’s of bricks :sweat_smile: . Although I’ll figure that one out when I come to it. Anyway, getting back on track, I plan on adding many features to reduce lag in-game, like only loading visible tycoons, storing everything that causes lag not in rep storage but server storage (so its not replicated), and much more. I know from experience that lag is not a joke…

Now for my next update on the game! After finishing codes I’ve decided to go ahead and make the robux shop UI. I’m having some HUGE problems though with it, most of it being color choices. I know people don’t wanna reply often, but please help me here because the quality of this UI is terrible in my opinion. I’m willing to try anything to fix it up! I’ll show you it below.
Screen Shot 2022-04-05 at 4.40.21 PM

It doesn’t look too bad, however I would just stick with 1-2 fonts rather than lots. I would personally make a colour scheme that you think would work well for the UI, and use it throughout. Nothing worse than having a million different styles and colours.

Try increasing the outline, or even changing it to a complimenting colour.

Thank you so much!! I took your advice on the UI by changing some fonts and colors, and it now looks a million times better! I found that the main thing that was throwing it all off was the text colors, as they were completely random. I was trying to make colors that don’t match match :sweat_smile:! I can’t currently provide a picture of it or anything but hopefully you can imagine it!

1 Like

I’ve modeled two furniture pieces! Not too much to say about them, except that I plan on using them for a game store, any feedback is appreciated!

Screen Shot 2022-04-10 at 2.19.12 PM

Screen Shot 2022-04-10 at 2.19.25 PM

Screen Shot 2022-04-10 at 2.19.33 PM

1 Like

Hey guys, I’ve been working on setting the NPC’s to the players friends, but I’m having some trouble. Could you help me out and take a look at this post for me? I’m very confused on what to do :sweat_smile:

Small update right now! Just want to let you guys know that I’ve been working on the core part of the game, which is NPC’s finding a objective, walking towards that goal, then interacting with it. Not to mention spawning them at the right times. It’s a ton of work causing me to take a while.

The main reason I made this post is that I was thinking, what if the players could purchase a new building for their place. Its confusing so I’ll give an example. You have a game store, which looks very normal and has a normal 1x cash multiplier. When you get enough money or some currency then you can buy a different kind of game store, like a treehouse themed one. This new one also gives you a 1.5x multiplier. It’s basically a creative way to rebirth your buildings. What’s your opinion on this?

1 Like

Hey! I’m back again and right now I have finished the pathfinding and spawning part of the core game! I can’t capture it on video however because of how quick it is. I am experiencing a lag problem though. I think it’s due to the amount of humanoids there are, which worries me as there is usually only 10. Any ideas on this?

When starting to make my map template for the game I decided that the map should also be able to be upgraded. I’m now thinking that I’ll have a store put on everyones island to start with. The store will contain a bunch of upgrades that come with cash boosts or multipliers. Including the building upgrades, island upgrades, and maybe some other cool upgrades that can help stack a cash multiplier.

2 Likes

The lag shouldn’t be to do with the humanoids but it does depend on how complex their pathfinding is. You should be able to have a lot of humanoids at once without noticeable lack. While in game, check all the outputs and graphs to see when frame rates drop.
I like the upgrades idea!

1 Like

I know I sound dumb, but how do you access the frame rates or graphs during play testing?

You can use F9 in-game to bring up the Developer console.

1 Like

Hey, I’m still looking into the lag problem and figured, why not just hand over the code so someone can help me optimize it. So here it is, any ideas why it might be lagging?

local npcModule = require(game.ReplicatedStorage.Modules.NPCModule)

for i, tycoon in pairs(workspace.Tycoons:GetChildren()) do
	if tycoon.Name ~= "EmptyTycoon" then
		for i, place in pairs(tycoon:GetChildren()) do
			if place.Name ~= "House" and place.Name ~= "Island" then
				local npcs = place.NPCs
				local max = npcs.Max

				coroutine.resume(coroutine.create(function()
					while wait(wait(math.random(npcs.MinimumWait.Value, npcs.MaximumWait.Value))) do
						if #npcs.Bots:GetChildren() < max.Value then
							local bot = npcModule.Create(npcs.Spawn.Position, npcs.Bots)
							local position = npcModule.CalculatePath(bot, place)
							npcModule.Move(bot, position)	
						end	
					end	
				end))
			end
		end	
	end
end	
1 Like

it appears for this script you have no garbage collection, it will probably spawn bots for even unowned plots. If you have plots being loaded by players you could make a way to cancel the coroutine whenever the plot gets unloaded… Plus your resuming a coroutine directly outside of the creation, you could reference the coroutine object so you can task.cancel it later

local Thread = coroutine.create(function()

end)
coroutine.resume(Thread)

task.cancel(Thread)--stops the thread entirely

or if you don’t want to resume the coroutine you could just use task.spawn to execute it immediately

local Thread = task.spawn(function()

end)

task.cancel(Thread)

Suggestion: Add taxing. After afew days or so you will get taxed depending on each building that you place. example: smol store will give you 1% tax but the big store will give you 5% tax

I see where your coming from although I have some bad experience with a system like this in another game. I believe the game was called business tycoon or something, but that is irrelevant. This game implemented this feature, where you would have to pay tax every 10 minutes, now don’t get me wrong this is a very cool feature to have, but it does two different things depending on age:

  • Older Players - they understand the system and how it works, and it gives them stress that they’ll miss the deadline or not have enough money when it’s time to pay it.
  • Younger Players - they have no idea what a tax even is, all it is is a timer counting down that wants money. My best guess is that they think it is some doomsday device that when it goes off they lose a bunch of money :sweat_smile:. It’s pretty funny to think about, but when they experience this they easily get mad and start asking people why it does this in chat, and sometimes even dislike the game and never come back.

Now if you have solutions to these problems I’d be more then happy to implement this, it’s just that these problems with the system could make this feature game breaking!

1 Like

Sorry if I sound stupid :sweat_smile:

In your reply you were referencing task instead of courotine(or however you spell it…), I know that when using courotine it allows you to run multiple loops at once, does task do the same thing? I’ve never used task before but I’m eager to learn!

I have an idea, there will be a GUI that pops up when a new player joins. It tells them about the tax system, but heres the catch they can either enable the tax system or disable it. If the enable it the will have tax BUT they will get 15% (or so) more income. If they decide not to, no tax and no increased income

(But still you do you, the game sounds really amazing!)

1 Like