/vx/ - Videogames and Paranormal


Welcome to the new code.
If you want to see the latest posts from all boards in a convenient way please check out /overboard/
Note: JS is required to be able to post, but I am working on a system where that won't be needed.

Name
Email
Subject
By clicking New Reply, I acknowledge the existence of the Israeli nuclear arsenal.
Comment
0
Select File / Oekaki
File(s)
Password (For file and/or post deletion.)

moHM8WU.png
My little game dev project
Anonymous
fWql+
?
No.577
578 584 586 587 632 660
Hey guys, I am working on some sort of text based simulator that can generate game world and its inhabitants and then simulate the changes in that world. Like rise and fall of civilizations.

It must sound super complicated but it probably doesn't have to be. Basically, it would be some sort of pseudo engine to simulate world and AI civilizations in civilization management Quests or CYOAs games, played on imageboards like this.

It would help a ton with creating random events and making game more dynamic since neighbouring civilizations wouldn't stay at same power all the time or depend on my judgement of how they would develop. Instead I would like the computer to handle it by computing together factors on which development of civilizations would depend on.

I would just write it in form of webpage(s) with HTML5 and JavaScript. I would really prefer to keep to web development languages. I have seen well made advanced game of similar theme being contained in single .html document, so its gotta be possible.

I would like to put it to use as soon as I get necesarry ammount of calculations working so the program can take care of most important stuff like population growth, happiness, AI settlement expansion, resource management of AI civilizations, etc...

To be clear, this isn't me asking for help. I just wanted to show of my idea and am curious what do you guys think. If anyone wants to work on this with me, I would try to coordinate with them, but I can't make performance promises.
This is just my little thing to keep me occupied and away from degenerate drugs/hobbies.

Also I am hypocrite for telling Atlas that game developing is a time sink and waste of time and its oversaturated market. While all of these things might be true, I am doing game dev myself now.

Here is code from .html file:
https://pastebin.com/HcBhSYVx

And here is code from .js file:
https://pastebin.com/b58pQN3Q
Anonymous
dcHo0
?
No.578
580
>>577
Are you thinking of perhaps using a Civilization game as a base and creating a mod for one? Or do you really want to start wholy from scratch?
Anonymous
fWql+
?
No.580
581
>>578
Not gonna use civilization game. I don't need any graphics. Map of colored squares at most.
I talked about it some time ago here:https://mlpol.net/mlpol/res/49708.html#49723
Maybe this can explain it a little better?

To be honest, this anon helped me hatch this idea. Even though I am not watching his gameplays. https://mlpol.net/vx/res/417.html

Anonymous
8jsDV
?
No.581
582 591
>>580
>want's to make a text based simulator
>decided not to use graphics
>this simulator would have a internal civilizations that would dynamic shape the game world

What the hell, are you me? I learned everything I could about c++ and started making AI engines that would act like a text adventure game where AI actors would go about playing a game and you would be wondering around through the dynamic world.

I also am the guy playing the hotseat game(which I will get around to catching up in turns soon), I can't believe someone like you exists.
Anonymous
8jsDV
?
No.582
>>581
I say do it, I would love to see something this complex come into existence, I have written thousands of lines of code trying to create something like you describe. A civilization/human society simulator running in the background where the player isn't truly in charge yet can still influence the events around him, with abstract representation of towns and city's and wars, allowing the player to experience the flows of human history, or the flow of a dynamic world
Anonymous
8jsDV
?
No.584
585
vic2.jpg
>>577
The hardest part is no doubt the map aspect or conveying where everything is relative to each other. Creating a game with tiles needs to have some kind of graphical setup, if you went full text based, it becomes really hard to explain to the player where resources, military, and the boarders of other nations are since all of these things are dynamic, the Artificial players know all there is to know, but having to update the player every turn of what the AI has done is almost impossible(using some kind of priority updating system would be a good idea, only note the most important changes). Plus, the player would have to get a copy of the map or draw one out for themselves. So if maybe it's easier with web programming to set up some kind of simple map interface, I would invest the time to learn how to do that.

Setting up the map can be challenging, I've tried many times to write code that would create maps as natural as a civilization game can, the oceans/continents/islands, but I haven't be able to make a good map generator yet, and if you try to develop a map without a generator, then your limited by how much time and effort your willing to put in to create the map. So it depends on how big the map is and how much a map tile is worth.

So instead of using map tiles/hexes I decided to go down the Europa universals/hearts of iron/ Victoria 2 game route, where you take a map and divide it up into tiles, and code each one in. But there are only so many tiles you can hand draw, the games I just listed have many many many tiles, thousands even. So without graphics, even if I created a map that huge, it would become to inconvenient to the players.

Then I found the best of all worlds, how to set up a text based strategy game, one that requires no computer graphics(I tried learning openGL and one day I might actually be able to do more then create a floating spinning cube) and yet could simulate many different AI actors competing over many "tiles".

I set it so that each map tile, had many more territory's inside it, meaning that even if my hand drawn map has 300 tiles, it can have many more territory's, allowing for more AI actors(having a small map lead to having only a few AI on the map), so with territory's you would share tiles with other nations, and you would compete with them like the territory existed on a map.(Combat became almost RPG like because armys didn't exist in physical space, but in tiles with territory, so simulating combat meant it had to be abstracted into a turn-by-turn action by action thing instead of maneuvering on a map).

So it can be done without graphics, but it's far easier to use graphics then to not.
Anonymous
8jsDV
?
No.585
592 594
filename-2.jpg
filename-4.jpg
>>584
Here is a picture of the map I was working on
Anonymous
8jsDV
?
No.586
596
>>577
Anyways, if you're ever want help on how to get some aspect of code to work(how to get the AI to act in a way, or how to have the computer generate descriptions/events) I could help with the concept idea(I have no idea how to code in HTML5 or JavaScript) maybe if I described how I would do it in C++, it could help?
Anonymous
VXY7N
?
No.587
>>577
>game developing is a time sink and waste of time and its oversaturated market
It's true that the market is oversaturated and basically everyone you meet these days is an indie developer, that doesn't necessarily mean it's a waste of time though.

If you're only creating games because you want to make money then yeah, you're probably wasting your time. It's like music or writing or any other creative pursuit where it's easy enough to create something but next to impossible to get enough people interested in your project to make it commercially viable.

Personally though I just make games for fun, I figure time spent on game dev is just free time I would probably waste doing something equally stupid and unprofitable, so who cares?
Anonymous
fWql+
?
No.591
593
>>581
Hello, hotseat anon.
>What the hell, are you me? I learned everything I could about c++ and started making AI engines that would act like a text adventure game where AI actors would go about playing a game and you would be wondering around through the dynamic world.

Its kinda funny maybe the way you set up your hot seat civilization game was already influenced by your desire to create something like this.
I was thinking about making playable tet based game like this but had only rough idea since there are so many options of what you can do in such engine. When I saw your gameplay, it gave me an idea how to test out the engine with Quest game.

I always thought someone had to thought about making such game before. I went and browsed the web and tried playing few similar games but only games that could come close to that were "Majesty" and "Warsim". Warsim is similar to what I envisioned but its not quite there. No settlement placement and no multiple playable races(dev plans to change that in few updates).
Anonymous
fWql+
?
No.592
594
map.png
>>585
Looks nice. But I would like to generate map tiles. You'd basically need to prepare pixel art of some continents and then generate and simulate settlements ,forests, etc.

Blue is for water, green for grassland and purple is for settlement, dark purple can be used as a town and centre of administrationn and its surounding titles may be country side settlements or something like that.

I used gimp2 to draw this in about 4 minutes. Though I will probably need to draw bit differently when using html and javascript for that.
I don't know if the pc can draw on such pixel map by itself or whether I would need to do it. Still, if I could get enough info from those calculations, it shouldn't be a problem as long as its used for Quest games.
Anonymous
8jsDV
?
No.593
>>591
I have looked for a game like it as well with no luck. And yeah the idea of playing a multiplayer game against myself is apart of my interest in creating my own strategy game one day.

>rough idea since there are so many options of what you can do in such engine
I know, learning a programming language really leads to so many possibility's, when I learned how to use C++ I realized that I could create so many cool things out of it, and I have many ideas of things I want to make. But like you said in the other thread, I also have the curse of starting massive ambitions projects, then abandoning them when the inspiration runs dry.
Anonymous
0lRvC
?
No.594
595
voronoi-map-goal-16000-shaded.png
>>592
>>585
There is several ways to generate a map on the fly. One of the nicest implementations I've seen is using Voronoi diagrams. So if you want to go all out it can produce some really nice maps. Might not be the best for tilebased play but might work well too.
http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/
Anonymous
fWql+
?
No.595
597
>>594
Thanks, that website looks useful.
Anonymous
fWql+
?
No.596
>>586
> maybe if I described how I would do it in C++, it could help?

I don't know, to you need to tell us how would you make it in C++ to relay your ideas? Either way it will probably work anyway.

I read something about C++ on https://www.tutorialspoint.com/cplusplus/cpp_basic_syntax.htm and I have an impression that javascript is easier. Sure, its chaotic, sometimes unreasonable but the syntax doesn't seem to make much sense.

cout << "Hello World"; // prints Hello World

What does the counting have to do with printing out a sentece anyway?
Anonymous
0lRvC
?
No.597
598
>>595
cout is just standard output stream. For input you have cin.
>cout is the output stream
>"Hello World" is the string
> << The string is sent to cout
Input equivalent is
cin >> variable;
>standard input is sent to variable

It has to be said I am mostly a C guy and more familiar with <stdio.h> with printf and such.
Anonymous
fWql+
?
No.598
599
>>597
Well, the arrows are good but count and cin don't seem to make sense to me.

printf on other hand, does make sense.
Anonymous
0lRvC
?
No.599
600
>>598
I think the c in cout/cin can be viewed as short for cli (command line interface) as it is standard input output.
Anonymous
fWql+
?
No.600
601
BEHSDat.png
>>599
It says here its standard input stream.
http://www.cplusplus.com/reference/iostream/cin/ Not very good abbrevation but w/e. I don't mean to bash c++ just reasoning why I prefer js over it, for now.

Just finished this. Next I want to integrate items so they are always included in calculating constitution and health.

Anonymous
0lRvC
?
No.601
602
>>600
I fully understand what you mean, and I also prefer printf and sprintf.

With items do you mean items that giver +/- to the character stats (rings, armor, weight overload)?
Not sure what you have made so far or if the following text is useful. But I tend to think the way to do it is to make it so "generic" as possible. i.e. make a Class that is shared by items.

BaseClass {
int modifier_health;
int modifier_constitution;
...
}

ItemCalss extend BaseClass {
int value;
int weight;
...
}

WeaponClass extends ItemClass {
int hitpoints;
...
}

This way you can pass whatever item or weapon to the character stat calculations, and since you know that they all are inherited from BaseClass they will always have the modifier values and accompanying functions.
Anonymous
fWql+
?
No.602
603
>>601
This looks like you are using objects. I haven't really used them yet but figured I will need to for this thing.

This is a good suggestion. I will come back here once I get working on it again. I think that WeaponClass needs to contain several other child objects, holding info about individual items like "hitpoints damage" and such.
Anonymous
0lRvC
?
No.603
604 607
>>602
It will probably be a bit back and forth before you get a good balance for how to separate each object and how to name them. There might be a complete Best Practices manual out there for different type of games.

In some OOL it is possible to have a class inherit from multiple classes so you don't have to nest them like prev example.

ex. (probably bad example, I haven't looked too closely on how to separate and all that).
BaseClass { ...generic functions and variables... }
ItemClass { ...variables and functions related to items... }
WeaponClass { ...variables and functions for weapons - perhaps battle functions etc.... }
ArmorClass { ...variables and functions related to armor... }

SwordClass inherit BaseClass, ItemClass, WeaponClass { inherits both from base and weapon }
UniqueSword inherit BaseClass, ItemClass, WeaponClass, ArmorClass { inherits from all classes mentioned }

>but what is the best way and all that I am not 100% sure about
Anonymous
0lRvC
?
No.604
605 606
>>603
Previous example is probably not the best example. You can probably do a check to see it the object you are working on is of type "Armor" then do armor stuff, and if it is of type "Weapon" do weapon stuff. But how to actually organize this in a good way so you can have rings that deal damage, swords that provide protection, backpack that can hold stuff deal damage and provide protection, etc. without having to give all items all the properties.

But perhaps giving all items all the properties is the way to go.
>ItemClass inherit BaseClass, WeaponClass, ArmorClass, StatClass ....
This way you have separated the different type of properties and calculations, and each of the inherit classes has its own constructor and all that.
>on update
>for each item on person
> calculate armor
> calculate weapon
> calculate ...
And for objects that has no armour properties these won't be calculated.

>But here is where some of my problem lies, there is so many ways to do stuff, and I don't know what the best way is.
Anonymous
0lRvC
?
No.605
>>604
>won't be calculated because they will have been initialized to 0
>i.e. they will be calculated but have no effect if I am not just making it even more confusing at this point
Anonymous
BF7kl
?
No.606
>>604
I am knda drunk but still kinda get what you are saying.

Very good ideas.
Anonymous
8jsDV
?
No.607
608 609
>>603
You could use strings
class all_stuff
{
public:
int important_value;
int item_price;
bool defensive;
string item_type;
all_stuff()
{
item_type = "Null"
defensive = false;
}
}

That way you wouldn't need many different classes, since the would be overlapping values between them.

void What_is_it (all_stuff sample)
{
if(sample == "armor")
{
defensive = true;
};
}

Using boolean tags you can have the computer check and use the object however you want, without having the class for weapons and armor, it helps with creating functions later on
Anonymous
8jsDV
?
No.608
>>607
*if(sample.item_type == "armor")
Anonymous
0lRvC
?
No.609
610 611
>>607
Only reason I am prone to separate into different classes is that you will have an easier time to maintain the code as each file only contains code specific to one area of operation. But it is many ways to do stuff, that I am not sure what is the best way.

But with your method a switch or flags and have
>int item = 1;
>int armor = 2;
>int weapon = 4;
>int ring = 8;
and then have an
>int item_type = item & armor & ring;
>if (item_type | armor != 0)
> do_armor_stuff();
Anonymous
0lRvC
?
No.610
>>609
>fuck me.. and (&) and or (|) switched...

>int item_type = item | armor | ring;
>if (item_type & armor != 0)
> do_armor_stuff();
Anonymous
8jsDV
?
No.611
612 613
>>609
That's the thing about C++ or all coding languages I would assume, there are so many different ways to go about creating the same thing. I like to mash classes together when I can so that I can pass less variables to functions and tJen have less functions to deal with the class instead of juggling the weapons/armor/accessories, because most of these things just modify character stats.

Class player
{
vector <all_stuff> equipped_items
int defense;
int attack;
void cal_item_effect()
{
for (international x = 0; x < equipped_items.size; x++)
{
if (equipped_items[x].item_type == "armor"
{
defense += equipped_items.important_value
}

and so forth
Anonymous
0lRvC
?
No.612
>>611
Your method might be the fastest as I always end up rewriting stuff a couple of times before I am more or less happy. But I always find outliers that won't conform to the idealistic and simplistic world I have envisioned.
Anonymous
8jsDV
?
No.613
614
>>611
Kek, auto correct, typing this out through my phone. I like the switch system as well, creating a catalog of intager ID's to identify what the item should be treated as is a great approach. But yeah, just adding my two cents
Anonymous
0lRvC
?
No.614
616
>>613
I can't count how many times I have found myself staring at the screen thinking what would the best way to do this be? And how can I do it without having to rewrite what I already have coded. And in those moments thought I should have written a little flowchart and stuff before I started to code. But it is much more fun to code than to write flowcharts so I never do. But deep down I always know I should have done the pen and paper work first.
Anonymous
8jsDV
?
No.615
617
I know what you mean when you say having multiple classes keeps it all organized, the way I do things can get really messy, I tend to write everything on on large C++ file, instead of creating headers and linking files together.
Anonymous
8jsDV
?
No.616
617
>>614
> I know deep down that I should create a flow chart

Hahaha, I know I know, have an actual plan before I code? Pfffffts, naahhh, who needs a plan? Just make it up as I go, I already thought out every thing that I want, what could go wrong?

>spends hours writing function because I changed an array to a vector and made just one more efficient class
Anonymous
0lRvC
?
No.617
618
>>615
It is so easy to do it that way, and I do it too. But when you get to a few thousand (or tens of thousand) lines of code it gets hard to find where the problem is.
But the main thing I do wrong is to little comments in the code. If I go to a section I haven't worked on in a while I no longer know what I was thinking at that time.

>>616
Yep, that is the worst part. You always know what you actually should have done when you are half-way out in the project (or "finished") resulting in an rewrite. But then again you never seam to get past the stage where you discover/think "hmmmm... if I did it this way instead..." or "hmmm... I should do it this way instead...."
Anonymous
8jsDV
?
No.618
619
>>617
>comment the code
Something I do every once in a while(when really I should just do it all the time), I have so many projects that if I take to long of a break, I have to "re-learn" my own work, what I was doing, where everything is going, what being passed where, it's a nightmare. And yeah, having one massive file that I need to scroll though doesn't help either, haha.

>But then again you never seam to get past the stage where you discover/think "hmmmm… if I did it this way instead…" or "hmmm… I should do it this way instead…."

That's the thing, rewrites are usually "oh, hey this would work so much better if I did it this way", almost as if I did it wrong, but not that the stuff I coded was wrong, more like, there was a far better way to get the same results and it makes everything more efficient/flexible and I didn't think about it until I almost finished the other way first. Joy's of coding
Anonymous
0lRvC
?
No.619
620 621
Tree-Swing-Cartoon.png
>>618

Anonymous
cvaWm
?
No.620
>>619
Kek
Anonymous
8jsDV
?
No.621
624
>>619
>how the project was documented
not even the tree made it into the documentation, haha, yeah, so true.
>programmer made the swing touch the ground
It can feel that way sometimes, all that work for something that isn't functional until the very end of the production cycle. It's funny how that works, I write line after line of code and test fragments of a massive project while feeling inspired to do so, yet everything I'm working for will take 100's(+) hours to brainstorm and code. And somehow I have motivation, knowing that one day, it will be as I want it to be.

Do you any fun projects your working on right now or plans for future projects? I have the civilization game I talked about, but I haven't touched the project in a mouth.

Anonymous
0lRvC
?
No.624
627
>>621
>all that work for something that isn't functional until the very end of the production cycle
It is so true. And at times you can't even test the code before you have written countless lines of it.

Can't say I have any big (or small) projects I am working on at the moment. Sadly I am mostly intermittently inspired to write some code (game) but I find it more fun making parts of it work than the whole. So when I know I can do some functionality I know I could make it all (given enough time), but it is a mountain of work to complete it. And I am shit at graphic and sound, and that is what makes a game I think, at least for the end user. The spreadsheet stuff (the code) in the background is pretty straight forward with some trial and error. But at that time I am "bored" as the fun stuff figuring out how to solve a problem is over. And it is much more fun finding an solution than to refine the solution into a finished product.
If you want someone to help with your game I am willing to join in. I have to say I am mainly a C guy and dabbling a bit in C# because of Unity, and I have some experience in PHP for web.

I've been wanting to make an Arcade flying game more or less in the style of Race The Sun but more free flying and random terrain.
Anonymous
8jsDV
?
No.627
630 661
>>624

>Sadly I am mostly intermittently inspired to write some code (game) but I find it more fun making parts of it work than the whole

I know this feeling all to well, sometimes a break though in how to get something working is so exiting that moving on to the next part can be demotivating, because you worked so hard to figure one aspect out, only to realize that there is so much more to be done before the dream comes alive.

>The spreadsheet stuff (the code) in the background is pretty straight forward with some trial and error. But at that time I am "bored" as the fun stuff figuring out how to solve a problem is over

Coding is the prefect mix of creativeness and logic solving, and once it's over and you found the solution, implantation can feel like a chore.

>but it is a mountain of work to complete it

Isn't that amazing, the idea that it can all "work". I love that part about being a programmer, it almost feels like anything is possible, that no matter how big the project is, it's all small little steps.

>And I am shit at graphic and sound, and that is what makes a game I think, at least for the end user.

Graphics can be so important, and yet not really that important to the coder. Did you try learning OpenGl or Directx? Something else? I'm also shit at graphics, I was learning OpenGL for awhile then I realized just how much work I would have to do and decided to keep it text-console based for now.

>If you want someone to help with your game I am willing to join in. I have to say I am mainly a C guy and dabbling a bit in C# because of Unity, and I have some experience in PHP for web.

Hey that would be awesome, though my coding style uses a lot of vectors and loops, with almost no documentation except for little notes that only make sense to me. Haha, still maybe, if your around you could help me with solving coding problems when I get back to work on my project.
Anonymous
0lRvC
?
No.630
632
>>627
Regarding coding Graphics I was dabbling with a few graphic libraries but switched to Unity as it has all you need (same for Unreal and CryEngine etc). The problem I have with graphics is making 3D models to put in the game or tiles or animations, the Artsy stuff. Putting an image into a game is fairly easy, drawing an image that looks good is another story.

I fully understand the problem you have. Commenting and documenting code is as boring and important as making flowcharts before you start coding. So it never happens. When you find yourself barely understanding your own code without backtracking where the function calls go it is hard to explain it to others.
But just let me know (post in /vx/) if you need help or want input on anything.
Anonymous
8jsDV
?
No.632
660
>>630
>The problem I have with graphics is making 3D models to put in the game or tiles or animations, the Artsy stuff. Putting an image into a game is fairly easy, drawing an image that looks good is another story.

Oh I know, I'm not a natural artist, I may have potential to be one, but the hours and hours of practice I would need would just to get something decent is to much for me.

>But just let me know (post in /vx/) if you need help or want input on anything.

Yeah, that would awesome. The last thing I was doing for my civilization game was trying to figure out a game mechanic and how it would work in the game, so it wasn't so much a coding issue but a concept issue. If I come across something I could use some help with, I'll look for you here on this board.

Same for me by the way, I wouldn't mind helping with figuring out an aspect of code if you wanted help.

>>577
Same for your game(though I know nothing about HTML code) but I'm sure the concepts(looping though information, the objects) still apply, if it's possible to translate the ideas into HTML then I'm willing to help.

Anonymous
0lRvC
?
No.660
>>632
Many thanks, and also same goes for you >>577 just let me know if there is anything you need help with or input on.
Anonymous
fWql+
?
No.661
>>627
>Coding is the prefect mix of creativeness and logic solving, and once it's over and you found the solution, implantation can feel like a chore.

Then why not have somebody less skilled in code to do the implantation for you?