Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (804)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 5 6 [7] 8 9
  ignore  |  Print  
  Vangard  (Read 194829 times)
0 Members and 1 Guest are viewing this topic.
Offline Destructor

Junior Devvie


Medals: 1
Exp: 2 years



« Reply #180 - Posted 2016-01-31 22:08:12 »

I'm curious to find out how much you hold entities in your map? From your posts I concluded that you holding many entities, if I am right, here is other questions:
1) How you updating large number of entities.  Tongue
2) What is your fps? Cheesy
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #181 - Posted 2016-02-01 07:09:40 »

Destructor, I am targeting 30fps. regarding entities, I posted this previously:

(Quote)
The world is divided into a 100x100 grid, with each cell representing 100m x 100m. During an update an entity can only interact with its own cell and the neighboring cells. This means that logic updates can be done in parallel as long as each cell being updated is separate from other cells being updated concurrently by two intervening cells in all directions.

All entities have a list of behaviors. They get their behavior list from their current career. Each career has exit careers (so a warrior could become a champion or a berserker). When a character satisfies the various entry requirements and enters a new career, their set of behaviors changes.

Behaviors have a planning component and and an execution component. The planning component is more expensive but is run less frequently, while the execution component is executed each logic tick. The execution logic depends on whether the behavior is the current highest priority behavior. for example, if a woodcutter is chopping wood and is attacked by a bear, fighting has a higher priority, while crafting has a lower priority. In the implementation of crafting, no work is done if crafting is not the top priority.

Other behaviors get executed even when they are not top priority. For example, HungryBehavior increments its needToEat counter each logic tick regardless of what the character is doing.

Behaviors communicate with each other by setting shared properties on the character. For example, the woodcutter's crafting behavior can only be executed when the character is adjacent to a woodpile, so if the character is not near a woodpile, the behavior sets its priority to -1 (cannot execute) but adds the nearest woodpile to entity.movement.desirables map (the other component of the map entry is the priority of the desirable). The GoToBehavior monitors this collection and if it is not empty tries to move to the desirable with the highest priority. (more accurately, in the planning phase, GoToBehavior selects the highest priority desirable as the target, and sets the behavior priority to the desirable priority).

Likewise if a behavior needs an item from the inventory and the item is absent, the item is added to the inventory.wishlist collection. And this collection is monitored by other activities such as PickUpBehavor.

As I've learned, debugging this stuff is a nightmare and I am just writing mountains of test code at the moment. Smiley

By the way, some behaviors are not from the career. I am thinking about adding personality behaviors, like GreedyBehavior or LazyBehavior to make the characters more unique.

....

I think the real figure is around 60k entities now, but there are only 1k humans and a couple of thousand other active entities like animals. The rest are just trees and rocks. Entities can move anywhere; some have an ExploreBehavior that will cause them to visit the entire map (unless they get distracted by a shiny new thing along the way).

I don't do pathfinding. Entities just move towards their target and have a bit of logic to get unstuck when needed. When entities can go inside buildings, I will need a smarter and more expensive pathfinding solution.
(/Quote)

Offline Destructor

Junior Devvie


Medals: 1
Exp: 2 years



« Reply #182 - Posted 2016-02-01 12:57:11 »

But you will use pathfinding, right?
If yes, then you should find a way to assign path to each entity without fps drop and do this is not easy then you have ~60k entities, even if you will assign certain number of paths per second with ~60k entities, last entity will need wait for a path too long I think.  persecutioncomplex
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Emmsii
« Reply #183 - Posted 2016-02-01 19:54:53 »

This means that logic updates can be done in parallel as long as each cell being updated is separate from other cells being updated concurrently by two intervening cells in all directions.

So have you implemented multithreading with your entity logic?
Offline J0
« Reply #184 - Posted 2016-02-01 20:48:10 »

So have you implemented multithreading with your entity logic?
One thread for each entity! Roll Eyes

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #185 - Posted 2016-02-01 21:18:08 »

I use two threads per CPU core, this seems to be the optimum number for Windows (not optimal for Linux, sorry Linux). There are 10,000 one-hectare cells and these are shared out between the threads in a thread-safe order.

Rergarding A* etc pathfinding, I'm just not very interested in it. It's expensive and beeline works ok. For indoors movement I will need to have some logic to the movement, as in pathfinding with only a small number of nodes (doorways) to consider. But for outdoors movement I will keep it simple. The complexity in outdoors movement comes from including hazard avoidance, stealthy movement, grouping behavior (so citizens travelling between settlements do not travel dangerous roads alone)...

Most of the objects in the game are small, convex and reasonably spaced, so going in straight lines and sliding to the right around obstacles works for 99% of the cases. For the rarer cases where an entity gets stuck, it simply scatters randomly and tries again. This covers most the remaining cases. It only fails for very large or irregular/concave objects, and for these I will provide local waypoints to guide the entities without the need for global pathfinding.

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #186 - Posted 2016-02-03 11:48:13 »

Render millis were ranging between 24ms (75x zoom) to 60ms (1x zoom) on my new HD530, so I wrote a simple batcher. With partial batching the render millis have improved to the 15-40ms range, with the small side effect that nothing is visible on-screen any more!

This is all unwanted effort as I need to be using LibGDX not Java2D, but I want a quick fix, and the batching may be useful even when I switch graphics frameworks.

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #187 - Posted 2016-02-06 23:45:06 »

Are you using OpenGL flags for your JVM? I enabled it and it gave me around 10x better performance (frame times of <1 ms) - transparency can be accelerated too. I could give you some pointers on your rendering code, if you like?

I really don't want to invest in the J2D rendering, but I wanted it at least functional on my PC. So I followed the suggestion of Coldstream24 and added this environment variable:

1  
J2D_D3D_NO_HWCHECK=true


Rendering performance has increased threefold as a result. Which is good enough for now Smiley

Offline CommanderKeith
« Reply #188 - Posted 2016-02-10 17:45:44 »

CommanderKeith, that is the kind of graphical direction I want to take Vangard in, not including the oriental feel which is very pretty by the way. I'm planning on representing people as simple animated silhouettes, adding lowpoly branches to the trees and so on. I'm just permanently bogged down in the AI...

My dream game is Vangard, a whole world deep simulation. And I'm writing it!

What do you mean by animated silhouettes for the people?

Your low-poly tree idea reminded me of a very nice low-poly 3D green forested world in a game called Rain whose graphics style you may find inspiration from

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #189 - Posted 2016-02-11 11:26:10 »

I plan on making people simple monochrome top-down silhouettes to keep the poly count down (and to keep animation simple). A bit like the figure in one of your draft screens you showed on the other thread.

I'm liking the look of Rain!

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #190 - Posted 2016-02-27 21:03:44 »

First update in a while; I've been having some nasty health problems involving surgery lately so I have not done anything on Vangard for a while.

Today I added a small feature that lets you put your player-controlled character on "autopilot". Press "A" and the character's default AI takes over. For example, a hunter will go hunting, or a healer will gather herbs and craft potions. Press "A" again and you have full human control of the character once more.

I am now working on another feature which is slightly more complex to implement, namely allowing you to switch control to adjacent character. So you can walk your character next to a guard, take control of the guard, and so on.

This may have interesting gameplay possibilities (Demonic Mode anyone?) but for now it is just a debugging tool.

EDIT: Turns out that was a fairly significant update. It meant I had to create an Action class for deferred actions (like modifying the behavior lists of two entities), for which I needed a concurrent queue so that the logic threads can queue up deferred actions like control changes and long-range ownership changes, financial payments, which are then popped off the queue in a (sadly) single thread.

Short range interactions between entities are handled multi-threaded - if entities are closer than approx. 200m then they are in the same thread and I can update them safely. But for longer range interactions I have to defer to a single-threaded cleanup queue.

I'm having fun here, sneaking around the village and taking control of random citizens Smiley

It's almost as much fun as bumping into trees.

Offline Coldstream24

JGO Ninja


Medals: 82
Projects: 1
Exp: 4 years


You can fill that void inside with programming, but you'll never return a value.


« Reply #191 - Posted 2016-02-28 21:54:24 »

That sounds awesome! It's a great feeling when hard work pays off and things come together.
And I hope you get better soon, mate.

My website: http://www.onedropgames.com/
My soundcloud: http://www.soundcloud.com/coldstream24
Creator of the Morningside Engine, co-founder of Onedrop Games.
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #192 - Posted 2016-02-29 11:33:45 »

As a little background info, the player control of a character is just a high-priority behavior added to the character. The player control trumps any other behavior (excluding background always-on behaviors like GetHungry) so the character is "under control of the player". To allow the character to go on autopilot, I only needed to allow a switch to set the player control behavior priority to -1. It also means that control can be attached to anything that is sortof human-like, so I can for example take control of a deer, and then lure a pack of wolves into the heart of a village.  Grin

Offline J0
« Reply #193 - Posted 2016-03-05 14:26:12 »

It also means that control can be attached to anything that is sortof human-like, so I can for example take control of a deer, and then lure a pack of wolves into the heart of a village.  Grin
I hope this remains in the final build. Pointing

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #194 - Posted 2016-03-05 18:04:53 »

I must admit I am quite enjoying this game mechanic, I have a vague idea for a demonic mode where you can posess most people (but not everyone), and the game objective is to unlock a portal to hell itself.

Offline Sheph

Junior Newbie


Medals: 1
Exp: 7 years



« Reply #195 - Posted 2016-03-11 07:13:00 »

Hello, just checking in on the game again. Smiley I wanted to share with you another game from which you might draw inspiration. It's called Future Unfolding. The genre is completely different, but graphically it is beautiful and the trees of that game reminded me much of the trees here. There are plenty of beautiful animations (such as a bush shaking when the player touches it) and I think you could pull it off with the setup you have for your shrubbery and trees to make your game seem more lively. The animals of that game also touched me and they seemed very 2d apart from the shadows.

Anywho, wishing you well on your game. Take what you will from my ramblings. Good luck!
Offline thespecialbro

Junior Newbie


Medals: 1



« Reply #196 - Posted 2016-03-11 13:01:16 »

Hey ags I have just recently started reading this thread and am loving your game so far! My question for you: is the bug where the UI jiggles around occasionally fixed or is that still in progress? Tongue
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #197 - Posted 2016-03-11 23:47:40 »

I haven't observed that issue, so I'd have to say it's not fixed. Thanks for the encouraging feedback Smiley

Sheph, I'll look into Future Unfolding.

Big coding weekend coming up. Gonna stick an arrow in a deer!

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #198 - Posted 2016-03-15 22:11:23 »

I had a little brainwave on my way home this evening about how to handle the recurring situation of either executing an action in the multithreaded part of the logic or in the single-threaded part of the logic. It involves wrapping the action in an object that decides to execute itself or defer itself to the single-threaded phase.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
/**
 * This is an action that can take place over a long distance.
 * If the distance exceeds 100m then the action may be out of bounds of a spatial thread
 * and the action then defers itself to the single-threaded queue.
 * Created by Agslinda on 3/15/2016.
 */

public abstract class LongRangeAction implements WorldAction {

    public void execute(double distance, World world) {
        if (distance > 100) {
            world.putDeferredAction(this);
        } else {
            act();
        }
    }

    public void execute(Entity thiss, Entity other) {
        execute(Collisions.distance(thiss, other), thiss.world);
    }

}

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #199 - Posted 2016-03-16 11:44:41 »

The deer armageddon has been unleashed after months of procrastination. Bloodthirsty hunters have slaughtered whole herds of Bambies, leaving the corpses to rot in the fields (they don't yet know why they are hunting the deer...).

Now I need to tweak the goto behavior so so day goto objectives aren't followed up at night. For example, if a hunter sets out toward a herd of deer in the afternoon, they might end up chasing it all night and get no sleep. i.e. HuntingBehavior is scoped to daytime, but it spawns a goto task that is not yet scoped to daytime.

Offline philfrei
« Reply #200 - Posted 2016-03-16 20:01:19 »

I was reading an interesting book the other day, that had a section that pertains to hunting. A key evolution for humans was the ability to sweat and thus not overheat. The hunting advantage was that a human could track and pursue for much longer periods than animals could flee--reducing the advantage the animal might have in speed. Animals apparently overheat more quickly than humans and need more cool-down periods. Thus, a team of hunters that spell one-another could be a deadly hunting team.

I wish I could remember the name of the book. It is about four ways human evolutionary advantages have become too successful in the modern context. The craving of salt, for example, that is part of the endurance advantage becomes more a hindrance when we don't need it to run marathons and high blood pressure becomes a health threat.

music and music apps: http://adonax.com
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #201 - Posted 2016-03-16 23:13:37 »

philfrei, you might like a book called After the Ice, which is about post ice-age archaeology. It's a long and somewhat repetitive book, but I think it has a special something too.

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #202 - Posted 2016-03-27 15:44:52 »

Fixed the bug that day behaviors would continue their goto instructions into the night. But the problem is when hunters get close to a deer they switch to attack behavior, which remains active day and night, and also has very high priority. So they are still getting no sleep sometimes.

It's probably not a bug, just an indication that I need to add exhaustion to the mix here. The hunter should tire out after a couple of hours.

After I add that I will upgrade SleepBehavior so that Vangardians that are far from their home will make a little campfire and camp overnight rather than commuting back to their hut - they often spend all night travelling and get no rest Smiley

That's important for activities like battles, where dozens of Vangardians will need to camp for a couple of days at their respective mustering grounds.

Offline J0
« Reply #203 - Posted 2016-03-27 16:43:15 »

ags1, your medals are nearing 28 Wink

So they are still getting no sleep sometimes.
Are hunters taking that long to kill a deer?

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #204 - Posted 2016-03-27 17:21:12 »

Some don't seem to be highly skilled with the bow....

To clarify, even the good hunters take a few hours to bring down a deer. Think how long it would take in the real world Smiley

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #205 - Posted 2016-03-29 08:13:55 »

I finally put down my ideas for a magic system.

There are 5 minor arcana and 7 major arcana, each opening up different sets of spells. Each spell is inbdividually upgradeable. Instead of getting more spell points as you get more powerful, you can upgrade the cost of the spells.

Some spells are aligned to the Norse elemnents of fire and ice or to the principles of good and evil, and a caster can't learn spells of opposite natures.

Its all in a google spreadsheet but I can't yet figure out how to make it public. Anyway, here is the spell list:


fireball   A ball of fire engulfs friends and foes alike.
flamingSword   A weapon burst into hot flame.
freezingSword   A weapon burst into cold flame.
zombie   Raise a rotting corpse as a (potential) servant. Can upgrade from generally hostile zombie to allied zombie.
iceBlast   A blast of cold radiates from the caster.
killingWord   The caster has knowledge of the Terrible Word that is death to hear.
lock   Lock or unlock a door, even if it doesn't have a lock.
invisible   Become partly or completely invisible.
shadowWarrior   Conjure a half-real warrior to smite your enemies.
summon   Summon a demon from the realms of Niflheim, Surt or Ginnungagap. Controlling the demon is an opotional upgrade.
blockFire   Provides armor against fire.
blockIce   Provides armor against ice.
dispell   Break an enchantment.
counterspell   When targeted by a spell, a counterblast of energy hits the attacker.
ward   Spells are less likely to succeed in the targeted area.
deflect   Spell effects are deflected onto a nearby creature, possibly friend or foe.
jinx   Cast this on a spell caster. Their spells are less likely to succeed.
thunderbolt   A bolt of lightning shoots from the caster, striking a single target.
astralTravel   Transports the caster and possibly those nearby to another location.
sleep   Cause one or more people to fall asleep.
sleepwalk   Cause a sleeping person to walk to anothger location.
terror   Cause enemies nearby to take a morale check.
curse   Curse a creature with illness, weakness or ill luck.
blast   Shatter a structure with a word of power.
fly   Fly, upgrade from a slow hover to a swift hawk flight.
shapeshift   Take animal form. Upgrade to add alter forms or make current alters more powerful.
seeming   Steal the identity of another Vangardian.
whisper   Communicate over great distances with other magic workers.
undeath   Become a lifeless, eternal being sustained by dark magic.
eternalLife   Eternal life. Less powerful versions of the spell only grant increased longevity.
influence   Select opponent's answers in cobversations.
heal   Heal injuries and cure diseases.
blessing   Bless a creature with strength, health or good luck.
friendOfBeasts   Summon wild beasts to your aid.
light   A magical light source.
revive   A weak healing spell that affects an area (allies only).
darkness   A cloak of darkness.
fetch   Send your spirit out of your body to prowl the world.
attributeBoost   Use body magic to become faster or stronger.
confuse   Befuddle a victim, stunning them into inaction.
familiar   Acquire a magical daemonic companion.
drain   Suck hit points out of a target and gain magic points in return.
reverseDrain   Transfer injuries, poison or disease from target to yourself.
hiddenLand   Enclose an area in magic so that others cannot find or enter it.
trace   Find someone or some thing.
cloak   Block the trace spell.
banish   Send demons and spirits back to where they came from.
portal   Create a portal. Portals you create are connected.


Edit: lots of typos, it was typed on my little tablet.  Sad

Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #206 - Posted 2016-03-29 15:03:33 »

I'm having a few bugs at the moment (player character shoots themselves when hunting, like wtf?).

In frustration I decided to do some work on diseases. This is very simple: a disease is a behavior that copies itself to neighboring entities. A sickness has the effect of causing characters to desire healing potions. For mild diseases (like Sniffles) that is all it does, more severe diseases like Plague should also periodically whack off hit points, alter stats and reduce movement speed.

In my test, I started with 1 sick Vangardian (the player character), went to stand next to a market, and now 6 game days later 244 entities are infected...  Grin

At least I have created some market demand for the produce of healers Smiley

Obviously in addition to normal diseases, this model can be applied with a few changes to zombie outbreaks (if I allow Necromancers to cause these) and to sedition or the spread of other political ideas. So once one peasant has revolt against the brutal king in mind, other unhappy peasants can be "infected" with the idea.

Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #207 - Posted 2016-03-29 20:39:11 »

Isn't reality surprising, challenging and dynamic enough? Why take all the nuance out of a game by hammering it with outliers?

I cast a spell upon your finger tips, making them first overly sensitive and then just aporize for a bit, reducing your effectiveness in countering the above leading question. Ha. Magic.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #208 - Posted 2016-03-29 20:57:47 »

It's not really an outlier... In the absence of sickness and injury healers and witches have no economic viability. And the disease code is a simple thing to add. Also I think it adds to the dark ages feel. Besides which, disease and magic were intimately linked in the mediaeval mind.

Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #209 - Posted 2016-03-29 21:24:59 »

I was more concerned about zombies and spells to set your foe on fire by mumbling the alphabet in reverse order.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Pages: 1 ... 5 6 [7] 8 9
  ignore  |  Print  
 
 

 
Riven (579 views)
2019-09-04 15:33:17

hadezbladez (5504 views)
2018-11-16 13:46:03

hadezbladez (2398 views)
2018-11-16 13:41:33

hadezbladez (5766 views)
2018-11-16 13:35:35

hadezbladez (1220 views)
2018-11-16 13:32:03

EgonOlsen (4660 views)
2018-06-10 19:43:48

EgonOlsen (5681 views)
2018-06-10 19:43:44

EgonOlsen (3196 views)
2018-06-10 19:43:20

DesertCoockie (4094 views)
2018-05-13 18:23:11

nelsongames (5114 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!